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

error for feature colletion #3

Closed
gagan-bansal opened this issue Oct 24, 2015 · 1 comment
Closed

error for feature colletion #3

gagan-bansal opened this issue Oct 24, 2015 · 1 comment

Comments

@gagan-bansal
Copy link

My test data:

var ext = require('geojson-extent'),
featColl ={"type":"FeatureCollection","features":[{"type":"Feature","properties":{"osm_id":243819778,"name":"Port Louis","type":"city","population":147688},"geometry":{"type":"Point","coordinates":[57.5045331,-20.1637281]}}]};
console.log(ext.bboxify(featColl));

and here is the output error:

/mypath/node_modules/geojson-extent/node_modules/geojson-coords/index.js:10
    normalized.features.forEach(function(feature) {
              ^
TypeError: Cannot read property 'features' of null
    at module.exports (/mypath/node_modules/geojson-extent/node_modules/geojson-coords/index.js:10:15)
    at getExtent (/mypath/node_modules/geojson-extent/index.js:25:18)
    at Object.<anonymous> (/mypath/node_modules/geojson-extent/index.js:16:26)
    at walker (/mypath/node_modules/geojson-extent/node_modules/traverse/index.js:190:22)
    at /mypath/node_modules/geojson-extent/node_modules/traverse/index.js:208:29
    at Array.forEach (native)
    at forEach (/mypath/node_modules/geojson-extent/node_modules/traverse/index.js:298:31)
    at walker (/mypath/node_modules/geojson-extent/node_modules/traverse/index.js:203:13)
    at /mypath/node_modules/geojson-extent/node_modules/traverse/index.js:208:29
    at Array.forEach (native)

Or am I doing something wrong?

@tmcw
Copy link
Contributor

tmcw commented Oct 30, 2015

This is a bug in geojson-extent; it's using the "type" property to guess what things are bbox'able, and since there's type in the properties object, it's trying to find its bbox. I'll need to do a less-lazy traversal of the object.

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

2 participants