• This repository has been archived on 19/Sep/2023
  • Stars
    star
    275
  • Rank 144,285 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

angular-slugify

Provides "slugification" for AngularJS
JavaScript
198
star
2

getting-started-llvm-c-api

Getting started with the LLVM C API
C
114
star
3

tweetarchive

Full-text search for your Twitter archive
JavaScript
86
star
4

geonode

[ABANDONED] Geography for node.js, see README
C++
71
star
5

templatemaker

templatemaker is a Python library that can extract data from files with a similar format, like HTML pages.
Python
62
star
6

tablestruct

tablestruct creates mappings between Go structs and database tables.
Go
59
star
7

quickserver

Starts a simple file-serving HTTP server in a directory and opens the default web browser to the root URL
Shell
20
star
8

geodjango

GeoDjango provides geospatial extensions to the Django web dev framework
Python
20
star
9

fli-hole

A pi-hole deployed into Fly.io and transported with Tailscale
Shell
18
star
10

newrelic-go-agent

(Unofficial) New Relic agent for the Go language, wraps the Agent SDK
Go
17
star
11

cMarkdown

Markdown for Python, accelerated by C.
C
16
star
12

texteditor-zig

make your own text editor (in Zig)
Zig
15
star
13

hwcounter

Highly accurate counter for measuring elapsed time in Python
C
12
star
14

chicago_wards_and_precincts

Chicago wards and precincts (effective 2015)
Go
4
star
15

viterbi

Find most likely sequence of hidden states (Viterbi path) in a hidden Markov model
Go
4
star
16

reloader.sh

automatically trigger a reload of a process when a file change is detected
Shell
4
star
17

yourreps

YourReps.org
Python
4
star
18

htmx-go-example

Example web application using htmx with Go
Go
2
star
19

letsgetlouder

Django community website for pledging not to attend conferences unless they have a code of conduct policy
JavaScript
2
star
20

aws-ssh

Simple app to generate SSH host configs for instances in VPCs behind bastion hosts
Go
2
star
21

civicfootprint

Find out who represents you
2
star
22

CureAudiod

OS X menu bar app for restarting coreaudiod and VDCAssistant
Swift
2
star
23

pushup-template-fragments-demo

demo of template fragments (aka inline partials) in Pushup app
CSS
1
star
24

baudot

Baudot/ITA2 decoder/encoder
C
1
star
25

8080-emulator

Software version of the Intel 8080 CPU.
C
1
star
26

backbone-d3-examples

Using Backbone.js and D3.js together
JavaScript
1
star
27

hershey

Generate the Hershey vector font set
Go
1
star
28

gnucobol

Mirror of the SVN repository of GnuCOBOL project.
C
1
star
29

boundvariable

My solution to universal machine part of the 2006 ICFP Programming Contest
C
1
star
30

enums

Generate methods for Go enum-likes
Go
1
star
31

oriole

OpenBSD firewall/router home LAN configuration
Makefile
1
star
32

kaleidoscope

C port of the LLVM tutorial
1
star