SlideShare a Scribd company logo
GeoScript
Ilya Rosenfeld | OpenGeo | Spring 2013
The Big Idea


      A library for processing of spatial data

Several implementations for scripting environments

Currently in Python, Groovy, JavaScript, Scala, Ruby

             GeoTools under the hood
Why GeoScript
        Easy to learn

        Simple to use

  Familiar spatial metaphors

Choice of a scripting language

      Versatile products

Evolving, free and open source
"Succinctness is Power."
                   - Paul Graham
            Author or "Hackers and Painters"
Spatial Metaphors and API

 Geometry               Style
  Feature               Map
 Workspace           Projection
   Filter             Function
   Layer              Process


    http://www. geoscript.org
Load, style and display data ...
# import libraries
from geoscript.layer import Shapefile
from geoscript.render import draw
from geoscript.style import *

# load data
solar = Shapefile("solar_dni_polygons_fla.shp")

# style and display it
solar.style = Stroke("blue")
draw(solar)
... output
Examine data ...
# show structure of the data
solar.schema

# print out a single attribute for each record
for f in states.features():
    print f["STATE"]


# aggregate all values of "DEC" attribute
list = [f.get("DEC") for f in solar.features()]
reduce(lambda a,b: a+b, list)
... output
shapefile's schema:
solar_dni_polygons_fla [the_geom: MultiPolygon, ID: long,
GRIDCODE: float, ANN_DNI: float, JAN: float, FEB: float, MAR:
float, APR: float, MAY: float, JUN: float, JUL: float, AUG: float,
SEP: float, OCT: float, NOV: float, DEC: float]

