Skip to content
Go package to quick and easy create json data in geojson format.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Dec 1, 2017
benchmarks_test.go Repo initialization Sep 11, 2012
doc.go Repo initialization Sep 11, 2012
feature.go Expose method ParseGeometry Jul 26, 2017
feature_test.go
geojson.go comments, doc strings Jun 23, 2017
geojson_test.go Repo initialization Sep 11, 2012
geometry.go Comments Jul 26, 2017
geometry_test.go Repo initialization Sep 11, 2012
helper_test.go Repo initialization Sep 11, 2012
license.txt

README.md

#GEOJSON


Go package to easy and quick create datastructure which can be serialized to geojson format


INSTALLATION

$ go get github.com/kpawlik/geojson
$ go install github.com/kpawlik/geojson

USAGE EXAMPLE

package main

import (
    "fmt"
    gj "github.com/kpawlik/geojson"
)

func main() {
    fc := gj.NewFeatureCollection([]*gj.Feature {})

    // feature
    p := gj.NewPoint(gj.Coordinate{12, 3.123})
    f1 := gj.NewFeature(p, nil, nil)
    fc.AddFeatures(f1)

    // feature with propertises
    props := map[string]interface{}{"name": "location", "code": 107}
    f2 := gj.NewFeature(p, props, nil)
    fc.AddFeatures(f2)

    // feature with propertises and id
    f3 := gj.NewFeature(p, props, 11101)
    fc.AddFeatures(f3)

    ls := gj.NewLineString(gj.Coordinates{{1, 1}, {2.001, 3}, {4001, 1223}})
    f4 := gj.NewFeature(ls, nil, nil)
    fc.AddFeatures(f4)

    if gjstr, err := gj.Marshal(fc); err != nil {
        panic(err)
    } else {
        fmt.Println(gjstr)
    }
}
You can’t perform that action at this time.