map server 08122008
TRANSCRIPT
15 dicembre 2008
Mapserver, msCrossand Grida3Roberto Demontis - Crs4
What are
● MapServer is an Open Source development environment for building spatially-enabled internet applications. ● msCross is a AJAX (WEB 2.0) WEB GIS client ( Mapserver, Web Gis Services ...)
MapServer via msCross● Standard configuration
- Apache web server and mapserver cgi-bin interface [server]
- msCross JavaScript library (Ajax) [client]
● Typical data - Shapefiles ( shp + dbf ), - GRASS ( raster ), - Postgis (database table)
Problems The data to be shown is located in the spooler dir: $EF_SPOOLER owned by the user
+The data access depends on the apache user's privileges
=Lack of security
http://grd3wk01.crs4.it/cgi-bin/mapserv (The server is not accesible outside Crs4)
Solution (minimal) ● The data to be shown is located in the
spooler dir: $EF_SPOOLER owned by the user+
● Use of the CGI Interface inside a script shell executed by the user
=● An enginframe service in the new portal
/enginframe/agisgrid/agisgrid.xml?_uri=//agisgrid/landsuit_mapserver_NEW
(The portal is not accesible outside Crs4)
Solution (minimal)
Interface:● Single map layer (GRASS raster)
● Interactive with Multiple layer (Shapefiles and Grass raster)
Map files:
● Single map layer (GRASS raster)
● Interactive with Multiple layer (Shapefiles and Grass raster)
Solution (minimal) ● The service declaration
<ef:service id="landsuit_mapserver_NEW" hidden="true" ><ef:name>try_mapserv</ef:name> <ef:action result="image/gif" id="get_image"> export QUERY_STRING ${EF_PLUGIN_PATH}/bin/mapserv.sh </ef:action></ef:service>
● The mapserv.sh script#!/bin/shexport LD_LIBRARY_PATH='.....'# the "dd" command removes the "Content-Type..." string/GRIDA3/EFData/AGISGRID/bin/mapserv "QUERY_STRING=$QUERY_STRING" -nh | dd bs=1 skip=25 2>/dev/null
Solution (minimal)
● The JavaScript msCross map object definition
myMap1 = new msMap( document.getElementById('dc_map') , 'standardCornerRight'); if ( window.location.host == 'grd3port.crs4.it:18080')
myMap1.setCgi('/enginframe/agisgrid/agisgrid.xml?_uri=//agisgrid/landsuit_mapserver_NEW' ); else myMap1.setCgi('http://grd3wk01.crs4.it/cgi-bin/mapserv?' ); myMap1.setFullExtent( 1521000, 1560000, 4358000 ); myMap1.setMapFile( '..../data/mscross.map'); myMap2 = new msMap( document.getElementById('dc_ref') );
................... myMap1.setReferenceMap(myMap2); myMap1.redraw(); myMap2.redraw();
Solution (minimal) ● The JavaScript msCross library “?”
this.get_map_url = function() { var my_url; if (_protocol == 'mapservercgi') { ............
my_url = _cgi + '?mode=' + _mode + '&' + _map_file + '&' + ext + '&' + size + '&layers=' + _layers;
...............
replaced with:my_url = _cgi + '&mode=' + _mode + '&' + _map_file +
'&' + ext + '&' + size + '&layers=' + _layers;
AGISGRID ● Data Model: - vector and raster data - GRASS context: location and mapset defined in
WIND e PROJ files ● Data Storing: - Ascii files (raster data) - postgis tables (vector data)● Import:
- postgis table --> psql2shp --> shp+dbf files - gzipped ascii file --> GRASS --> GRASS raster