SlideShare a Scribd company logo
Geospatial web services using little­known GDAL 
features and modern Perl middleware
Ari Jolma
FOSS4G 2016
Bonn, August 25, 2016
About me
● Academic, Engineer, Scientist
● Previously at Aalto University
– Water resources, geoinformatics, environmental informatics
● Now at Finnish Environment Institute
– Marine Spatial Planning
● Just another Perl hacker
● GDAL user and developer, maintain Perl interface Geo::GDAL)
● Github and CPAN: ajolma
● ari.jolma at gmail.com
Overview of the talk
● Geospatial web services
– Programs (on servers) accessed by other programs (on clients)
● Actually a stack of programs and code on the server
– Data discovery, data visualization, data access
– Standardized by The Open Geospatial Consortium
● Little-known GDAL features
– Redirection of /vsistdout/
– Utilities as functions (not so obscure but new)
● Modern Perl middleware
– Software based on PSGI
GDAL virtual file system (VSI)
● Many GDAL drivers read from and write to files
● GDAL has virtualized (added a layer of code) the file I/O
● Benefits of that are
– things can be done to the data before it is read/written
– sources and sinks that are not really files can be made looking like files for
the drivers
● Read/write to
– ZIP file
– HTTP server
– Memory buffer
– See Even's blog from May 18, 2012
Redirection of /vsistdout/
● /vsistdout/ is GDAL virtualized stdout (uses fwrite to write to
stdout)
● GDAL provides an API function to change fwrite and stdout
– void VSIStdoutSetRedirection(VSIWriteFunction fct, FILE* stream)
● I built for the GDAL Perl interface a mechanism, which exploits
this so that
– One can use a specific perl object as the data source (sink) name when
creating a dataset object
– The only requirement is that the perl object in question must belong to a
class, which has write and close methods
– A related bug (VSIFCloseL does not flush the file, #6149) was fixed for
1.11.4, 2.0.1, and 2.1
Sidenote
● Even: ”/vsistdout/ redirection was developed for
MapServer, for FCGI and streamable OGR
output”
– https://github.com/mapserver/mapserver/commit/2c
5aad92a1e441fea8b08e38c995f8c3f831473a
PSGI
●
Perl Web Server Gateway Interface Specification
– Tatsuhiko Miyagawa, 2009
●
Inspired by Python Web Server Gateway Interface specification, Ruby's Rack specification, and
JavaScript Gateway Interface specification
●
Covers plain old CGI and mod_perl but allows better solutions (frameworks)
– CGI.pm has been removed from the core Perl 5 distribution (from 5.22)
– mod_perl is an Apache specific solution and things like Nginx are gaining popularity
●
Defines Middleware as a program (server), which takes an application and
provides an environment for it to run
– Both the application and the server are written in Perl
– The application is a code reference (a subroutine)
– The server prepares the input for the application and post-processes its output
Typical(? my) setup
● Nginx web server
– Provides various root level locations for websites on a server
– A location may be Perl services
● Example: http://biwatech.com:800/Eurajoki
● Configured with proxy_pass
● Perl services are provided with Starman (high-performace
preforking PSGI web server)
– Starman workers read a configuration file
● Which is Perl code and mainly links URLs to methods from application
objects
● In the case of geospatial web services and my case, this is objects from
Geo::OGC::Service::* classes
Plack
● Perl Superglue for Web frameworks and Web Servers (PSGI toolkit)
● Plack is a set of tools for using the PSGI stack. It contains middleware
components, a reference server and utilities for Web application
frameworks. Plack is like Ruby's Rack or Python's Paste for WSGI.
● Plack::Builder
– For the Starman configuration file
● Plack::Component
– Superclass of application classes (Geo::OGC::Service)
● Plack::Request
– The request coming from the client
OGC Services (from hacker point of view)
● Many ways to access: GET, POST, REST
● Need to be configured, often quite extensively
● Similar requests and responses
● CORS
– Separate user interface and data provision
● Use of XML for message exchange
● Geo::OGC::Service class
Nginx
Geo::OGC::Service
object
service.psgi
Starman
Geo::OGC::Service::X
object
Plack::Builder
Plack::Component
uses
is-a
Call from Internet
Message exchange
● Geo::OGC::Service class overrides the call method of Plack::Component class
– And returns a reference to an anonymous subroutine
● Which calls the respond method of Geo::OGC::Service with two arguments: responder and environment
● Plack gives environment to the call method
● Plack gives responder to the anonymous subroutine
● environment contains the message from the client
● The service (us) uses the responder to send a message to the client
– Either in one call (status, mime type, content) or in a delayed fashion, when it gets an object with which
●
It (we) may use a write method
●
Plack will call a close method
●
So, to send content to the client we need an object, which has these two methods, and we
can have it because of the vsistdout redirection in GDAL
OK, nice, but what concrete have I done that
others can enjoy, fix, or extend?
●
The stuff in GDAL Perl interface & requested a fix to the bug in
GDAL VSI
● Geo::OGC::Service class
– + 4 classes for common things (CORS response and constructing XML
messages)
●
Geo::OGC::WFS class
– GetCapabilities, GetFeature, Transaction
– Mostly for the PostgreSQL driver
● Geo::OGC::WMTS class
– WMTS and TMS Tile service
– Tiles can be files or made on the fly
Why?
● Because it could be done and I had the time
● To demonstrate a, perhaps, better way to build these
services using existing tools and a modular approach
● To learn PSGI and Plack
– Most of the code was originally written for plain old CGI
● To test some extensions
– WFS: ”pseudo credentials”
– On-the-fly processing of raster tiles
WFS ”pseudo credentials”
● The requirement:
– ”The users of a web mapping page should be able to submit
geographical objects without first creating a user account.
However, they should be able to edit the objects later.”
– I.e., the ”account” should be created on-the-fly
● The solution:
– Specific attributes (username, password) are not included in
the published attribute list but they can be used in the filter
and are required for a transaction
On-the-fly production and
processing of raster tiles
● Geo::OGC::Service::WMTS has a make_tile method, which gets the request and the configuration
data of the requested resource
● The resource is opened as a GDAL dataset
● The extent of the tile is computed
● If the resource is configured with processing
– The tile extent is expanded with two pixels
– Translate is called on the dataset to clip the tile from the source into memory (/vsimem/)
– Processing is applied to the memory tile dataset (DEMProcessing)
– The dataset is replaced with the result
– The tile extent is shrunk with two pixels
– Note the use of GDAL utilities as functions in Perl
● Translate is called on the dataset with a writer object obtained from the responder
● Examples
– http://www.pyhajarvensuojelu.net/valuma-aluetyo/ (click on Karttatasojen valinta → Lisätasot → Maasto)
– http://arijolma.org/SmartSea/ (experimental, will change, suboptimal WMTS + no processing based on dataset)
Latest (experimental)
● Hook for a generic processor
– Keyword (parameter) 'processor' for the constructor of
Geo::OGC::Service object, which should be a
processor object
– Geo::OGC::Service object gives the processor object
to the service object, when it creates it
– The service object calls it when preparing the response
● for example Geo::OGC::WMTS calls it with GDAL Dataset
object and Tile object
– Simple example
Availability
● Github:
– https://github.com/ajolma?tab=repositories
– https://travis-ci.org/ajolma
● CPAN
– https://metacpan.org/author/AJOLMA
● Artistic Licence 2.0
– Standard for Perl modules
Danke schön!
ari.jolma at gmail.com

More Related Content

What's hot

Maintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queuesMaintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queues
Paolo Corti
 
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres OpenKoichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
PostgresOpen
 
Event Driven Microservices
Event Driven MicroservicesEvent Driven Microservices
Event Driven Microservices
Fabrizio Fortino
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
Chester Chen
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
Jessie Barnett
 
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo SeidelOSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
NETWAYS
 
XSKY - ceph luminous update
XSKY - ceph luminous updateXSKY - ceph luminous update
XSKY - ceph luminous update
inwin stack
 
Dedupe nmamit
Dedupe nmamitDedupe nmamit
Dedupe nmamit
Gluster.org
 
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data AnalyticsSupersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
mason_s
 
KDB+ Lite
KDB+ LiteKDB+ Lite
KDB+ Lite
Sayanosauras
 
Presto conferencetokyo2019
Presto conferencetokyo2019Presto conferencetokyo2019
Presto conferencetokyo2019
wyukawa
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)
Martin Toshev
 
