spatial-data-lab / knime-geospatial-extension

This repository is built for KNIME-CGA Geospatial Project, and the goal is to build Python-based nodes for geospatial analysis in KNIME Analytic Platform.
MIT License
25 stars 10 forks source link

Add a new layer-based Geospatial View node to combine different Geospatial View nodes setting and its data #113

Open UrbanGISer opened 1 year ago

UrbanGISer commented 1 year ago

I am wondering whether we can develop a new Geo View node to accept 2-3 existing Geospatial view node settings and their GeoDataFrame data to make a multiple-layer visualization. Though we can do that now by Geospatial View nodes, the configuration will be applied to all geometry features. So we can not apply different symbology on various GeoDataFrame.

I tried these codes in the Python View node, it accepts multiple layers of geospatial data, rather than concatenating them. We might past the information of style or kws for each visualization node as flow variables and send it to a new node, then we can visualize them layer by layer.

kws = {
    "column":"count",
    "cmap":"magma",
    "tooltip": "count",
    "m": None,
    "scheme":"FisherJenks",
    "k":5, 
    "legend_kwds": {
        "scale": False,
        "max_labels": 3,
        "colorbar": True,
        },     
}

kws["style_kwds"] = {"stroke": False}
gdf = gp.GeoDataFrame(knio.input_tables[0].to_pandas(), geometry="geometry")
gdf1 = gp.GeoDataFrame(knio.input_tables[1].to_pandas(), geometry="geometry")
map = gdf.explore(**kws)
def style_function(feature):
    return {
        'fillColor': 'none',
        'color': 'white',
        'weight': 1,
        'fillOpacity': 0.5
    }
folium.GeoJson(gdf1, style_function=style_function).add_to(map)
html = map.get_root().render()
knio.output_view = knio.view(html)
sturmkev commented 1 year ago

I also thought about that. I would like to see optional input ports for the \<geospatial view> node, so the user can add input data one by one and does not have to story all different data sets in one single table. Depending on the number of input ports the configuration window would allow to switch between every input table on a tab basis (see screenshot). image

sturmkev commented 1 year ago

Another improvement would be a toggle for each layer that is an input to the node. That would allow easy off/on switching of data sets to be shown, without connecting/disconnecting input ports (and possibly reconfigure the node again). Maybe this can be enhanced even further down to the classes, being labeled for display. The screenshot is an extract from QGIS. image

koettert commented 1 year ago

The heatmap node has a layer menu in the top right corner. No idea where this comes from. Do you know @wybert ? image

I also agree with Kevin to add dynamic input ports to the existing view nodes but they are not supported with the Python node framework as of now (internal ticket is AP-19137).

koettert commented 1 year ago

Requires support for dynamic input ports (AP-19137) moved to milestone 1.3

wybert commented 1 year ago

I added them for the convenience who want to hide the original points

wybert commented 1 year ago

This could solve the issue #193 use case

kickuth commented 1 year ago

Please find some feedback / requests to this feature here: https://forum.knime.com/t/layer-based-geospatial-view-image-output-and-other-great-things/73573

requested:

  • an image output
  • option to integrate a legend (per view or grouped in one legend). Can be positioned somewhere on the layout (on the map, next to the map, etc)
  • option to position map credits on a different place than on the map. Maybe at the bottom of the layout?
  • for PDF export: export as SVG with optimized size settings (some PDF export libs create giant PDF sizes).
koettert commented 10 months ago

Postponed until dynamic input tables are supported in the Python node framework