"DEC" attribute values:
[4.268077957, 4.268077957, 4.268077957, 4.268077957...

aggregate value of "DEC":
6791.922061828683
Build a Histogram ...
# import
from geoscript.plot import bar

# populate data for X axis
x = [1,2,3,4,5,6,7,8,9,10]

# populate data for Y axis
y = [i * i for i in x]

# draw histogram
bar.xy(zip(x,y)).show()
... output
GeoScript Processes
AddCoverages, AreaGrid, Contour, CropCoverage, MultiplyCoverages,
PolygonExtraction, RangeLookup, RasterAsPointCollection, RasterZonalStatistics,
ScaleCoverage, StyleCoverage, length, isEmpty, contains, disjoint, intersects,
isClosed, isValid, buffer, getY, getX, union, intersection, difference, distance,
envelope, dimension, overlaps, reproject, simplify, isSimple, equalsExact,
getGeometryN, isWithinDistance, touches, crosses, within, relate, convexHull,
symDifference, centroid, interiorPoint, numPoints, area, isRing, exteriorRing,
numInteriorRing, numGeometries, geometryType, boundary, relatePattern,
equalsExactTolerance, pointN, startPoint, endPoint, interiorRingN, densify,
polygonize, splitPolygon, Aggregate, BarnesSurface, Bounds,
BufferFeatureCollection, Centroid, Clip, CollectGeometries, Count, Feature, Grid,
Heatmap, InclusionFeatureCollection, IntersectionFeatureCollection, LRSGeocode,
LRSMeasure, LRSSegment, Nearest, PointBuffers, PointStacker, Query,
RectangularClip, Reproject, Simplify, Snap, Transform, UnionFeatureCollection,
Unique, VectorToRaster, VectorZonalStatistics, ...

+ WRITE YOUR OWN
Run a process ...
# import
from geoscript.process import Process

# bind to a process and examine its inputs
p = Process.lookup("vec:Centroid")
p.inputs

# execute process
centroids = p.run(features=solar).get("result")

# draw result
draw(centroids)
... output
>> Establishing Internet Connection ...
OGC WPS                                   input                            output

In a nutshell:

●   WPS: Web Processing Service
●   web service interface standard
●   standardizes metadata, inputs and outputs of a (spatial) process
●   defines how a client can execute the process
●   implementation: some processing algorithm

OGC WPS [HTTP] Operations:

●   GetCapabilities:      returns service metadata
●   DescribeProcess:      returns description of a process, its inputs and outputs
●   Execute:              returns output of a process
WPS How-to



Step 1: Hack GeoScript from command line.
Step 2: Wrap your code in a Process.
Step 3: Copy to GeoServer.


                            It lives, it runs!
WPS Example


    origin




 http://suite.opengeo.org/docs/processing/scripting/processcreate.html
Process Inputs and Outputs
vector
 inputs
   ● GML                           outputs
   ● WKT                            ● WKT
   ● HTTP reference                 ● GML
   ● subprocess                     ● Shapefile ZIP
   ● feature collection             ● ...
        ○ WFS collection
        ○ JSON
        ○ Shapefile ZIP
        ○ HTTP request
        ○ GeoServer VECTOR_LAYER
        ○ subprocess

                                   outputs
raster                              ● TIFF
 inputs                             ● ArcGrid
   ● TIFF                           ● ...
   ● ArcGrid
   ● HTTP reference
   ● GeoServer RASTER_LAYER
   ● subprocess
Pushing Ahead
GeoScript                                Rendering Transformations
 ● do processing from command line        ● add advanced visualizations
 ● prototype and tweak your process       ● author transformations using SLD
 ● use local and remote resources         ● transform datasets in GeoServer

Process Chaining
 ● script complex processes
 ● wrap and deploy as a single service
Pushing Ahead
Web Mapping App Development             Integration
 ● use OpenGeo Suite SDK                 ● invoke WPS from another system
 ● create a starter app automatically    ● embed interactive maps into other apps
 ● customize, test and deploy
blog.opengeo.org
keyword: "solar"

More Related Content

PDF
Using GeoServer with NASA WorldWind
PDF
Geo servershell
PDF
Introduction to Kubernetes
PDF
Docker @haufe lexware tech lunch
ODP
Debug JNI code with ndk-gdb and eclipse GUI
ODP
Gdeploy 2.0
PDF
Heketi Functionality into Glusterd2
PDF
Gluster as Native Storage for Containers - past, present and future
Using GeoServer with NASA WorldWind
Geo servershell
Introduction to Kubernetes
Docker @haufe lexware tech lunch
Debug JNI code with ndk-gdb and eclipse GUI
Gdeploy 2.0
Heketi Functionality into Glusterd2
Gluster as Native Storage for Containers - past, present and future

What's hot (20)

PDF
ScalaCache: simple caching in Scala
PDF
NIIF Grid Development portfolio
PDF
Google Kubernetes Engine (GKE) deep dive
ODP
BaseX user-group-talk XML Prague 2013
PDF
Scalability and Performance of CNS 3.6
ODP
Gluster containers!
PDF
Qemu gluster fs
PDF
Power tools in Java
PDF
Google Cloud platform: GKE with CI/CD using CircleCI and Flux
PDF
Geode - Day 3
PDF
Mashing the data
PDF
Google Kubernetes Engine Deep Dive Meetup
PDF
Load testing with gatling
PDF
Introducing Koki Short
PDF
Gluster Containerized Storage for Cloud Applications
PDF
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
ODP
Gluster volume snapshot
PDF
Hands On Gluster with Jeff Darcy
PDF
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
PDF
TechDay - April - Customizing VM Images
ScalaCache: simple caching in Scala
NIIF Grid Development portfolio
Google Kubernetes Engine (GKE) deep dive
BaseX user-group-talk XML Prague 2013
Scalability and Performance of CNS 3.6
Gluster containers!
Qemu gluster fs
Power tools in Java
Google Cloud platform: GKE with CI/CD using CircleCI and Flux
Geode - Day 3
Mashing the data
Google Kubernetes Engine Deep Dive Meetup
Load testing with gatling
Introducing Koki Short
Gluster Containerized Storage for Cloud Applications
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
Gluster volume snapshot
Hands On Gluster with Jeff Darcy
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
TechDay - April - Customizing VM Images
Ad

Viewers also liked (13)

PPTX
Crowd sourcing docket_ss
PPTX
Funding collaborative research_workshop_tech_congress_2013
PPTX
Πρόγραμμα επιμόρφωσης εκπαιδευτικών στην η-τάξη μέσω της η-τάξης
PDF
Agile estimation
PPT
Thesis defense presentation jve 2013.01.07
PPTX
Βαθμός αποδοχής της Υπηρεσίας VoIP από εκπαιδευτικούς και σχολικές μονάδες Πρ...
PPTX
Παρελθόν και μέλλον υπηρεσίας της Ηλεκτρονικής Σχολικής Τάξης του Πανελλήνιου...
PPTX
Indian Technology congress 2013
PPTX
Αξιολόγηση μαθησιακής αποτελεσματικότητας συστημάτων διαχείρισης μάθησης στην...
PDF
Ppt hmk buat web
PPT
Mba thesis defense presentation jve 2013.01.17
PPT
Final azshrm state 2013 conf
PPT
2013 AZSHRM State Conference
Crowd sourcing docket_ss
Funding collaborative research_workshop_tech_congress_2013
Πρόγραμμα επιμόρφωσης εκπαιδευτικών στην η-τάξη μέσω της η-τάξης
Agile estimation
Thesis defense presentation jve 2013.01.07
Βαθμός αποδοχής της Υπηρεσίας VoIP από εκπαιδευτικούς και σχολικές μονάδες Πρ...
Παρελθόν και μέλλον υπηρεσίας της Ηλεκτρονικής Σχολικής Τάξης του Πανελλήνιου...
Indian Technology congress 2013
Αξιολόγηση μαθησιακής αποτελεσματικότητας συστημάτων διαχείρισης μάθησης στην...
Ppt hmk buat web
Mba thesis defense presentation jve 2013.01.17
Final azshrm state 2013 conf
2013 AZSHRM State Conference
Ad

Similar to Geo script opengeo spring 2013 (20)

PDF
Pycon 2012 Taiwan
PDF
那些年 Python 攻佔了 GIS / The Year Python Takes Over GIS
PDF
Integrating PostGIS in Web Applications
PDF
Foss4g it-2011 (english)
PDF
State of GeoServer 2012
PPT
Advancing open source geospatial software for the do d ic edward pickle openg...
PDF
FOSS4G2011 Report
PDF
Using Geoscript Groovy
PDF
Arc gis desktop_and_geoprocessing
PDF
Reading and writing spatial data for the non-spatial programmer
PDF
From a niche to a global user community: Open Source GIS and OSGeo
PDF
Saving Money with Open Source GIS
PDF
Open geo data - technical issue
PDF
Using python to analyze spatial data
PPTX
Why geoserver
PDF
PyDX Presentation about Python, GeoData and Maps
PPTX
123_BASICSAND FUNDAMENTASL OF gisrs.pptx
PDF
Open Source GeoSpatial
PPT
Open Source Geospatial Foundation (OSGeo)
PDF
Free and Open Source GIS
Pycon 2012 Taiwan
那些年 Python 攻佔了 GIS / The Year Python Takes Over GIS
Integrating PostGIS in Web Applications
Foss4g it-2011 (english)
State of GeoServer 2012
Advancing open source geospatial software for the do d ic edward pickle openg...
FOSS4G2011 Report
Using Geoscript Groovy
Arc gis desktop_and_geoprocessing
Reading and writing spatial data for the non-spatial programmer
From a niche to a global user community: Open Source GIS and OSGeo
Saving Money with Open Source GIS
Open geo data - technical issue
Using python to analyze spatial data
Why geoserver
PyDX Presentation about Python, GeoData and Maps
123_BASICSAND FUNDAMENTASL OF gisrs.pptx
Open Source GeoSpatial
Open Source Geospatial Foundation (OSGeo)
Free and Open Source GIS

Geo script opengeo spring 2013

  • 1. GeoScript Ilya Rosenfeld | OpenGeo | Spring 2013
  • 2. The Big Idea A library for processing of spatial data Several implementations for scripting environments Currently in Python, Groovy, JavaScript, Scala, Ruby GeoTools under the hood
  • 3. Why GeoScript Easy to learn Simple to use Familiar spatial metaphors Choice of a scripting language Versatile products Evolving, free and open source
  • 4. "Succinctness is Power." - Paul Graham Author or "Hackers and Painters"
  • 5. Spatial Metaphors and API Geometry Style Feature Map Workspace Projection Filter Function Layer Process http://www. geoscript.org
  • 6. Load, style and display data ... # import libraries from geoscript.layer import Shapefile from geoscript.render import draw from geoscript.style import * # load data solar = Shapefile("solar_dni_polygons_fla.shp") # style and display it solar.style = Stroke("blue") draw(solar)
  • 8. Examine data ... # show structure of the data solar.schema # print out a single attribute for each record for f in states.features(): print f["STATE"] # aggregate all values of "DEC" attribute list = [f.get("DEC") for f in solar.features()] reduce(lambda a,b: a+b, list)
  • 9. ... output shapefile's schema: solar_dni_polygons_fla [the_geom: MultiPolygon, ID: long, GRIDCODE: float, ANN_DNI: float, JAN: float, FEB: float, MAR: float, APR: float, MAY: float, JUN: float, JUL: float, AUG: float, SEP: float, OCT: float, NOV: float, DEC: float] "DEC" attribute values: [4.268077957, 4.268077957, 4.268077957, 4.268077957... aggregate value of "DEC": 6791.922061828683
  • 10. Build a Histogram ... # import from geoscript.plot import bar # populate data for X axis x = [1,2,3,4,5,6,7,8,9,10] # populate data for Y axis y = [i * i for i in x] # draw histogram bar.xy(zip(x,y)).show()
  • 12. GeoScript Processes AddCoverages, AreaGrid, Contour, CropCoverage, MultiplyCoverages, PolygonExtraction, RangeLookup, RasterAsPointCollection, RasterZonalStatistics, ScaleCoverage, StyleCoverage, length, isEmpty, contains, disjoint, intersects, isClosed, isValid, buffer, getY, getX, union, intersection, difference, distance, envelope, dimension, overlaps, reproject, simplify, isSimple, equalsExact, getGeometryN, isWithinDistance, touches, crosses, within, relate, convexHull, symDifference, centroid, interiorPoint, numPoints, area, isRing, exteriorRing, numInteriorRing, numGeometries, geometryType, boundary, relatePattern, equalsExactTolerance, pointN, startPoint, endPoint, interiorRingN, densify, polygonize, splitPolygon, Aggregate, BarnesSurface, Bounds, BufferFeatureCollection, Centroid, Clip, CollectGeometries, Count, Feature, Grid, Heatmap, InclusionFeatureCollection, IntersectionFeatureCollection, LRSGeocode, LRSMeasure, LRSSegment, Nearest, PointBuffers, PointStacker, Query, RectangularClip, Reproject, Simplify, Snap, Transform, UnionFeatureCollection, Unique, VectorToRaster, VectorZonalStatistics, ... + WRITE YOUR OWN
  • 13. Run a process ... # import from geoscript.process import Process # bind to a process and examine its inputs p = Process.lookup("vec:Centroid") p.inputs # execute process centroids = p.run(features=solar).get("result") # draw result draw(centroids)
  • 15. >> Establishing Internet Connection ...
  • 16. OGC WPS input output In a nutshell: ● WPS: Web Processing Service ● web service interface standard ● standardizes metadata, inputs and outputs of a (spatial) process ● defines how a client can execute the process ● implementation: some processing algorithm OGC WPS [HTTP] Operations: ● GetCapabilities: returns service metadata ● DescribeProcess: returns description of a process, its inputs and outputs ● Execute: returns output of a process
  • 17. WPS How-to Step 1: Hack GeoScript from command line. Step 2: Wrap your code in a Process. Step 3: Copy to GeoServer. It lives, it runs!
  • 18. WPS Example origin http://suite.opengeo.org/docs/processing/scripting/processcreate.html
  • 19. Process Inputs and Outputs vector inputs ● GML outputs ● WKT ● WKT ● HTTP reference ● GML ● subprocess ● Shapefile ZIP ● feature collection ● ... ○ WFS collection ○ JSON ○ Shapefile ZIP ○ HTTP request ○ GeoServer VECTOR_LAYER ○ subprocess outputs raster ● TIFF inputs ● ArcGrid ● TIFF ● ... ● ArcGrid ● HTTP reference ● GeoServer RASTER_LAYER ● subprocess
  • 20. Pushing Ahead GeoScript Rendering Transformations ● do processing from command line ● add advanced visualizations ● prototype and tweak your process ● author transformations using SLD ● use local and remote resources ● transform datasets in GeoServer Process Chaining ● script complex processes ● wrap and deploy as a single service
  • 21. Pushing Ahead Web Mapping App Development Integration ● use OpenGeo Suite SDK ● invoke WPS from another system ● create a starter app automatically ● embed interactive maps into other apps ● customize, test and deploy