-
Notifications
You must be signed in to change notification settings - Fork 943
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
Geometry null and bbox #853
Comments
Where did you read that? Also there's a newer GeoJSON specification RFC 7946 and the older deprecated GeoJSON specification. Both of them say nothing about New docs
Older docs
|
Ok, I did not see the deprecated notice, sorry, but it was there: http://geojson.org/geojson-spec.html#feature-objects
Then in the newer version:
And I use geojsonhint to do the validation, but it did not catch this: https://jsfiddle.net/d9zob2c5/1/ But maybe there is something obvious I've missed.. |
🤓 Heh... I guess it does seem valid... Learn something everyday :) I don't think any TurfJS modules test or support @morganherlocker @tmcw any thoughts on if we should be handling this?
|
My opinion would be to explicitly ignore this part of the spec, similarly to how we have ignored a couple other dark corners of the spec such as the elevation coordinate or (sometimes) GeometryCollections. I'm not set on this opinion, but the idea of a null geometry really seems to break most of the common assumptions about geographic data. |
@DenisCarriere we might just add a note about this to the README file in the "Data in Turf" section. |
I'm definitely of the GeoJSON spec completism camp, hence the turf/meta work: the fewer exceptions we make the better. I don't think the overhead of doing so is egregious, and we already have similar cases, like a FeatureCollection with 0 features should have the same output as a Feature with null geometry. |
I'm open to all suggestions, every argument so far has been completely valid. Ideally we should follow the GeoJSON spec as much as possible (within reason). How about we start with a "simple" change of I'll submit a PR sometime tomorrow related to this, we can continue this discussion on the PR. |
Good idea, whichever direction we go with, we should still include a note in that section. CC: @stebogit |
I actually ran into this just now with I'm in the camp that turf support valid GeoJSON with null geometries and it should never crash due to this. @DenisCarriere if you could link to your PR, we can discuss or I can try to also PR further null geometry support.
There are many use cases for a null geometry, most of the time I see it used when you simply don't know the location yet or the feature doesn't have a location. |
Fixed in #866 |
Hi,
Geometry null seems valid according to the geojson spec, but bbox does not like it. This error is thrown when the geometry is null with turf/bbox version 4.5.2;
TypeError: Cannot read property 'type' of null
Am I missing something ?
Thanks !
The text was updated successfully, but these errors were encountered: