SlideShare a Scribd company logo
1 of 29
Download to read offline
Scripting GeoServer
Jared Erickson
CUGOS
December 2012
GEOSERVER
Open Source (GPL) WMS Server
Main language is Java
Also implements WFS, WCS, WPS, ect...
Uses GeoTools and JTS libraries
Scripting Module
Geoserver Community Module
Developed by: Justin Deoliveira and Tim
Schaub
I am adding Geoscript Groovy support
https://github.com/jericks/geoserver/tree/script_groovy
Python, JavaScript, Groovy, BeanShell, Ruby
Uses javax.scripting to execute scripts
Extend GeoServer on the fly
Scripting Hooks
Applications
Web Processing Services (WPS)
Geospatial web services
Rendering Transformations in SLD
Filter Functions
String, Date, Geometry Functions in SLD
Script Location
$DATA_DIR/scripts/
apps
function
wps
lib
Scripts dynamically reloaded
Python, JavaScript, and Groovy have
GeoScript API
Applications
Generic web applications or web services
Python - WSGI
JavaScript - JSGI
Groovy - Restlet
Hello World App
1 import org.restlet.data.*
2
3 def run(request, response) {
4 response.setEntity("Groovy rocks!", MediaType.TEXT_PLAIN)
5 }
$DATA_DIR/scripts/apps/hello/main.groovy
Color Brewer App
1 import org.restlet.data.*
2 import org.restlet.resource.OutputRepresentation
3 import javax.imageio.ImageIO
4 import geoscript.filter.Color
5 import groovy.xml.MarkupBuilder
6
7 def run(request, response) {
8 String name = request.getResourceRef().getQueryAsForm().getFirstValue("name")
9 if (name) {
10 def image = Color.drawToImage(Color.getPaletteColors(name))
11 def output = new OutputRepresentation(MediaType.IMAGE_PNG) {
12 void write(OutputStream out) throws IOException {
13 ImageIO.write(image,"png",out)
14 }
15 }
16 response.setEntity(output)
17 }
18 else {
19 def out = new StringWriter()
20 def html = new MarkupBuilder(out)
21 html.html {
22 head {
23 title: "Color Brewer Palettes"
24 }
25 body {
26 h1 "Color Brewer Palettes"
27 ul {
28 Color.paletteNames.each { nm ->
29 li {
30 a href: "colorbrewer?name=${nm}", "${nm}"
31 }
32 }
33 }
34 }
35 }
36 response.setEntity(out.toString(), MediaType.TEXT_HTML)
37 }
38 }
$DATA_DIR/scripts/apps/colorbrewer/main.groovy
Color Brewer App
Function List app
1 import org.restlet.data.*
2 import geoscript.filter.Function
3 import groovy.xml.MarkupBuilder
4
5 def run(request, response) {
6 def out = new StringWriter()
7 def html = new MarkupBuilder(out)
8 html.html {
9 head {
10 titie: "Filter Functions"
11 }
12 body {
13 h1 "Filter Function"
14 ul {
15 Function.functionNames.each { nm ->
16 li "${nm}"
17 }
18 }
19 }
20 }
21 response.setEntity(out.toString(), MediaType.TEXT_HTML)
22
23 }
$DATA_DIR/scripts/apps/functions/main.groovy
Function List app
Groovy Geoserver API
geoserver
Geoserver: Main entry point for Catalog and Config
Config: Metadata about GeoServer
geoserver.catalog
Catalog: Contains Workspaces, Layers, Stores
Workspace: Contains Stores
Store: Contains Layers, Converts to GeoScript Workspace
Layer: Converts to GeoScript Layer
layer as table app
1 import org.restlet.data.*
2 import geoserver.*
3 import groovy.xml.MarkupBuilder
4
5 def run(request, response) {
6
7 def layer = new GeoServer().catalog.getLayer("sf:archsites")
8 def gsLayer = layer.geoScriptLayer
9
10 def out = new StringWriter()
11 def html = new MarkupBuilder(out)
12 html.html {
13 head {
14 title: "Layer Table"
15 }
16 body {
17 h1 "${layer.name}"
18 table(border:1) {
19 tr {
20 gsLayer.schema.fields.each {fld ->
21 td "${fld.name}"
22 }
23 }
24 gsLayer.eachFeature { f ->
25 tr {
26 f.attributes.each { att ->
27 td "${att.value}"
28 }
29 }
30 }
31 }
32 }
33 }
34 response.setEntity(out.toString(), MediaType.TEXT_HTML)
35 }
$DATA_DIR/scripts/apps/table/main.groovy
Layer as table app
Filter Functions
Transform a value before displaying it
Format a date or a number
Capitalize a string
Manipulate a geometry
GeoTools input objects are wrapped as
GeoScript objects
GeoScript result objects are unwrapped as
GeoTools objects
Filter Function
1 /**
2 * Convert a Geometry into a buffered centroid
3 * @param value The Feature
4 * @param args A List of arguments
5 * args[0] is the Geometry
6 * args[1] is the buffer distance
7 */
8 def run(value, args) {
9 args[0].centroid.buffer(args[1] as double)
10 }
$DATA_DIR/scripts/function/bufferCentroid.groovy
Geometry filter function
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <StyledLayerDescriptor version="1.0.0"
3 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
4 xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
5 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6 <NamedLayer>
7 <Name>Buffered Centroid</Name>
8 <UserStyle>
9 <Title>Buffered Centroids Polygons</Title>
10 <Abstract>Draw buffered centroids of polygons</Abstract>
11 <FeatureTypeStyle>
12 <Rule>
13 <Name>Rule 1</Name>
14 <Title>Gray Polygon with Black Outline</Title>
15 <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract>
16 <PolygonSymbolizer>
17 <Geometry>
18 <ogc:Function name="bufferCentroid">
19 <ogc:PropertyName>the_geom</ogc:PropertyName>
20 <ogc:Literal>1</ogc:Literal>
21 </ogc:Function>
22 </Geometry>
23 <Fill>
24 <CssParameter name="fill">#AAAAAA</CssParameter>
25 </Fill>
26 <Stroke>
27 <CssParameter name="stroke">#000000</CssParameter>
28 <CssParameter name="stroke-width">1</CssParameter>
29 </Stroke>
30 </PolygonSymbolizer>
31 </Rule>
32 </FeatureTypeStyle>
33 </UserStyle>
34 </NamedLayer>
35 </StyledLayerDescriptor>
Geometry Filter Function
WPS
Web Processing Service
Model builder for the web
Generic web services for spatial data
GeoTools inputs are wrapped as GeoScript
objects
GeoScript results are unwrapped as GeoTools
objects
Geometry Buffer WPS
1 import geoscript.geom.Geometry
2
3 title = 'Buffer'
4 description = 'Buffers a geometry'
5
6 inputs = [
7 geom: [name: 'geom', title: 'The geometry to buffer', type: Geometry.class],
8 distance: [name: 'distance', title: 'The buffer distance', type: Double.class]
9 ]
10
11 outputs = [
12 result: [name: 'result', title: 'The buffered geometry', type: Geometry.class]
13 ]
14
15 def run(input) {
16 [result: input.geom.buffer(input.distance as double)]
17 }
18
$DATA_DIR/scripts/wps/buffer.groovy
WPS REQUEST BUILDER
Buffer geometry WPS
POLYGON ((11 1, 10.807852804032304 -0.9509032201612824, 10.238795325112868 -2.826834323650898, 9.314696123025453 -4.555702330196022, 8.071067811865476
-6.071067811865475, 6.555702330196023 -7.314696123025453, 4.826834323650898 -8.238795325112868, 2.9509032201612833 -8.807852804032304, 1.0000000000000007 -9,
-0.9509032201612819 -8.807852804032304, -2.826834323650897 -8.238795325112868, -4.55570233019602 -7.314696123025453, -6.071067811865475 -6.0710678118654755,
-7.314696123025453 -4.555702330196022, -8.238795325112868 -2.8268343236508944, -8.807852804032306 -0.9509032201612773, -9 1.0000000000000075,
-8.807852804032303 2.950903220161292, -8.238795325112862 4.826834323650909, -7.3146961230254455 6.555702330196034, -6.071067811865463 8.071067811865486,
-4.555702330196008 9.314696123025463, -2.826834323650879 10.238795325112875, -0.9509032201612606 10.807852804032308, 1.0000000000000249 11,
2.950903220161309 10.807852804032299, 4.826834323650925 10.238795325112857, 6.555702330196048 9.314696123025435, 8.071067811865499 8.07106781186545,
9.314696123025472 6.555702330195993, 10.238795325112882 4.826834323650862, 10.807852804032311 2.9509032201612437, 11 1))
http://localhost:8080/geoserver/wps?service=WPS
&version=1.0.0
&request=Execute
&identifier=groovy:buffer
&datainputs=geom=POINT%20(1%201)
@mimetype=application/wkt;distance=10
&RawDataOutput=result=@mimetype=application/wkt
Voronoi Layer WPS
1 import geoscript.geom.*
2 import geoscript.layer.*
3
4 title = 'VoronoiLayer'
5 description = 'Create a voronoi diagram around the features of a Layer'
6
7 inputs = [
8 layer: [name: 'layer', title: 'The Layer', type: Layer.class],
9 ]
10
11 outputs = [
12 result: [name: 'result', title: 'The voronoi diagram as a Layer', type: Layer.class]
13 ]
14
15 def run(input) {
16 def geoms = new GeometryCollection(input.layer.features*.geom.centroid)
17 def output = new Layer()
18 output.add([geoms.voronoiDiagram])
19 [result: output]
20 }
21
$DATA_DIR/scripts/wps/voronoi.groovy
WPS Request Builder
Rendering transformations
Modify an entire dataset
Buffer the entire layer not each feature
Create a heatmap from points (vector to raster)
http://docs.geoserver.org/latest/en/user/
styling/sld-extensions/rendering-
transform.html
Rendering Transform sld
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <StyledLayerDescriptor version="1.0.0"
3 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
4 xmlns="http://www.opengis.net/sld"
5 xmlns:ogc="http://www.opengis.net/ogc"
6 xmlns:xlink="http://www.w3.org/1999/xlink"
7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8 <!-- a Named Layer is the basic building block of an SLD document -->
9 <NamedLayer>
10 <Name>default_polygon</Name>
11 <UserStyle>
12 <!-- Styles can have names, titles and abstracts -->
13 <Title>Default Polygon</Title>
14 <Abstract>A sample style that draws a polygon</Abstract>
15 <!-- FeatureTypeStyles describe how to render different features -->
16 <!-- A FeatureTypeStyle for rendering polygons -->
17 <FeatureTypeStyle>
18 <Transformation>
19 <ogc:Function name="groovy:voronoi">
20 <ogc:Function name="parameter">
21 <ogc:Literal>layer</ogc:Literal>
22 </ogc:Function>
23 </ogc:Function>
24 </Transformation>
25 <Rule>
26 <Name>rule1</Name>
27 <Title>Gray Polygon with Black Outline</Title>
28 <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract>
29 <PolygonSymbolizer>
30 <Fill>
31 <CssParameter name="fill">#AAAAAA</CssParameter>
32 </Fill>
33 <Stroke>
34 <CssParameter name="stroke">#000000</CssParameter>
35 <CssParameter name="stroke-width">1</CssParameter>
36 </Stroke>
37 </PolygonSymbolizer>
38 </Rule>
39 </FeatureTypeStyle>
40 </UserStyle>
41 </NamedLayer>
42 </StyledLayerDescriptor>
43
Voronoi Diagram
Conclusion
GeoServer is well known as a WMS, WFS,
WCS, WPS server
GeoServer is also a platform for spatial web
services
Scripting just finally makes it easy
Thank you!

