geometry

package
v0.0.0-...-a88dc9e Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v geojson.Geometry, project Project) ([]uint32, error)

Marshal returns the encoded sequence of a GeoJSON geometry.

func Unmarshal

func Unmarshal(data []uint32, typ spec.Tile_GeomType, unproject Unproject, v interface{}) error

Unmarshal parses the encoded geometry sequence and stores the result in the value pointed to by v.

Types

type CommandID

type CommandID uint8

CommandID represents the command to be executed.

const (
	// MoveTo creates a new point in a point geometry,
	// or starts a new vertex in a linestring or polygon geometry.
	MoveTo CommandID = 1
	// LineTo extends the current line or ring in a linestring or polygon geometry.
	LineTo CommandID = 2
	// ClosePath closes the current rin in a polygon geometry.
	ClosePath CommandID = 7
)

func (CommandID) String

func (id CommandID) String() string

type CommandInteger

type CommandInteger uint32

CommandInteger consists of a command ID, and the number of times to execute that command.

func MakeCommandInteger

func MakeCommandInteger(id CommandID, count uint32) (CommandInteger, error)

MakeCommandInteger encodes a CommandInteger from a command ID and count.

func (CommandInteger) Count

func (i CommandInteger) Count() uint32

Count returns the encoded count.

func (CommandInteger) ID

func (i CommandInteger) ID() CommandID

ID returns the encoded command ID.

func (CommandInteger) Validate

func (i CommandInteger) Validate() error

Validate the encoded command integer.

type ParameterInteger

type ParameterInteger uint32

ParameterInteger are encoded integers that represent coordinates as arguments to MoveTo and LineTo commands.

func MakeParameterInteger

func MakeParameterInteger(value int32) (ParameterInteger, error)

MakeParameterInteger encodes a ParameterInteger from an integer.

func (ParameterInteger) Validate

func (i ParameterInteger) Validate() error

Validate the encoded parameter integer.

func (ParameterInteger) Value

func (i ParameterInteger) Value() int32

Value returns the encoded integer.

type Project

type Project func(s2.LatLng) r2.Point

Project a geographic coordinate to a projected CRS.

type RawShape

type RawShape []uint32

RawShape is a raw encoded geometry.

func (RawShape) MarshalJSON

func (s RawShape) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of s.

func (RawShape) Type

func (s RawShape) Type() geojson.GeometryType

Type returns the geometry type.

func (*RawShape) UnmarshalJSON

func (s *RawShape) UnmarshalJSON(data []byte) error

UnmarshalJSON sets s to the JSON decoding of of s.

func (RawShape) Validate

func (s RawShape) Validate() error

Validate the RawShape.

type Unproject

type Unproject func(r2.Point) s2.LatLng

Unproject a projected coordinate to a geographic CRS.

Jump to

Keyboard shortcuts

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