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.

GeoJsonPopup doesn't work (v 0.11.0) - TypeError: e.target.getBounds is not a function

See original GitHub issue

Hey guys,

I try to use the GeoJsonPopup module to display names etc. When I run the code, no error is displayed in the shell, but when I open the html file and click on a marker, no popup show up and in the console there is following error:

Uncaught TypeError: e.target.getBounds is not a function
    at i.click (geojson_test.html:85)
    at i.fire (leaflet.js:5)
    at i._fireDOMEvent (leaflet.js:5)
    at i._handleDOMEvent (leaflet.js:5)
    at HTMLDivElement.s (leaflet.js:5)

here is a snippet of my code:

import folium
import pandas
import geopandas

tileset= "https://api.mapbox.com/styles/v1/f---/cj53iitnb0cxr2rp96gsee7dx/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZjJkYXoiLCJhIjoiY2o1M2hrczV0MDc1bDJ2bjBiYWdha2c0diJ9.uEHH_ty------"
m = folium.Map(location=[50.032,10.519], zoom_start=14, tiles=tileset, attr="Mapbox")

data = geopandas.read_file('stationen.json', driver='GeoJSON')

stationen = folium.GeoJson(
    data,
    name='Stationen',
    popup = folium.GeoJsonPopup(
        fields=['shortname', 'voltage_level'],
        aliases=['Name', 'Spannungsebene'],
    )
).add_to(m)

m.save("geojson_test.html")

Environment

  • Browser: chrome
  • html file
  • folium version 0.11.0

Thanks in advance 😉

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Conengmocommented, Jun 5, 2020

@jtbaker I made a small fix, do you maybe want to check it out? https://github.com/python-visualization/folium/pull/1349

0reactions
Conengmocommented, Jun 4, 2020

Thanks for looking into this Jason! Two other related things that may provide ideas:

I’d have to look a bit more at that GeoJsonMarker thing to comment on how useful it is to spend time on that. I can say that if possible I’d rather separate it from fixing this particular issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

leaflet layer.getbounds not a function - Stack Overflow
I'm trying to make it when I zoom in on eachFeature, it filters the table to those features. Below is my script that...
Read more >
Can Leaflet method .getBounds() be used on a layer to ...
getBounds ().contains() to do this won't work using the grid layer ... I am currently getting a leaflet-src.js:1873 Uncaught TypeError: ...
Read more >
weixin_39576133的博客_CSDN博客-领域博主
华为服务器上传文件后怎么通过链接查看,远程服务器文件上传后的操作,服务器换完主板后无盘进不了系统,更换主板后主板认不出硬盘无法进入系统的办法– ...
Read more >
Issues-python-visualization/folium - PythonTechWorld
GeoJsonPopup doesn't work (v 0.11.0) - TypeError: e.target.getBounds is not a function ... Hey guys, I try to use the GeoJsonPopup module to...
Read more >
[closed] map.getBounds() Not Working... - OSM Help
How to get map corner latlong in OSM. i have many tried to solve it but i did not solve it. i have...
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