Geoinformatics tools with Perl integration development needs Goal

  • Slides: 19
Download presentation
Geoinformatics tools with Perl: integration, development, needs • Goal: a programmable environment for geoinformatics

Geoinformatics tools with Perl: integration, development, needs • Goal: a programmable environment for geoinformatics – data management, integration, analysis – handle large and voluminous; complex and mixed format data sets – program tools for web and GUI and CLI desktop

Use cases / requirements • An analysis / data processing tool which is used

Use cases / requirements • An analysis / data processing tool which is used 1. . 20 times, process lots of data in reasonable time, used from command line or in batch mode, max ~100 lines of code • A functionality for a web site, do a well-defined task fast • A data viewer which supports environmental modeling workflows • A platform on which to implement a specific environmental model for a non-developer to use

Analysis of the requirements • use cases are from my work: research in /

Analysis of the requirements • use cases are from my work: research in / teaching (mostly environmental geospatial) analysis, modeling and management • not much “production” use, which is(? ) – data editing – cartographics – well-defined workflows

Platforms 1. • Perl, Python, Ruby, R – – – similar things are done

Platforms 1. • Perl, Python, Ruby, R – – – similar things are done in all these communities good: learn for other’s experiences bad: work done by others can’t be directly utilized Swig, . NET/mono? ? , R-Perl, Rpy, other? Write Gdk. Map and Gtk. Map. Window, which can be shared? • Multiple OS – Perl traditionally good – MSWindows: my experience from Min. GW rather positive

Platforms 2. • Desktop / Web – Perl tools good on server side in

Platforms 2. • Desktop / Web – Perl tools good on server side in web – If functionality is in libraries or scripting languages, desktop and web stacks are quite similar below the layer which provides data for the UI – My GUI toolkit choice: Gtk 2

General architecture Perl modules Perl tools non-Perl tools libraries, fundamental tools

General architecture Perl modules Perl tools non-Perl tools libraries, fundamental tools

Stack GUI app w/ dialogs Data viewing, exploratory analysis, model use Gtk 2: :

Stack GUI app w/ dialogs Data viewing, exploratory analysis, model use Gtk 2: : Ex: : Geo: : * Perl scripting for application development Geo: : Raster, . . Perl scripting for data analysis & modeling gdal, ogr, . . . Perl scripting for data integration & fundamental analysis libraries C, C++, . NET

libraries (libral) • libral has structs for rasters and vectors in RAM • mainly

libraries (libral) • libral has structs for rasters and vectors in RAM • mainly raster ops pixbuf struct gdk-pixbuf • rasterization libral • create image GDALRaster. IO GDAL OGR_G_Get. X etc. OGR

libraries: discussion • export data from libral to GDAL and OGR • image (map)

libraries: discussion • export data from libral to GDAL and OGR • image (map) creation is simplistic (but fast, does its job, and can be annotated on in upper layers) • Should GEOS be integrated directly? • Dependence on gdk-pixbuf is just the pixbuf struct, which is simple • Recent discussion on gdal-dev on transparent tiled access to raster datasets from analytical environment (in C++)

gdal, gdalconst, ogs, osr • Swig bindings to GDAL and OGR • Perl is

gdal, gdalconst, ogs, osr • Swig bindings to GDAL and OGR • Perl is supported by Swig => not much to do – typemaps: small pieces of code to translate from C/C++ structs to Perl structs – Makefile – bootstrapping test code (create/read datasets, data sources, layers) – some documentation

Swig bindings, discussion • Based on simplified / recreated shadow C++ API built on

Swig bindings, discussion • Based on simplified / recreated shadow C++ API built on GDAL/OGR C API • Memory management is different in C++ and in Scripting Languages –issue is not fully solved • Perl Module, which Swig creates is not Perlish / easy to use • => Modify Perl Swig bindings / Build yet another layer? – Geo: : GDAL

http: //map. hut. fi/gdal-perl/Geo-GDAL. html Classes with connection to spatial analysis and modeling

http: //map. hut. fi/gdal-perl/Geo-GDAL. html Classes with connection to spatial analysis and modeling

Perl modules Dialog modules in Gtk 2: : Ex: : Geo: : Overlay Gtk

Perl modules Dialog modules in Gtk 2: : Ex: : Geo: : Overlay Gtk 2: : Ex: : Geo: : Glue Gtk 2: : Scrolled. Window Gtk 2: : Ex: : Geo: : Renderer Gtk 2: : Gdk: : Pixbuf gdal, gdalconst, ogr, osr (Swig) Geo: : Raster Geo: : Vector Geo: : Layer (abstract)

Modules, discussion • Geo: : Raster is an API for libral • How would

Modules, discussion • Geo: : Raster is an API for libral • How would Geo: : GEOS fit into this picture? • Visualization (map making, visual analysis, visual support for analysis & modeling) focuses on layers – Modeling focuses on data and concepts (objects) – A style descriptor class is missing from the picture • I am planning a Geo: : Colortable, which would be a first step

Intertwining capabilities: web, desktop # create layers as an array of Geo: : Layer

Intertwining capabilities: web, desktop # create layers as an array of Geo: : Layer objects, based on the Get. Map request. . . # create the pixbuf $pixbuf = Gtk 2: : Ex: : Geo: : Renderer->new (@layers, $bbox[0], $bbox[3], $pixel_size, $w, $h, 0, 0, @bgcolor); # for web $pixbuf->save($filename, 'png'); serve_document($filename); # a simple helper function

Intertwining capabilities: web, desktop # user manipulates layers as an array of Geo: :

Intertwining capabilities: web, desktop # user manipulates layers as an array of Geo: : Layer objects. . . # in Overlay class, create the pixbuf, make a pixmap and then image from it # the image is within the Gtk 2: : Scrolled. Window $pixbuf = Gtk 2: : Ex: : Geo: : Renderer->new($self->{layers}, $self->{min. X}, $self->{max. Y}, $self->{pixel_size}, @{$self->{viewport_size}}, $self->{w_offset}, $self->{h_offset}, @{$self->{bg_color}}); $pixmap = $pixbuf->render_pixmap_and_mask(0); $self->{image}->set_from_pixmap($pixmap, undef); $self->{image}->set_size_request(@{$self->{canvas_size}}); $self->{image}->set_alignment($xalign, $yalign);

Dialogs • Dialogs for raster layers – – open (standard file open) properties colortable

Dialogs • Dialogs for raster layers – – open (standard file open) properties colortable clip (from GDAL to libral) • Dialogs for vector layers – – open (custom: data source, layer, schema) properties, features, geometries colortable rasterize (from OGR to libral)

Open a vector layer

Open a vector layer

Next steps • Geo: : GDAL, Geo: : Colortable • Geo: : GEOS (once

Next steps • Geo: : GDAL, Geo: : Colortable • Geo: : GEOS (once GEOS 3 comes out and its Swig bindings stabilize) • Better look into various types of geospatial simulation • Top-Down: Supporting environmental planning, i. e. , classes for entities like wetlands, snow measurements, . . .