Skip to content

mattmakesmaps/geometrycommands

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geometry command line library.

Geometry commands is a command line library for processing geometry that follows the unix philosophy. Each command does one thing well (buffer, centroid, envelope) by reading in a geometry, processing the geometry, and writing the geometry out as WKT. Individual commands can be connected with unix pipes. For more information please visit the web site.

Libraries

JTS:

http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html

Proj4j:

http://trac.osgeo.org/proj4j/

Args4J:

http://args4j.kohsuke.org/

Examples:

Geometry input with -g argument:

>>> geom buffer -g "POINT (10 10)" -d 2

Geometry input using standard input stream:

>>> echo "POINT (10 10)" | geom buffer -d 20

Piping results of one geometry command to another:

>>> geom buffer -g "POINT (10 10)" -d 2 | geom envelope

Determine if one geometry contains another:

>>> echo "POINT (0 0)" | geom buffer -d 10 | geom contains -o "POINT (5 5)"
true
>>> echo "POINT (0 0)" | geom buffer -d 10 | geom contains -o "POINT (25 25)"
false

Buffer a point, get coordinates, draw coordinates to image, and open the image:

>>> echo "POINT (10 10)" | geom buffer -d 5 | geom coordinates | geom draw && open image.png

List available geometry commands:

>>> geom list
list
buffer
centroid
contains
convexHull
draw
difference
envelope
intersection

Getting Help

Each command contains a --help option:

>>> geom buffer --help
geom buffer: Buffer a geometry by a distance.
--help                    : Print help message
-c (--endCapStyle) VAL    : The end cap style (round, flat/butt, square)
-d (--distance) N         : The buffer distance
-g (--geometry) VAL       : The input geometry
-q (--quadrantSegments) N : The number of quadrant segments
-s (--singleSided)        : The flag for whether the buffer should be single sided

There is a man page for each subcommand:

>>> man geom-buffer
geom-buffer(1)                                                  geom-buffer(1)

NAME
       geom buffer

DESCRIPTION
       Buffer a geometry by a distance.

USAGE
       geom buffer -g "POINT (1 1)" -d 10

Finally, there is a bash completion script which makes using geom with bash much easier.

Install it in your .bash_profile:

source /Users/you/geom/shell/geom_bash_comp

Build

Geometry Commands depends on the Java Topology Suite (JTS) and Proj4j and uses Maven as a build tool.

git checkout https://github.com/jericks/geometrycommands.git cd /geometrycommands mvn clean install

Presentations

geometry commands

License

Geometry Commands is open source and licensed under the MIT License.

image

About

Commandline application for manipulating geometry.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 92.4%
  • Roff 6.6%
  • Other 1.0%