python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.94k stars 2.23k forks source link

Geojson: allow null geometry objects #1858

Closed hansthen closed 10 months ago

hansthen commented 10 months ago

GeoJson objects can have null geometry members according to the standard. However, if we pass a null value to folium, this will cause an error in m.get_bounds().

See https://datatracker.ietf.org/doc/html/rfc7946#section-3.2

A Feature object has a member with the name "geometry". The value of the geometry member SHALL be either a Geometry object as defined above or . . . a JSON null value.

Conengmo commented 10 months ago

Thanks @hansthen! Nice enhancement, good PR. I wanted to merge it now already, but I was also thinking it would be nice to have a test case for this null case in iter_coords. That way we can prevent regressions in the future. If you have the time for it, that would be very welcome. But I didn't want to hold up this PR for that, so I already merged it. Thanks again!

hansthen commented 10 months ago

I do not have a lot of time this week, but I will put it on my bucket list. If I remember correctly I also promised to add more tests to the leaflet-realtime plugin.