gogeos

Go library for spatial data operations and geometric algorithms (Go bindings for GEOS)

  • 所有者: paulsmith/gogeos
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

gogeos - Go library for spatial data operations and geometric algorithms

Build Status

gogeos is a library for Go that provides operations on spatial data and
geometric algorithms.

It provides bindings to the GEOS C library.

Quick start

package main

import (
	"fmt"

	"github.com/paulsmith/gogeos/geos"
)

func main() {
	line, _ := geos.FromWKT("LINESTRING (0 0, 10 10, 20 20)")
	buf, _ := line.Buffer(2.5)
	fmt.Println(buf)
	// Output: POLYGON ((18.2322330470336311 21.7677669529663689, 18.61…
}

Overview

Functionality

  • Binary predicates - intersects, disjoint, etc.
  • Topology operations - difference, union, etc.
  • Polygonization, line merging, and simplification
  • Prepared geometries (for better performance for common binary predicates)
  • Validity checking
  • DE-9IM
  • Geometry info - area, length, distance, etc.
  • IO - WKT & WKB read/write

gogeos is an open source project.

Community

Installation

Requirements

  • GEOS 3.3.8 or 3.3.9

GEOS must be installed on your system to build gogeos.

Ubuntu

$ apt-get install libgeos-dev

OS X - homebrew

$ brew install geos

From source (all OSes)

$ wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2
$ tar xvfj geos-3.3.8.tar.bz2
$ cd geos-3.3.8
$ ./configure
$ make
$ sudo make install

Installing gogeos

$ go get github.com/paulsmith/gogeos/geos

Documentation

Example

Let’s say you have two polygons, A (blue) and B (orange).

One of the most common things to do with a spatial data library like gogeos is
compute the intersection of two or more geometries. Intersection is just
a method on geometry objects in gogeos, which takes one argument, the other
geometry, and computes the intersection with the receiver. The result is a new
geometry, C (magenta):

C := geos.Must(A.Intersection(B))

geos.Must is just a convenience function that takes the output of any gogeos
function or method that returns a geometry and an error. It panics if the
error is non-null, otherwise returning the geometry, making it more convenient
to use in single-value contexts. In production code, though, you’ll want to
check the error value.

(NB: these graphics weren't produced by gogeos directly - I used the
excellent draw2d package to render
the output of gogeos functions.)

License

MIT. See COPYING.

Copyright (c) 2013 Paul Smith

主要指標

概覽
名稱與所有者paulsmith/gogeos
主編程語言Go
編程語言Go (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2013-06-06 03:44:58
推送於2023-09-03 10:53:56
最后一次提交2014-05-29 13:55:45
發布數3
最新版本名稱v0.1.2 (發布於 2014-05-29 14:02:50)
第一版名稱v0.1.0 (發布於 2013-06-12 11:57:12)
用户参与
星數282
關注者數7
派生數77
提交數81
已啟用問題?
問題數21
打開的問題數13
拉請求數1
打開的拉請求數10
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?