Coder Social home page Coder Social logo

rustyoz / geojson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kpawlik/geojson

0.0 1.0 0.0 98 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


INSTALATION

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() {
    var (
        f *gj.Feature
    )
    // feature
    p := gj.NewPoint(gj.Coordinate{12, 3.123})
    f = gj.NewFeature(p, nil, nil)
    if gjstr, err := gj.Marshal(f); err != nil {
        panic(err)
    } else {
        fmt.Println(gjstr)
    }
    // feature with propertises
    props := map[string]interface{}{"name": "location", "code": 107}
    f = gj.NewFeature(p, props, nil)
    if gjstr, err := gj.Marshal(f); err != nil {
        panic(err)
    } else {
        fmt.Println(gjstr)
    }
    // feature with propertises and id
    f = gj.NewFeature(p, props, 11101)
    if gjstr, err := gj.Marshal(f); err != nil {
        panic(err)
    } else {
        fmt.Println(gjstr)
    }
    ls := gj.NewLineString(gj.Coordinates{{1, 1}, {2.001, 3}, {4001, 1223}})
    f = gj.NewFeature(ls, nil, nil)
    if gjstr, err := gj.Marshal(f); err != nil {
        panic(err)
    } else {
        fmt.Println(gjstr)
    }

}

geojson's People

Contributors

kpawlik avatar rustyoz 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.