-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Properties inside a FeatureCollection #1
Comments
Hi, according to the geojson spec (https://tools.ietf.org/html/rfc7946) section 7.1 says
I was surprised by this but it does make me against adding it. Plus the properties aren't very type safe so they're really not the way to go. The spec does talk about "foreign members" in section 6.1. Which you can be done by embedding the FeatureCollection like:
But that won't really help with every use case, e.g. you want "foreign members" on a feature. In which case you'd have to define your own Feature and FeatureCollection types. On the Pro side, all the complicated stuff is in Marshaling/Unmarshaling the geometries so you could reuse that. Defining your own types also makes interoperability difficult. turfjs works with geojson which is nice in "flexible" JSON but the Go type system makes that difficult due to the "issues" discussed above. For the There are many ways to make it so "various metadata can be saved inside while passing the 'model' around within the program" but the best way to do that really depends how you want to read/write/save the "model". |
Thank you for the wonderful answer, and it does move me forward. I will use the embedding struct like you suggest, and will solve most of my needs. |
Feature request for adding a
Properties
map inside theFeatureCollection
type so that various metadata can be saved inside while passing the "model" around within the program.https://godoc.org/github.com/paulmach/orb/geojson#FeatureCollection
I understand the GeoJSON standard considers it a "may" feature, but a richer/more expressive in-memory representative would be pretty handy. Also, the marshaller should also serialize it consistent with the
Feature
implementation, so JavaScript code (e.g in a Mapbox GL JS HTML page) can also access it easily.Thanks
Siddharth
The text was updated successfully, but these errors were encountered: