GithubHelp home page GithubHelp logo

mmcloughlin / geojson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kpawlik/geojson

0.0 1.0 0.0 22 KB

Go package to quick and easy create json data in geojson format.

Home Page: http://kpawlik.github.io/geojson

License: MIT License

Go 100.00%

geojson's Introduction

#GEOJSON


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


INSTALLATION

$ go get https://github.com/kpawlik/geojson
$ go install https://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)
    }
}

geojson's People

Contributors

dsoprea avatar heindl avatar kpawlik avatar mmcloughlin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.