control markers using GeoJson
See original GitHub issueHi all,
I can plot markers using GeoJson
or Marker
. I like using GeoJson since I can plot them all at once without a loop, and also I love GeoJson.Tooltip
, which looks great. Please see below for an example.
Unfortunately, I can’t figure out how to change the icon, or other properties of the markers when using GeoJson
. If I switch to looping and using Marker
, I have more control over the markers but the tooltips don’t look as good when specifying a list of values (I get a string representation).
Is there a way to change properties of the markers using the GeoJson
method?
data={'type': 'FeatureCollection',
'features': [{'id': '0',
'type': 'Feature',
'properties': {'SCHOOL_NAME': 'Ascension Elementary School',
'SCHOOL_CODE': 'ACSN',
'ADDRESS': '5205 New Street',
'CITY': 'Burlington',
'PROV': 'ON',
'POST': 'L7L 1V3',
'COUNTRY': 'Canada',
'style': {'markerColor': '#00000000', 'color': '#00000000'},
'highlight': {}},
'geometry': {'type': 'Point', 'coordinates': [-79.7491672, 43.371468]}},
{'id': '2',
'type': 'Feature',
'properties': {'SCHOOL_NAME': 'Bishop P. F. Reding Secondary School',
'SCHOOL_CODE': 'BHRD',
'ADDRESS': '1120 Main Street East',
'CITY': 'Milton',
'PROV': 'ON',
'POST': 'L9T 6H7',
'COUNTRY': 'Canada',
'style': {'markerColor': '#00000000', 'color': '#00000000'},
'highlight': {}},
'geometry': {'type': 'Point',
'coordinates': [-79.86306090000001, 43.530966799999995]}}]}
m = folium.Map(location=[43.342094, -79.803047], zoom_start=12)
folium.GeoJson(data, name='Schools', tooltip=folium.features.GeoJsonTooltip(fields=['SCHOOL_NAME', 'ADDRESS'], localize=True)).add_to(m)
m
Thanks so much for this incredible package.
Al
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Add 'name' from GeoJSON to Leaflet List Markers control
Markers loaded as GeoJSON from GeoServer. I want dispaly name of markers in list control, but unsuccessfully. Please, help me add name of ......
Read more >How to add markers via GeoJSON to an existing layer, without ...
Another idea would be to create another layer, add the json to it via setGeoJSON, then iterate over its markers and add them...
Read more >Using GeoJSON with Leaflet
Points are handled differently than polylines and polygons. By default simple markers are drawn for GeoJSON Points. We can alter this by passing...
Read more >Quickstart — Folium 0.12.1 documentation - GitHub Pages
There are numerous marker types, starting with a simple Leaflet style location ... Both GeoJSON and TopoJSON layers can be passed to the...
Read more >Importing Data into Maps | Maps JavaScript API
Learn how to import GeoJSON data from either a local or remote source, and display it ... solutions to see another example of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any progress on this issue?
Hey @Alcampopiano, glad you’re enjoying the package.
I’ve got a PR in for this issue that I have been needing to finish up in #957. Just been quite busy working on a lot of really fun stuff at a new job. I’ll try to get it wrapped up soon.