• This repository has been archived on 19/Sep/2023
  • Stars
    star
    280
  • Rank 147,492 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 1 year 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
197
star
2

getting-started-llvm-c-api

Getting started with the LLVM C API
C
112
star
3

tweetarchive

Full-text search for your Twitter archive
JavaScript
85
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
63
star
6

tablestruct

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

texteditor-zig

make your own text editor (in Zig)
Zig
22
star
8

quickserver

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

geodjango

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

fli-hole

A pi-hole deployed into Fly.io and transported with Tailscale
Shell
20
star
11

newrelic-go-agent

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

cMarkdown

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

hwcounter

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

CureAudiod

OS X menu bar app for restarting coreaudiod and VDCAssistant
Swift
6
star
15

chicago_wards_and_precincts

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

viterbi

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

reloader.sh

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

yourreps

YourReps.org
Python
4
star
19

sqlite-schema-viz

Generate graph visualization of a SQLite database schema
Go
3
star
20

writing-an-interpreter-in-go-in-zig

"Writing an Interpreter in Go" in Zig
Zig
2
star
21

htmx-go-example

Example web application using htmx with Go
Go
2
star
22

aws-ssh

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

civicfootprint

Find out who represents you
2
star
24

nixos-config

NixOS (and nix-darwin) configuration, including home-manager
Lua
2
star
25

letsgetlouder

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

ztl

Templating language for Zig, modeled after Django's templates
Zig
1
star
27

pushup-template-fragments-demo

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

8080-emulator

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

backbone-d3-examples

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

baudot

Baudot/ITA2 decoder/encoder
C
1
star
31

hershey

Generate the Hershey vector font set
Go
1
star
32

gnucobol

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

boundvariable

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

enums

Generate methods for Go enum-likes
Go
1
star
35

oriole

OpenBSD firewall/router home LAN configuration
Makefile
1
star
36

kaleidoscope

C port of the LLVM tutorial
1
star
37

pbimg

pbpaste for image data on macOS
Swift
1
star