geobuf

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2018 License: MIT Imports: 5 Imported by: 1

README

Go Geobuf

A compact Protobuf representation of GeoJSON. Based on Mapbox's geobuf.

Limitations

Due to the nature of Go being a statically typed language, custom properties are not currently supported.

Some properties may lose their types through encoding/decoding. For instance, int8s may become uints or just ints.

Encoding/Decoding

A basic example shows how this library will infer the proper precision for encoding/decoding

import (
    "github.com/cairnapp/go-geobuf"
    "github.com/cairnapp/go-geobuf/pkg/geometry"
    "github.com/cairnapp/go-geobuf/pkg/geojson"
)

point := geojson.NewGeometry(geometry.Point([]float64{
    124.123, 
    234.456
}))
data := geobuf.Encode(point)
decoded_point := geobuf.Decode(point)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(msg *proto.Data) interface{}

func Encode

func Encode(obj interface{}) *proto.Data

func EncodeWithOptions

func EncodeWithOptions(obj interface{}, opts ...encode.EncodingOption) (*proto.Data, error)

Types

This section is empty.

Directories

Path Synopsis
pkg
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL