mapcria web service
Download
Report
Transcript mapcria web service
mapcria web service
Centro de Referência em Informação Ambiental, CRIA
Sidnei de Souza
Abril 2006
mapcria web service
it is a web service developed by CRIA to facilitate the implementation of web applications that
require the dynamic production of maps
It uses the University of Minnesota MapServer C library, MapScript wrap for Perl, v4.2.0
[ http://mapserver.gis.umn.edu ]
Developed in Perl v5.8.0
Available as a SOAP server
Allows multiple simultaneous jobs
Map initial characteristics are specified on an XML document at once
Accepts local layers files as well as available via WMS
Provides several functions to maintain interaction
User clicks on a
web page link
that calls a CGI
application
The CGI creates an XML file
that describes the map to be
produced.
CGI
application
get_image(ticket)
Returns a
ticket to the
caller
application
draw()
The XML file is sent
to the mapcria web
service using a
SOAP connection
The application
requests the newly
created map image.
mapcria
draw
polygons
The server delivers the
requested image
draw
points
wms
draw
lines
files
mapfile
db
queries
mapcria web service basic use
Loads the layers according to
the definitions on an specific
mapfile.
Draws the requested
elements on the map.
CGI
application
zoom_rectangle(ticket)
get_image(ticket)
The application
requests a zoom and
the resulting image.
mapcria
The user selects an area to
zoom in
The server delivers the
requested zoomed image
mapcria web service basic use
The service performs
the required zoom on
the map
mapcria viewer
is a set of general purpose CGI Perl scripts that implement the basic functionalities required for
the visualization of (and interaction with) maps produced by the mapcria web service.
Once a map is initialized on the server, the mapcria viewer takes control of the job of providing the
user with tools to continue the interaction with the server.
The basic tools provided by the viewer are:
Zoom In and Out
Panning
Reference map window
Layers on / off panel
Active layers window
Plug-in to search a database based on selected coordinates *
Plug-in to search a database to find points to be plotted on the map *
User help information window
Standard page generation for printing
Multi-language interface
* requires special applications according to the system
The CGI creates an XML file
that describes the map to be
produced.
CGI
application
The application starts
the mapcria viewer
passing the ticket as
a parameter.
Returns a
ticket
The XML file is sent
to the mapcria web
service
mapcria
viewer
The mapcria viewer
takes control of the
job and provides an
interface with the
commonly used
functions.
mapcria
Map viewer window
Layers control window
Reference map window
Active layers window
Database search window *
Symbols select window *
User help window
Printable page
mapcria web service use with
the mapcria viewer
mapcria web service initial
XML schema detail (draw)
mapcria web service methods
draw
zoom_coords
get_active_layers
zoom_all
get_image_width
set_visibility
get_image_height
toogle_layer
get_image
get_field_value_by_coord
get_scalebar
set_image_scale
get_reference
click2map
get_extent
del_object
zoom_point
finish
zoom_rectangle
mapcria web service example
#!/usr/local/bin/perl
$|=1;
use strict;
use SOAP::Lite;
my ($long,$lat) = @ARGV;
print “Content-type: image/png\n\n”;
my $soap = SOAP::Lite
-> uri("http://saruman.cria.org.br/manager")
-> proxy(“tcp://saruman.cria.org.br:5900/",
timeout => 15)
-> on_fault( sub { return undef } );
my $xml =<<EOM;
<?xml version="1.0" encoding="UTF-8"?>
<mapcria xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation="http://www.cria.org.br/schema/mapcria3.0.x
sd">
<user>CRIA demo Manager</user>
<map id="MAPA">
<set_defaults>SP</set_defaults>
<set_extent>-53.11,-19.78,-42.69,-25.30</set_extent>
<set_extent_text>false</set_extent_text>
<set_image_transparent>false</set_image_transparent>
<set_image_width>160</set_image_width>
<set_image_height>120</set_image_height>
<layer id="BRASIL_UF">
<set_visibility>true</set_visibility>
<set_fill_color>255,255,255</set_fill_color>
</layer>
<layer id="BRASIL_MUN">
<set_visibility>false</set_visibility>
</layer>
<query_by_coord id="municipio">
<set_layer>BRASIL_MUN</set_layer>
<set_outline_color>255,0,0</set_outline_color>
<set_symbol_color>255,0,0</set_symbol_color>
<set_symbol>point</set_symbol>
<set_symbol_size>8</set_symbol_size>
<set_coords>$long,$lat</set_coords>
</query_by_coord>
</map>
</mapcria>
EOM
my $ticket = $soap->draw($xml)->result();
print $soap->get_image($ticket)->result();
$soap->finish($ticket);
LAST SLIDE…
current version documentation is available at
http://www.cria.org.br/mapcria/doc/
Questions?
On-line demonstration?
Thank you!