Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoJSON with points throws Uncaught TypeError: Cannot read property 'enabled' of undefined #37

Closed
xmojmr opened this issue Jun 3, 2016 · 3 comments

Comments

@xmojmr
Copy link
Contributor

xmojmr commented Jun 3, 2016

If GeoJSON layer contains points then pm logs console error Uncaught TypeError: Cannot read property 'enabled' of undefined when it sees the L.Marker type of layer.

To reproduce use this: http://plnkr.co/edit/ZjLXPgIWpcAq2k9xIKoJ?p=preview

Expected behavior: map.fitBounds(geoJsonLayer.getBounds()) gets called
Actual behavior: map.fitBounds(geoJsonLayer.getBounds()) is not called because call to geoJsonLayer.addData(json) throws an exception

xmojmr added a commit to xmojmr/leaflet.pm that referenced this issue Jun 3, 2016
@codeofsumit
Copy link
Contributor

argh just saw this. Will take care of it this weekend (and thanks for the PR)

@do13
Copy link

do13 commented Jun 27, 2016

Did you find time to look deeper into this?
I've seen similar issues in combination with leaflet-search plugin.

Stacktrace:
leaflet.pm.js:640 Uncaught TypeError: Cannot read property 'enabled' of undefined
enabled @ leaflet.pm.js:640
(anonymous function) @ leaflet.pm.js:611
fire @ Events.js:1
addLayer @ FeatureGroup.js:1
setLayer @ leaflet-search.src.js:175
onAdd @ leaflet-search.src.js:117
addTo @ Control.js:1
addTo @ leaflet-search.src.js:134
addControl @ Control.js:1
(anonymous function) @ (index):141
dispatch @ jquery-git.js:5093
elemData.handle @ jquery-git.js:4901

https://jsfiddle.net/fqaj20or/

@xmojmr fix solved the problem in my case

codeofsumit added a commit that referenced this issue Jul 23, 2016
@codeofsumit
Copy link
Contributor

codeofsumit commented Jul 23, 2016

merged your PR - sorry for the delay.
New release is here: https://github.com/codeofsumit/leaflet.pm/releases/tag/v0.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants