Scripting GeoServer
Scripting GeoServer
Scripting GeoServer
GeoScript
Justin Deoliveira, OpenGeo
GeoScript
Spatial capabilities for scripting languages.
GeoTools
Library providing tools for geospatial data.
GeoServer
Application server for publishing, editing, and
processing spatial data.
JSR-223
Scripting Hooks
Scripting Hooks
WPS Process
HTTP Endpoint
Filter Function
Output Format *
Data Format *
* In progress
Demos
var ws = require("geoscript/workspace");
var pg = ws.PostGIS("geoscript");
for (var f in pg.get("states").features) {
print(f.get("STATE_NAME"));
}
Geometry
Geometry - I/O
Geometry - Visualization
js> var geom = require("geoscript/geom")
js> require("geoscript/viewer").bind()
js> var poly1 = geom.Point([0, 0]).buffer(1)
js> var poly2 = poly1.transform({dx: 0.5, dy: 0.5})
js> poly1.difference(poly2)
<Polygon [[[0.9095298326166407, -0.409529...>
Projection
Projection
>>> from geoscript import geom
>>> from geoscript.proj import Projection
>>> p = Projection('epsg:4326')
>>> p.transform((-111, 45.7), 'epsg:26912')
(500000.0, 5060716.313515949)
>>> g = geom.Point(0, 0).buffer(4)
>>> g = ...
>>> p.transform(g, 'epsg:26912')
>>> p.transform(g, 'epsg:3005')
WGS
84
UTM
Albers
Styling - Stroke
>>> from geoscript.style import Stroke
>>> Stroke('#000000', width=2)
>>> Stroke('black', width=2, dash=[5,5])
>>> Stroke((0,0,0),width=2).hatch('vertline')
Styling - Labels
>>> from geoscript.style import *
>>> font = 'bold 16px Arial'
>>> Shape() + Label('name',font)
.point(displace=(20,0))
>>> Stroke() + Label('name',font)
.linear(offset=10)
>>> Fill() + Label('name',font).halo('white',2)
Styling - Theming
Process
>>> from geoscript.layer import Shapefile
>>> from geoscript.process import Process
>>> cities = Shapefile('world_cities.shp')
>>> p = Process.lookup('vec:Heatmap')
>>> p.run(cities, weightAttr='population')
Process
>>> p = Process.lookup('ras:PolygonExtraction')
>>> p.run(hm, range=(0.25, 0.85))
Thanks!