Progress_190213
Progress_190213Progress_190213
Progress_190213
Hyo jeong Lee
 
Gluster for sysadmins
Gluster for sysadminsGluster for sysadmins
Gluster for sysadmins
Gluster.org
 
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized StoreGlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
Atin Mukherjee
 
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander KukushkinPGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
Equnix Business Solutions
 
2019.06.27 Intro to Ceph
2019.06.27 Intro to Ceph2019.06.27 Intro to Ceph
2019.06.27 Intro to Ceph
Ceph Community
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
Selena Deckelmann
 
YDAL Barcelona
YDAL BarcelonaYDAL Barcelona
YDAL Barcelona
Gluster.org
 
Ceph Research at UCSC
Ceph Research at UCSCCeph Research at UCSC
Ceph Research at UCSC
Ceph Community
 

What's hot (20)

Maintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queuesMaintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queues
 
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres OpenKoichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
 
Event Driven Microservices
Event Driven MicroservicesEvent Driven Microservices
Event Driven Microservices
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
 
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo SeidelOSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
 
XSKY - ceph luminous update
XSKY - ceph luminous updateXSKY - ceph luminous update
XSKY - ceph luminous update
 
Dedupe nmamit
Dedupe nmamitDedupe nmamit
Dedupe nmamit
 
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data AnalyticsSupersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
 
KDB+ Lite
KDB+ LiteKDB+ Lite
KDB+ Lite
 
Presto conferencetokyo2019
Presto conferencetokyo2019Presto conferencetokyo2019
Presto conferencetokyo2019
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)
 
Progress_190213
Progress_190213Progress_190213
Progress_190213
 
Gluster for sysadmins
Gluster for sysadminsGluster for sysadmins
Gluster for sysadmins
 
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized StoreGlusterD 2.0 - Managing Distributed File System Using a Centralized Store
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
 
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander KukushkinPGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
PGConf.ASIA 2019 Bali - Patroni in 2019 - Alexander Kukushkin
 
2019.06.27 Intro to Ceph
2019.06.27 Intro to Ceph2019.06.27 Intro to Ceph
2019.06.27 Intro to Ceph
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
 
YDAL Barcelona
YDAL BarcelonaYDAL Barcelona
YDAL Barcelona
 
Ceph Research at UCSC
Ceph Research at UCSCCeph Research at UCSC
Ceph Research at UCSC
 

Viewers also liked

New York GeoConn 2015 Presentation
New York GeoConn 2015 PresentationNew York GeoConn 2015 Presentation
New York GeoConn 2015 Presentation
Matthew Wilson
 
Introduction to GDAL
Introduction to GDALIntroduction to GDAL
Introduction to GDALayman diab
 
Using GDAL In Your GIS Workflow
Using GDAL In Your GIS WorkflowUsing GDAL In Your GIS Workflow
Using GDAL In Your GIS Workflow
Gerry James
 
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
The HDF-EOS Tools and Information Center
 
Rails Gis Hacks
Rails Gis HacksRails Gis Hacks
Rails Gis Hacks
Shoaib Burq
 
CLI Geoprocessing GDAL/OGR
CLI Geoprocessing GDAL/OGRCLI Geoprocessing GDAL/OGR
CLI Geoprocessing GDAL/OGR
darkoboto
 
Info gdal 20150915
Info gdal 20150915Info gdal 20150915
Info gdal 20150915
GeoMedeelel
 

Viewers also liked (7)

New York GeoConn 2015 Presentation
New York GeoConn 2015 PresentationNew York GeoConn 2015 Presentation
New York GeoConn 2015 Presentation
 
Introduction to GDAL
Introduction to GDALIntroduction to GDAL
Introduction to GDAL
 
Using GDAL In Your GIS Workflow
Using GDAL In Your GIS WorkflowUsing GDAL In Your GIS Workflow
Using GDAL In Your GIS Workflow
 
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
Geospatial Data Abstraction Library (GDAL) Enhancement for ESDIS (GEE)
 
Rails Gis Hacks
Rails Gis HacksRails Gis Hacks
Rails Gis Hacks
 
CLI Geoprocessing GDAL/OGR
CLI Geoprocessing GDAL/OGRCLI Geoprocessing GDAL/OGR
CLI Geoprocessing GDAL/OGR
 
Info gdal 20150915
Info gdal 20150915Info gdal 20150915
Info gdal 20150915
 

Similar to Geospatial web services using little-known GDAL features and modern Perl middleware

Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
daoswald
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
Samuel Chow
 
Grails 101
Grails 101Grails 101
Grails 101
David Jacobs
 
OGCE Overview for SciDAC 2009
OGCE Overview for SciDAC 2009OGCE Overview for SciDAC 2009
OGCE Overview for SciDAC 2009
marpierc
 
OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)
David Bosschaert
 
Time to rethink /proc
Time to rethink /procTime to rethink /proc
Time to rethink /proc
Kir Kolyshkin
 
NIIF Grid Development portfolio
NIIF Grid Development portfolioNIIF Grid Development portfolio
NIIF Grid Development portfolio
Ferenc Szalai
 
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
Kaxil Naik
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Gabriele Bartolini
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
OpenVZ
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
Kirill Kolyshkin
 
OSGi Cloud Ecosystems
OSGi Cloud EcosystemsOSGi Cloud Ecosystems
OSGi Cloud Ecosystems
David Bosschaert
 
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
chiportal
 
FutureGrid Computing Testbed as a Service
 FutureGrid Computing Testbed as a Service FutureGrid Computing Testbed as a Service
FutureGrid Computing Testbed as a Service
Geoffrey Fox
 
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
A Container-based Sizing Framework for Apache Hadoop/Spark ClustersA Container-based Sizing Framework for Apache Hadoop/Spark Clusters
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
DataWorks Summit/Hadoop Summit
 
NetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and VerticaNetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and Vertica
Josef Niedermeier
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
Ramesh Nair
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
Andy Bunce
 
OGCE Project Overview
OGCE Project OverviewOGCE Project Overview
OGCE Project Overview
marpierc
 

Similar to Geospatial web services using little-known GDAL features and modern Perl middleware (20)

Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
 
Grails 101
Grails 101Grails 101
Grails 101
 
OGCE Overview for SciDAC 2009
OGCE Overview for SciDAC 2009OGCE Overview for SciDAC 2009
OGCE Overview for SciDAC 2009
 
OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)
 
Time to rethink /proc
Time to rethink /procTime to rethink /proc
Time to rethink /proc
 
NIIF Grid Development portfolio
NIIF Grid Development portfolioNIIF Grid Development portfolio
NIIF Grid Development portfolio
 
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
 
OSGi Cloud Ecosystems
OSGi Cloud EcosystemsOSGi Cloud Ecosystems
OSGi Cloud Ecosystems
 
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
TRACK F: OpenCL for ALTERA FPGAs, Accelerating performance and design product...
 
FutureGrid Computing Testbed as a Service
 FutureGrid Computing Testbed as a Service FutureGrid Computing Testbed as a Service
FutureGrid Computing Testbed as a Service
 
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
A Container-based Sizing Framework for Apache Hadoop/Spark ClustersA Container-based Sizing Framework for Apache Hadoop/Spark Clusters
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
 
NetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and VerticaNetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and Vertica
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
OGCE Project Overview
OGCE Project OverviewOGCE Project Overview
OGCE Project Overview
 

Recently uploaded

Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Seminar on Distillation study-mafia.pptx
Seminar on Distillation study-mafia.pptxSeminar on Distillation study-mafia.pptx
Seminar on Distillation study-mafia.pptx
Madan Karki
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
IJECEIAES
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 

Recently uploaded (20)

Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Seminar on Distillation study-mafia.pptx
Seminar on Distillation study-mafia.pptxSeminar on Distillation study-mafia.pptx
Seminar on Distillation study-mafia.pptx
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 

Geospatial web services using little-known GDAL features and modern Perl middleware

  • 2. About me ● Academic, Engineer, Scientist ● Previously at Aalto University – Water resources, geoinformatics, environmental informatics ● Now at Finnish Environment Institute – Marine Spatial Planning ● Just another Perl hacker ● GDAL user and developer, maintain Perl interface Geo::GDAL) ● Github and CPAN: ajolma ● ari.jolma at gmail.com
  • 3. Overview of the talk ● Geospatial web services – Programs (on servers) accessed by other programs (on clients) ● Actually a stack of programs and code on the server – Data discovery, data visualization, data access – Standardized by The Open Geospatial Consortium ● Little-known GDAL features – Redirection of /vsistdout/ – Utilities as functions (not so obscure but new) ● Modern Perl middleware – Software based on PSGI
  • 4. GDAL virtual file system (VSI) ● Many GDAL drivers read from and write to files ● GDAL has virtualized (added a layer of code) the file I/O ● Benefits of that are – things can be done to the data before it is read/written – sources and sinks that are not really files can be made looking like files for the drivers ● Read/write to – ZIP file – HTTP server – Memory buffer – See Even's blog from May 18, 2012
  • 5. Redirection of /vsistdout/ ● /vsistdout/ is GDAL virtualized stdout (uses fwrite to write to stdout) ● GDAL provides an API function to change fwrite and stdout – void VSIStdoutSetRedirection(VSIWriteFunction fct, FILE* stream) ● I built for the GDAL Perl interface a mechanism, which exploits this so that – One can use a specific perl object as the data source (sink) name when creating a dataset object – The only requirement is that the perl object in question must belong to a class, which has write and close methods – A related bug (VSIFCloseL does not flush the file, #6149) was fixed for 1.11.4, 2.0.1, and 2.1
  • 6. Sidenote ● Even: ”/vsistdout/ redirection was developed for MapServer, for FCGI and streamable OGR output” – https://github.com/mapserver/mapserver/commit/2c 5aad92a1e441fea8b08e38c995f8c3f831473a
  • 7. PSGI ● Perl Web Server Gateway Interface Specification – Tatsuhiko Miyagawa, 2009 ● Inspired by Python Web Server Gateway Interface specification, Ruby's Rack specification, and JavaScript Gateway Interface specification ● Covers plain old CGI and mod_perl but allows better solutions (frameworks) – CGI.pm has been removed from the core Perl 5 distribution (from 5.22) – mod_perl is an Apache specific solution and things like Nginx are gaining popularity ● Defines Middleware as a program (server), which takes an application and provides an environment for it to run – Both the application and the server are written in Perl – The application is a code reference (a subroutine) – The server prepares the input for the application and post-processes its output
  • 8. Typical(? my) setup ● Nginx web server – Provides various root level locations for websites on a server – A location may be Perl services ● Example: http://biwatech.com:800/Eurajoki ● Configured with proxy_pass ● Perl services are provided with Starman (high-performace preforking PSGI web server) – Starman workers read a configuration file ● Which is Perl code and mainly links URLs to methods from application objects ● In the case of geospatial web services and my case, this is objects from Geo::OGC::Service::* classes
  • 9. Plack ● Perl Superglue for Web frameworks and Web Servers (PSGI toolkit) ● Plack is a set of tools for using the PSGI stack. It contains middleware components, a reference server and utilities for Web application frameworks. Plack is like Ruby's Rack or Python's Paste for WSGI. ● Plack::Builder – For the Starman configuration file ● Plack::Component – Superclass of application classes (Geo::OGC::Service) ● Plack::Request – The request coming from the client
  • 10. OGC Services (from hacker point of view) ● Many ways to access: GET, POST, REST ● Need to be configured, often quite extensively ● Similar requests and responses ● CORS – Separate user interface and data provision ● Use of XML for message exchange ● Geo::OGC::Service class
  • 12. Message exchange ● Geo::OGC::Service class overrides the call method of Plack::Component class – And returns a reference to an anonymous subroutine ● Which calls the respond method of Geo::OGC::Service with two arguments: responder and environment ● Plack gives environment to the call method ● Plack gives responder to the anonymous subroutine ● environment contains the message from the client ● The service (us) uses the responder to send a message to the client – Either in one call (status, mime type, content) or in a delayed fashion, when it gets an object with which ● It (we) may use a write method ● Plack will call a close method ● So, to send content to the client we need an object, which has these two methods, and we can have it because of the vsistdout redirection in GDAL
  • 13. OK, nice, but what concrete have I done that others can enjoy, fix, or extend? ● The stuff in GDAL Perl interface & requested a fix to the bug in GDAL VSI ● Geo::OGC::Service class – + 4 classes for common things (CORS response and constructing XML messages) ● Geo::OGC::WFS class – GetCapabilities, GetFeature, Transaction – Mostly for the PostgreSQL driver ● Geo::OGC::WMTS class – WMTS and TMS Tile service – Tiles can be files or made on the fly
  • 14. Why? ● Because it could be done and I had the time ● To demonstrate a, perhaps, better way to build these services using existing tools and a modular approach ● To learn PSGI and Plack – Most of the code was originally written for plain old CGI ● To test some extensions – WFS: ”pseudo credentials” – On-the-fly processing of raster tiles
  • 15. WFS ”pseudo credentials” ● The requirement: – ”The users of a web mapping page should be able to submit geographical objects without first creating a user account. However, they should be able to edit the objects later.” – I.e., the ”account” should be created on-the-fly ● The solution: – Specific attributes (username, password) are not included in the published attribute list but they can be used in the filter and are required for a transaction
  • 16. On-the-fly production and processing of raster tiles ● Geo::OGC::Service::WMTS has a make_tile method, which gets the request and the configuration data of the requested resource ● The resource is opened as a GDAL dataset ● The extent of the tile is computed ● If the resource is configured with processing – The tile extent is expanded with two pixels – Translate is called on the dataset to clip the tile from the source into memory (/vsimem/) – Processing is applied to the memory tile dataset (DEMProcessing) – The dataset is replaced with the result – The tile extent is shrunk with two pixels – Note the use of GDAL utilities as functions in Perl ● Translate is called on the dataset with a writer object obtained from the responder ● Examples – http://www.pyhajarvensuojelu.net/valuma-aluetyo/ (click on Karttatasojen valinta → Lisätasot → Maasto) – http://arijolma.org/SmartSea/ (experimental, will change, suboptimal WMTS + no processing based on dataset)
  • 17. Latest (experimental) ● Hook for a generic processor – Keyword (parameter) 'processor' for the constructor of Geo::OGC::Service object, which should be a processor object – Geo::OGC::Service object gives the processor object to the service object, when it creates it – The service object calls it when preparing the response ● for example Geo::OGC::WMTS calls it with GDAL Dataset object and Tile object – Simple example
  • 18. Availability ● Github: – https://github.com/ajolma?tab=repositories – https://travis-ci.org/ajolma ● CPAN – https://metacpan.org/author/AJOLMA ● Artistic Licence 2.0 – Standard for Perl modules