More Related Content

What's hot

JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJSFestUA
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applicationsrohitnayak
 
MongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkMongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkChris Westin
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerMarcus Lönnberg
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaKévin Margueritte
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript名辰 洪
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN GolangBo-Yi Wu
 
2013-08-08 | Mantle (Cocoaheads Vienna)
2013-08-08 | Mantle (Cocoaheads Vienna)2013-08-08 | Mantle (Cocoaheads Vienna)
2013-08-08 | Mantle (Cocoaheads Vienna)Dominik Gruber
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017名辰 洪
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGuillaume Laforge
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Andy Bunce
 
Realm: Building a mobile database
Realm: Building a mobile databaseRealm: Building a mobile database
Realm: Building a mobile databaseChristian Melchior
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! GrailsプラグインTsuyoshi Yamamoto
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...Amazon Web Services
 
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"Provectus
 

What's hot (20)

JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
 
MongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkMongoDB's New Aggregation framework
MongoDB's New Aggregation framework
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework Scala
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
2013-08-08 | Mantle (Cocoaheads Vienna)
2013-08-08 | Mantle (Cocoaheads Vienna)2013-08-08 | Mantle (Cocoaheads Vienna)
2013-08-08 | Mantle (Cocoaheads Vienna)
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017
 
Tp web
Tp webTp web
Tp web
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application
 
