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

Fix GeoJSON.initialize when no data #77

Merged
merged 1 commit into from Apr 22, 2015

Conversation

jmvivo
Copy link
Contributor

@jmvivo jmvivo commented Nov 10, 2014

When you try to create a L.Proj.GeoJSON layer with no data (to add it
after layer creation):

    var layer = L.Proj.geoJson();
    layer.addData(geojson).addTo(map);

You get an exception:

    Uncaught TypeError: Cannot read property 'features' of undefined

When you try to create a L.Proj.GeoJSON layer with no data (to add it
after layer creation):

        var layer = L.Proj.geoJson();
        layer.addData(geojson).addTo(map);

You get an exception:

        Uncaught TypeError: Cannot read property 'features' of undefined
@edrex
Copy link

edrex commented Dec 2, 2014

I hit this problem right off, and this pull request fixes it.

It's pretty common to create a GeoJSON layer synchronously and then add the data later, so this bug is critical for GeoJSON support.

The code change looks fine.

👍

pthorin pushed a commit that referenced this pull request Apr 22, 2015
Fix GeoJSON.initialize when no data
@pthorin pthorin merged commit 42aa678 into kartena:master Apr 22, 2015
@pthorin
Copy link

pthorin commented Apr 22, 2015

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants