GeoJSON is a Go library that implements the GeoJSON 1.0 spec.
This library should make it straight forward to Marshal & Unmarshal GeoJSON objects in Go. For example, this library will try to keep the Type properly set for GeoJSON Objects as defined in the spec during JSON Marshalling. In other words, a user doesn't need to explicitly set the Typet field.
GeoJSON{
Feature: &Feature{
ID: "MyFeature",
Geometry: &Geometry{
Point: &Point{
Coordinates: Positions{10, 10},
},
},
Properties: Properties{
"prop1": "A property",
"prop2": "A very palpable property",
},
},
}
would marshal into the following JSON:
{
"type": "Feature",
"id": "MyFeature",
"geometry": {
"type": "Point",
"coordinates": [10, 10]
},
"properties": {
"prop1": "A property",
"prop2": "A very palpable property"
}
}
- Tests for all each struct's to marshal & unmarshal to the spec