21
Implementation of an Open- Source Internet Map Server Lowell Ballard Virginia Economic Development Partnership

Implementation of an Open-Source Internet Map Server

Embed Size (px)

DESCRIPTION

Implementation of an Open-Source Internet Map Server. Lowell Ballard Virginia Economic Development Partnership. Topics to be Covered. Overview of “MapServer” Various methods to implement MapServer The Implementation at VEDP The gory details Comparison to other Internet Map Servers - PowerPoint PPT Presentation

Citation preview

Page 1: Implementation of an Open-Source Internet Map Server

Implementation of an Open-Source Internet Map Server

Lowell BallardVirginia Economic Development Partnership

Page 2: Implementation of an Open-Source Internet Map Server

Topics to be Covered

• Overview of “MapServer”

• Various methods to implement MapServer

• The Implementation at VEDP

• The gory details

• Comparison to other Internet Map Servers

• What you should consider when choosing an Internet Map Server

Page 3: Implementation of an Open-Source Internet Map Server

MapServer Overview

• MapServer is an OpenSource development environment for building spatially enabled Internet applications.

• The MapServer was originally developed by (UMN) ForNet project in cooperation with NASA and the Minnesota DNR

• Current development is funded by the TerraSIP project, a NASA sponsored project between the UMN and consortium of land management interests.

• MapServer will run where most commercial systems won't or can't, on Linux/Apache platforms.

• MapServer is known to compile on most UNIXes and will run under Windows NT/98/95/00.

Page 4: Implementation of an Open-Source Internet Map Server

MapServer Implementation Options

• MapServer can be implemented as a CGI application.

• The MapServer CGI application provides a significant number of "out-of-the-box" features.

• vector formats supported: ESRI shapefiles, simple embedded features, ESRI ArcSDE• raster formats supported: TIFF/GeoTIFF, GIF, PNG, ERDAS, JPEG and EPPL7 • quadtree spatial indexing for shapefiles • fully customizable, template driven output • feature selection by item/value, point, area or another feature • TrueType font support • support for tiled raster and vector data (display only) • automatic legend and scalebar building• scale dependent feature drawing and application execution• thematic map building using logical or regular expression based classes• feature labeling including label collision mediation• on-the-fly configuration via URLs• on-the-fly projection

Page 5: Implementation of an Open-Source Internet Map Server

MapServer Implementation Options• MapServer system supports MapScript which allows popular scripting

languages such as Perl, Python, Tk/Tcl, Guile and even Java to access the MapServer C API.

• This is analogous to Active Server Pages (.asp) and ColdFusion (.cfm) in the ClosedSource world.

• MapScript provides a rich environment for developing applications that integrate disparate data.

• If the data have a spatial component, and you can get to it via your favorite scripting environment, you can map it.

• Additionally MapScript allows you to integrate your business data in an RDBMS (e.g., Oracle, MySQL, Sybase) into your MapServer application.

Page 6: Implementation of an Open-Source Internet Map Server

• In addition, there is now a PHP/MapScript module included in the current release.

• This provides a powerful OpenSource alternative to .asp, .cfm and other server-side scripting languages.

Example 1: HTML alone

Hello, World!

Example 2: PHP code alone

<?php print "Hello, World!"; ?>

Example 3: PHP embedded within HTML

<?php print "Hello,"; ?> World!

MapServer Implementation Options

Page 7: Implementation of an Open-Source Internet Map Server

Implementation at the VEDP

• We have used the CGI version for the past year.

• Recently we added a PHP version.

• Both are linked from the main page of http:gis.vedp.org

Page 8: Implementation of an Open-Source Internet Map Server

The Gory Details - CGIMAP FILE-------------

Contains thebasic configurationfor the map service:

LayersImage output directory

ProjectionsImage SizeSymbology

Legend propertiesScale bar Property

MapServer CGI---------------------

Compiled to supportVarious functionality needed:

SDEMapInfo support

png, gif, jpgTrueType fonts

TEMPLATE FILE(s)-------------

Contains thecode to create

the map interface:

HTMLJavaScriptLayers list

Zoom buttonsTables

Image, legend andScale bar placement

Submit form

Calls

References

Generates andreturns images

Page 9: Implementation of an Open-Source Internet Map Server

.map File Example

NAME DEMO

STATUS ON

SIZE 600 500

FONTSET /usr/local/apache/htdocs/vedp_maps/fonts/fonts.list

SYMBOLSET symbols/symbol.sym

EXTENT -400000 50000 400000 400000

UNITS FEET

SHAPEPATH "data"

IMAGECOLOR 255 255 255

Page 10: Implementation of an Open-Source Internet Map Server

.map File Example - simpleLAYER

NAME counties #Layer nameTYPE POLYGONDATA county #shapefile nameSTATUS ONCLASSITEM tile_name #for queries use thisLABELITEM "name“ #label using this itemSYMBOLSCALE 1500000 #Start scaling at this resolutionLABELMAXSCALE 600000 #Start labeling at this scaleHEADER county_header.html #Header template for queriesCLASS #Start of a map class NAME "Counties“ #Name for Legend EXPRESSION /./ #could be pop90 > 10000 e.g. OUTLINECOLOR 128 128 128 COLOR 245 240 219 TEMPLATE county.html #used to build query output LABEL #Builds the label

SIZE 8 MINSIZE 2 MAXSIZE 8 COLOR 0 0 0 BACKGROUNDCOLOR 255 255 204 BACKGROUNDSHADOWSIZE 4 4 BACKGROUNDSHADOWCOLOR 0 0 0 TYPE TRUETYPE FONT tahoma ANTIALIAS BUFFER 1 ENDEND

END

Page 11: Implementation of an Open-Source Internet Map Server

CLASSITEM "ROAD_TYPE" CLASS EXPRESSION "1" COLOR 0 0 0 SYMBOL 'symbols/images/interstate.png' LABEL SIZE 2 MINFEATURESIZE 40 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 255 255 255 END END CLASS EXPRESSION "2" COLOR 0 0 0 # dummy color SYMBOL 'symbols/images/ushwy.png' LABEL MINFEATURESIZE 50 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 0 0 0 END END

.map File Example – multiple classes

Page 12: Implementation of an Open-Source Internet Map Server

LAYER NAME spot2001 TYPE RASTER STATUS OFF TILEINDEX spot_2001/spotindex TILEITEM "LOCATION" MAXSCALE 25000 MINSCALE 3000 OFFSITE 0END

.map File Example - Raster

Page 13: Implementation of an Open-Source Internet Map Server

• The hardest part is the compilation process.

• Because it’s open source it pulls from many different projects with many different developers.

• If you need support for something (e.g., TrueType fonts) it has to be compiled in (e.g., FreeType).

• This can be a pain.

• However, installation of most IMServers is a pain.

The Gory Details

Page 14: Implementation of an Open-Source Internet Map Server

• --with-gd[=[static,]DIR] Specify which version of GD to use (DIR is GD's • install dir).• --with-freetype=DIR Specify where FreeType is installed (DIR is path to • FreeType 2.x freetype-config program or FreeType 1.x/2.x install dir).• --with-zlib=DIR Specify where zlib is installed (DIR is path to • zlib install dir).• --with-png=DIR Specify where PNG is installed (DIR is path to • PNG install dir).• --without-tiff Disable TIFF support.• --with-tiff[=DIR] Include TIFF support (DIR is LibTIFF's install dir).• --without-eppl Disable EPPL7 support.• --with-eppl Include EPPL7 support.• --with-proj[=DIR] Include PROJ.4 support (DIR is PROJ.4's install dir).• --with-sde[=DIR] Include ESRI SDE support (DIR is SDE's install dir).• --with-sde-version[=VERSION NUMBER] Set ESRI SDE verion number (Default is

80).• --with-mpatrol[=DIR] Include MPATROL support (DIR is MPATROL's install dir).• --with-ogr[=DIR] Include OGR support (DIR is OGR's install dir).• --with-gdal[=DIR] Include GDAL support (DIR is path to gdal-config• --with-postgis[=ARG] Include PostGIS Support (ARG=yes/path to pg_config)• --without-wms Disable OGC WMS Compatibility (enabled by default).• --without-wmsclient Disable OGC WMS Client Connections (enabled by default).

Subset of Compilation Options

Page 15: Implementation of an Open-Source Internet Map Server

Comparison--Speed

• MapServer is faster• I compared MapServer running on a PII

Desktop with 128 MB RAM to another IMS running on a PIII 512 MB RAM Server.

• CPU usage for MapServer was about 20% per map rendered and took about 1 second.

• CPU on other IMS took about 8-10 seconds and 100% CPU utilization.

Page 16: Implementation of an Open-Source Internet Map Server

Comparison--SupportTo: [email protected] Subject: [mapserver-users] mapraster.c compile error--- From: "Ballard,Lowell" <[email protected]> Date: Mon, 20 Aug 2001 10:45:56 -0400 I've tried compiling nightly with several options and I always get the same parse

errors.----------------------------------------- gcc -c -O2 -Wall -DIGNORE_MISSING_DATA -DUSE_EPPL -DUSE_TIFF -DUSE_JPEG -DUSE_GD_GIF -DUSE_GD_SWAP_XY -DUSE_SDE -I/home/baldur/mapserver/./gd-1.2/ -I/home/baldur/mapserver/../sdeexe81//include mapraster.c -o mapraster.o

===========================================To: "Ballard,Lowell" <[email protected]> Subject: Re: [mapserver-users] mapraster.c compile error--- From: Daniel Morissette <[email protected]> Date: Mon, 20 Aug 2001 11:04:40 -0400 CC: [email protected] References: <509989F9E1D38D47ADA73ED9CF5BF32A16CEDD@communications> > I've tried compiling nightly with several options and I always get the > same parse

errors. > mapraster.c: In function `msDrawRasterLayer': > mapraster.c:1698: parse error before `{' It's a typo related to a change I made last week. It was a missing bracket inside an #ifdef'd case that was never compiled in my case. I've committed a fix, so please do a CVS update and try again.

Page 17: Implementation of an Open-Source Internet Map Server

• The ListServ is very active and very responsive

• Messages are archived and searchable

• I usually get a response to my problem in in hour or less

Comparison--Support

Page 18: Implementation of an Open-Source Internet Map Server

• MapServer is completely free.

• It is free from cost

• You are free to modify the source code

• As people make changes or develop enhancements they are committed to the development tree.

• This is how the product grows so rapidly

Comparison—Cost

Page 19: Implementation of an Open-Source Internet Map Server

Recent Developments

• Major advancements in Web Mapping Services.

• Ability to handle .axl requests from ArcGIS

Page 20: Implementation of an Open-Source Internet Map Server

What to consider

• Your “Need for Speed”

• Your in-house abilities

• Database connectivity

• GIS data formats

• Your budget

Page 21: Implementation of an Open-Source Internet Map Server

Resources

• http://gis.vedp.org (“about this site” link)

• DM Solutions (PHP MapScript) (http://www.dmsolutions.on.ca/)

• ApacheToolbox (http://www.apachetoolbox.com)

• Google (http://www.google.com) which runs on a Linux cluster .