GithubHelp home page GithubHelp logo

vonwenm / geoscript-groovy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geoscript/geoscript-groovy

0.0 2.0 0.0 6.09 MB

A Groovy implementation of GeoScript.

Home Page: http://geoscript.org/

License: MIT License

geoscript-groovy's Introduction

GeoScript Groovy

GeoScript Groovy is the Groovy implementation of GeoScript. GeoScript is a geospatial scripting API for the JVM that contains one API and four implementations (Python, JavaScript, Scala, and Groovy).

GeoScript is built on the shoulders of giants and essentially wraps the Java Topology Suite and the GeoTools libraries.

GeoScript provides several modules that includes geometry, projection, features, layers, workspaces, styling and rendering.

Build

Building GeoScript Groovy is quite easy. You will need to have git, Java, Maven, and Ant installed.

Use git to clone the repository:

git clone git://github.com/jericks/geoscript-groovy.git

Use maven to build, test, and package:

mvn clean install

The distribution can be found in target/geoscript-groovy-${version}-app/geoscript-groovy-${version}.

Use

To use GeoScript Groovy you need Java and Groovy installed and on your PATH. Next, download the latest stable release , the latest in development build, or build the code yourself. Then put the GeoScript Groovy bin directory on your PATH. You are now ready to use GeoScript Groovy!

GeoScript Groovy has three commands:

  1. geoscript-groovy (which can run Groovy files)
  2. geoscript-groovysh (which starts a REPL shell)
  3. geoscript-groovyConsole (which starts a graphical editor/mini IDE)

Buffering a Point:

import geoscript.geom.Point

def point = new Point(0,0)
def poly = point.buffer(10)
println(poly.wkt)

Project a Geomemtry:

import geoscript.geom.Point
import geoscript.proj.Projection

def p1 = new Point(-111.0, 45.7)
def p2 = Projection.transform(p, "EPSG:4326", "EPSG:26912")

Read a Shapefile:

import geoscript.layer.Shapefile
import geoscript.geom.Bounds

def shp = new Shapefile("states.shp")
int count = shp.count
Bounds bounds = shp.bounds
shp.features.each {f->
    println(f)
}

Drawing a Shapefile:

import geoscript.layer.Shapefile
import geoscript.style.Stroke
import static geoscript.render.Draw.draw

def shp = new Shapefile("states.shp")
shp.style = new Stroke("#999999", 0.1)
draw(shp)

Reading a Raster:

import geoscript.layer.GeoTIFF

def format = new GeoTIFF(new File("raster.tif"))
def raster = format.read()

println "Format = ${raster.format}"
println "Proj EPSG = ${raster.proj.id}"
println "Proj WKT = ${raster.proj.wkt}"
println "Bounds = ${raster.bounds.geometry.wkt}"
println "Size = ${raster.size}"
println "Block Size = ${raster.blockSize}"
println "Pixel Size = ${raster.pixelSize}"
println "Band:"
raster.bands.eachWithIndex{b,i ->
    println "   ${i}). ${b}"
}

See the web site or the examples directory for more examples.

You can also use GeoScript Groovy as a library. If you use Maven you will need to add OpenGeo's repository:

<repositories>
    <repository>
        <id>opengeo</id>
        <name>OpenGeo Maven Repository</name>
        <url>http://repo.opengeo.org</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

and then include the GeoScript Groovy dependency:

<dependency>
    <groupId>org.geoscript</groupId>
    <artifactId>geoscript-groovy</artifactId>
    <version>1.3</version>
</dependency>

Presentations

GeoScript: Spatial Capabilities for Scripting Languages

Using GeoScript Groovy

Rendering Maps in GeoScript

Scripting GeoServer

License

GeoScript Groovy is open source and licensed under the MIT license.

geoscript-groovy's People

Contributors

bananeweizen avatar dwins avatar jericks avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.