An open API service indexing awesome lists of open source software.

https://github.com/losinggeneration/geojson

Implementation of the GeoJSON spec for Go
https://github.com/losinggeneration/geojson

geojson go golang

Last synced: 12 months ago
JSON representation

Implementation of the GeoJSON spec for Go

Awesome Lists containing this project

README

          

geojson
=======

[![wercker status](https://app.wercker.com/status/f88b804269b197c17ad2ed5894e0c715/s "wercker status")](https://app.wercker.com/project/bykey/f88b804269b197c17ad2ed5894e0c715)
[![Coverage Status](https://coveralls.io/repos/github/losinggeneration/geojson/badge.svg?branch=master)](https://coveralls.io/github/losinggeneration/geojson?branch=master)
[![GoDoc](https://godoc.org/github.com/losinggeneration/geojson?status.png)](https://godoc.org/github.com/losinggeneration/geojson)
[![MIT license](https://img.shields.io/badge/license-MIT-orange.svg?style=flat)](https://github.com/losinggeneration/geojson/blob/master/COPYING)

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