Realm: Building a mobile database
Realm: Building a mobile databaseRealm: Building a mobile database
Realm: Building a mobile database
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
 
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
 

Viewers also liked

Wms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerWms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerDonnyV
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptJustin Deoliveira
 
WMS Performance Shootout 2011
WMS Performance Shootout 2011WMS Performance Shootout 2011
WMS Performance Shootout 2011Jeff McKenna
 
How we built a job board in one week with JHipster
How we built a job board in one week with JHipsterHow we built a job board in one week with JHipster
How we built a job board in one week with JHipsterKile Niklawski
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Matt Raible
 

Viewers also liked (7)

Geo servershell
Geo servershellGeo servershell
Geo servershell
 
Wms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerWms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo Server
 
Map cubes
Map cubesMap cubes
Map cubes
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScript
 
WMS Performance Shootout 2011
WMS Performance Shootout 2011WMS Performance Shootout 2011
WMS Performance Shootout 2011
 
How we built a job board in one week with JHipster
How we built a job board in one week with JHipsterHow we built a job board in one week with JHipster
How we built a job board in one week with JHipster
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
 

Similar to Scripting GeoServer

Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication developmentGanesh Gembali
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Murat Yener
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Kuo-Chun Su
 
Geo script opengeo spring 2013
Geo script opengeo spring 2013Geo script opengeo spring 2013
Geo script opengeo spring 2013Ilya Rosenfeld
 
