jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.48k stars 363 forks source link

ipyleaflet - how to create popup windows getting specific data from the attribute table of .shp #1102

Open haitiremotesensing opened 1 year ago

haitiremotesensing commented 1 year ago

I have created an interactive choropleth map (including different Layers) that represents polygons (regions). I want to create a popup when clicking a polygon that will show specific information about this. I load vector layers (shapefiles) but I don't want to show all the information is contained in the attribute table of the vector layer.

Here, I define the layers: # Load data vector1 vector1 = inter.loadLocalVector("name.shp") vector1 = vector1.parameter("identifyfield", "column1 column2 column3 GEOMETRY") vector1 = vector1.parameter("identifyseparator", "#")

then, here I format to the visualization of the layers: svg1 = interMap.trivariateLegendEx(vector1, "column1", "column2", "column3", 4, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, color1='#a50f15', color2='#253494', color3='#006d2c', color4='#ffffff00', title='Trivariate Choropleth', title1="value1", title2="value2", title3="value3.", fontsize=18, fontweight=500, side=350, resizewidth='30vw', resizeheight='40vh', digits=0, maxticks=5, showarrows=True)

and finally, I load the layers and add the identifyPopup to get the data:

image

What I don't know is how to define inside the popup element from which columns' data I want to show in the popup.

giswqs commented 1 year ago

This leafmap example might be helpful for you: https://leafmap.org/notebooks/53_choropleth/