github.com/losinggeneration/geojson

Implementation of the GeoJSON spec for Go


Keywords
geojson, go, golang
Licenses
CC-BY-SA-4.0/MIT
Install
go get github.com/losinggeneration/geojson

Documentation

geojson

wercker status Coverage Status GoDoc MIT license

GeoJSON is a Go library that implements the GeoJSON 1.0 spec.

About

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.

Example

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"
  }
}

TODO

  • Tests for all each struct's to marshal & unmarshal to the spec