Porting legacy apps to Griffon
Porting legacy apps to GriffonPorting legacy apps to Griffon
Porting legacy apps to GriffonJames Williams
 
Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008xilinus
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Red Hat Developers
 
Web Performance Part 4 "Client-side performance"
Web Performance Part 4  "Client-side performance"Web Performance Part 4  "Client-side performance"
Web Performance Part 4 "Client-side performance"Binary Studio
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.jsYoann Gotthilf
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSPhilipp Burgmer
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Ngoc Dao
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetTom Croucher
 
PhoneGap_Javakuche0612
PhoneGap_Javakuche0612PhoneGap_Javakuche0612
PhoneGap_Javakuche0612Yuhei Miyazato
 

Similar to Scripting GeoServer (20)

netbeans
netbeansnetbeans
netbeans
 
netbeans
netbeansnetbeans
netbeans
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
5.node js
5.node js5.node js
5.node js
 
NodeJS
NodeJSNodeJS
NodeJS
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹
 
Geo script opengeo spring 2013
Geo script opengeo spring 2013Geo script opengeo spring 2013
Geo script opengeo spring 2013
 
Porting legacy apps to Griffon
Porting legacy apps to GriffonPorting legacy apps to Griffon
Porting legacy apps to Griffon
 
Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
Web Performance Part 4 "Client-side performance"
Web Performance Part 4  "Client-side performance"Web Performance Part 4  "Client-side performance"
Web Performance Part 4 "Client-side performance"
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
 
