question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

control markers using GeoJson

See original GitHub issue

Hi 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

sc

Thanks so much for this incredible package.

Al

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Damorckcommented, Apr 10, 2020

Any progress on this issue?

2reactions
jtbakercommented, Jan 31, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found