wkt

module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0

README

WKT parser

WKT parser is a library for parsing wkt geometry into simple structures, which is designed to be converted to representations of other types of geometry (for example S2).

Install

go get -u github.com/IvanZagoskin/wkt-parser

Example

package main

import (
	"bytes"
	"fmt"

	"github.com/IvanZagoskin/wkt"
	"github.com/IvanZagoskin/wkt/geometry"
)

func main() {
	parser := wkt.NewParser()
	g, _ := parser.ParseWKT(bytes.NewReader([]byte("POINT (30 20)")))
	switch geom := g.(type) {
	case *geometry.Point:
		fmt.Printf("%+v", geom)
	}
}

You can see more usage examples in tests.

Supported geometry

  • POINT
  • LINESTRING
  • POLYGON
  • MULTIPOINT
  • MULTILINESTRING
  • MULTIPOLYGON
  • CIRCULARSTRING

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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