PhoneGap_Javakuche0612
PhoneGap_Javakuche0612PhoneGap_Javakuche0612
PhoneGap_Javakuche0612
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Scripting GeoServer

  • 2. GEOSERVER Open Source (GPL) WMS Server Main language is Java Also implements WFS, WCS, WPS, ect... Uses GeoTools and JTS libraries
  • 3. Scripting Module Geoserver Community Module Developed by: Justin Deoliveira and Tim Schaub I am adding Geoscript Groovy support https://github.com/jericks/geoserver/tree/script_groovy Python, JavaScript, Groovy, BeanShell, Ruby Uses javax.scripting to execute scripts Extend GeoServer on the fly
  • 4. Scripting Hooks Applications Web Processing Services (WPS) Geospatial web services Rendering Transformations in SLD Filter Functions String, Date, Geometry Functions in SLD
  • 5. Script Location $DATA_DIR/scripts/ apps function wps lib Scripts dynamically reloaded Python, JavaScript, and Groovy have GeoScript API
  • 6. Applications Generic web applications or web services Python - WSGI JavaScript - JSGI Groovy - Restlet
  • 7. Hello World App 1 import org.restlet.data.* 2 3 def run(request, response) { 4 response.setEntity("Groovy rocks!", MediaType.TEXT_PLAIN) 5 } $DATA_DIR/scripts/apps/hello/main.groovy
  • 8. Color Brewer App 1 import org.restlet.data.* 2 import org.restlet.resource.OutputRepresentation 3 import javax.imageio.ImageIO 4 import geoscript.filter.Color 5 import groovy.xml.MarkupBuilder 6 7 def run(request, response) { 8 String name = request.getResourceRef().getQueryAsForm().getFirstValue("name") 9 if (name) { 10 def image = Color.drawToImage(Color.getPaletteColors(name)) 11 def output = new OutputRepresentation(MediaType.IMAGE_PNG) { 12 void write(OutputStream out) throws IOException { 13 ImageIO.write(image,"png",out) 14 } 15 } 16 response.setEntity(output) 17 } 18 else { 19 def out = new StringWriter() 20 def html = new MarkupBuilder(out) 21 html.html { 22 head { 23 title: "Color Brewer Palettes" 24 } 25 body { 26 h1 "Color Brewer Palettes" 27 ul { 28 Color.paletteNames.each { nm -> 29 li { 30 a href: "colorbrewer?name=${nm}", "${nm}" 31 } 32 } 33 } 34 } 35 } 36 response.setEntity(out.toString(), MediaType.TEXT_HTML) 37 } 38 } $DATA_DIR/scripts/apps/colorbrewer/main.groovy
  • 10. Function List app 1 import org.restlet.data.* 2 import geoscript.filter.Function 3 import groovy.xml.MarkupBuilder 4 5 def run(request, response) { 6 def out = new StringWriter() 7 def html = new MarkupBuilder(out) 8 html.html { 9 head { 10 titie: "Filter Functions" 11 } 12 body { 13 h1 "Filter Function" 14 ul { 15 Function.functionNames.each { nm -> 16 li "${nm}" 17 } 18 } 19 } 20 } 21 response.setEntity(out.toString(), MediaType.TEXT_HTML) 22 23 } $DATA_DIR/scripts/apps/functions/main.groovy
  • 12. Groovy Geoserver API geoserver Geoserver: Main entry point for Catalog and Config Config: Metadata about GeoServer geoserver.catalog Catalog: Contains Workspaces, Layers, Stores Workspace: Contains Stores Store: Contains Layers, Converts to GeoScript Workspace Layer: Converts to GeoScript Layer
  • 13. layer as table app 1 import org.restlet.data.* 2 import geoserver.* 3 import groovy.xml.MarkupBuilder 4 5 def run(request, response) { 6 7 def layer = new GeoServer().catalog.getLayer("sf:archsites") 8 def gsLayer = layer.geoScriptLayer 9 10 def out = new StringWriter() 11 def html = new MarkupBuilder(out) 12 html.html { 13 head { 14 title: "Layer Table" 15 } 16 body { 17 h1 "${layer.name}" 18 table(border:1) { 19 tr { 20 gsLayer.schema.fields.each {fld -> 21 td "${fld.name}" 22 } 23 } 24 gsLayer.eachFeature { f -> 25 tr { 26 f.attributes.each { att -> 27 td "${att.value}" 28 } 29 } 30 } 31 } 32 } 33 } 34 response.setEntity(out.toString(), MediaType.TEXT_HTML) 35 } $DATA_DIR/scripts/apps/table/main.groovy
  • 15. Filter Functions Transform a value before displaying it Format a date or a number Capitalize a string Manipulate a geometry GeoTools input objects are wrapped as GeoScript objects GeoScript result objects are unwrapped as GeoTools objects
  • 16. Filter Function 1 /** 2 * Convert a Geometry into a buffered centroid 3 * @param value The Feature 4 * @param args A List of arguments 5 * args[0] is the Geometry 6 * args[1] is the buffer distance 7 */ 8 def run(value, args) { 9 args[0].centroid.buffer(args[1] as double) 10 } $DATA_DIR/scripts/function/bufferCentroid.groovy
  • 17. Geometry filter function 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <StyledLayerDescriptor version="1.0.0" 3 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 4 xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" 5 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 6 <NamedLayer> 7 <Name>Buffered Centroid</Name> 8 <UserStyle> 9 <Title>Buffered Centroids Polygons</Title> 10 <Abstract>Draw buffered centroids of polygons</Abstract> 11 <FeatureTypeStyle> 12 <Rule> 13 <Name>Rule 1</Name> 14 <Title>Gray Polygon with Black Outline</Title> 15 <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract> 16 <PolygonSymbolizer> 17 <Geometry> 18 <ogc:Function name="bufferCentroid"> 19 <ogc:PropertyName>the_geom</ogc:PropertyName> 20 <ogc:Literal>1</ogc:Literal> 21 </ogc:Function> 22 </Geometry> 23 <Fill> 24 <CssParameter name="fill">#AAAAAA</CssParameter> 25 </Fill> 26 <Stroke> 27 <CssParameter name="stroke">#000000</CssParameter> 28 <CssParameter name="stroke-width">1</CssParameter> 29 </Stroke> 30 </PolygonSymbolizer> 31 </Rule> 32 </FeatureTypeStyle> 33 </UserStyle> 34 </NamedLayer> 35 </StyledLayerDescriptor>
  • 19. WPS Web Processing Service Model builder for the web Generic web services for spatial data GeoTools inputs are wrapped as GeoScript objects GeoScript results are unwrapped as GeoTools objects
  • 20. Geometry Buffer WPS 1 import geoscript.geom.Geometry 2 3 title = 'Buffer' 4 description = 'Buffers a geometry' 5 6 inputs = [ 7 geom: [name: 'geom', title: 'The geometry to buffer', type: Geometry.class], 8 distance: [name: 'distance', title: 'The buffer distance', type: Double.class] 9 ] 10 11 outputs = [ 12 result: [name: 'result', title: 'The buffered geometry', type: Geometry.class] 13 ] 14 15 def run(input) { 16 [result: input.geom.buffer(input.distance as double)] 17 } 18 $DATA_DIR/scripts/wps/buffer.groovy
  • 22. Buffer geometry WPS POLYGON ((11 1, 10.807852804032304 -0.9509032201612824, 10.238795325112868 -2.826834323650898, 9.314696123025453 -4.555702330196022, 8.071067811865476 -6.071067811865475, 6.555702330196023 -7.314696123025453, 4.826834323650898 -8.238795325112868, 2.9509032201612833 -8.807852804032304, 1.0000000000000007 -9, -0.9509032201612819 -8.807852804032304, -2.826834323650897 -8.238795325112868, -4.55570233019602 -7.314696123025453, -6.071067811865475 -6.0710678118654755, -7.314696123025453 -4.555702330196022, -8.238795325112868 -2.8268343236508944, -8.807852804032306 -0.9509032201612773, -9 1.0000000000000075, -8.807852804032303 2.950903220161292, -8.238795325112862 4.826834323650909, -7.3146961230254455 6.555702330196034, -6.071067811865463 8.071067811865486, -4.555702330196008 9.314696123025463, -2.826834323650879 10.238795325112875, -0.9509032201612606 10.807852804032308, 1.0000000000000249 11, 2.950903220161309 10.807852804032299, 4.826834323650925 10.238795325112857, 6.555702330196048 9.314696123025435, 8.071067811865499 8.07106781186545, 9.314696123025472 6.555702330195993, 10.238795325112882 4.826834323650862, 10.807852804032311 2.9509032201612437, 11 1)) http://localhost:8080/geoserver/wps?service=WPS &version=1.0.0 &request=Execute &identifier=groovy:buffer &datainputs=geom=POINT%20(1%201) @mimetype=application/wkt;distance=10 &RawDataOutput=result=@mimetype=application/wkt
  • 23. Voronoi Layer WPS 1 import geoscript.geom.* 2 import geoscript.layer.* 3 4 title = 'VoronoiLayer' 5 description = 'Create a voronoi diagram around the features of a Layer' 6 7 inputs = [ 8 layer: [name: 'layer', title: 'The Layer', type: Layer.class], 9 ] 10 11 outputs = [ 12 result: [name: 'result', title: 'The voronoi diagram as a Layer', type: Layer.class] 13 ] 14 15 def run(input) { 16 def geoms = new GeometryCollection(input.layer.features*.geom.centroid) 17 def output = new Layer() 18 output.add([geoms.voronoiDiagram]) 19 [result: output] 20 } 21 $DATA_DIR/scripts/wps/voronoi.groovy
  • 25. Rendering transformations Modify an entire dataset Buffer the entire layer not each feature Create a heatmap from points (vector to raster) http://docs.geoserver.org/latest/en/user/ styling/sld-extensions/rendering- transform.html
  • 26. Rendering Transform sld 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <StyledLayerDescriptor version="1.0.0" 3 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 4 xmlns="http://www.opengis.net/sld" 5 xmlns:ogc="http://www.opengis.net/ogc" 6 xmlns:xlink="http://www.w3.org/1999/xlink" 7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 8 <!-- a Named Layer is the basic building block of an SLD document --> 9 <NamedLayer> 10 <Name>default_polygon</Name> 11 <UserStyle> 12 <!-- Styles can have names, titles and abstracts --> 13 <Title>Default Polygon</Title> 14 <Abstract>A sample style that draws a polygon</Abstract> 15 <!-- FeatureTypeStyles describe how to render different features --> 16 <!-- A FeatureTypeStyle for rendering polygons --> 17 <FeatureTypeStyle> 18 <Transformation> 19 <ogc:Function name="groovy:voronoi"> 20 <ogc:Function name="parameter"> 21 <ogc:Literal>layer</ogc:Literal> 22 </ogc:Function> 23 </ogc:Function> 24 </Transformation> 25 <Rule> 26 <Name>rule1</Name> 27 <Title>Gray Polygon with Black Outline</Title> 28 <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract> 29 <PolygonSymbolizer> 30 <Fill> 31 <CssParameter name="fill">#AAAAAA</CssParameter> 32 </Fill> 33 <Stroke> 34 <CssParameter name="stroke">#000000</CssParameter> 35 <CssParameter name="stroke-width">1</CssParameter> 36 </Stroke> 37 </PolygonSymbolizer> 38 </Rule> 39 </FeatureTypeStyle> 40 </UserStyle> 41 </NamedLayer> 42 </StyledLayerDescriptor> 43
  • 28. Conclusion GeoServer is well known as a WMS, WFS, WCS, WPS server GeoServer is also a platform for spatial web services Scripting just finally makes it easy