clip and ship: mapserver for data distribution

26
Clip and Ship: MapServer for Data Distribution Frank Warmerdam, Google, Inc. Michael Smith, US Army Corps of Engineers

Upload: foss4g-2011

Post on 15-Jan-2015

4.551 views

Category:

Technology


3 download

DESCRIPTION

Clip and Ship: MapServer for Data Distribution by Frank Warmerdam of Google and Michael Smith of US Army Corps of Engineers

TRANSCRIPT

Page 1: Clip and Ship: MapServer for Data Distribution

Clip and Ship: MapServer for 

Data Distribution  

Frank Warmerdam, Google, Inc.Michael Smith, US Army Corps of Engineers

Page 2: Clip and Ship: MapServer for Data Distribution

Clip and Ship

Interactively:• visualization• layer selection• spatial drill down

  Deliver Data:• file format• coordinate system• raw data • bundled up (zip, etc)• immediate delivery

 

Page 3: Clip and Ship: MapServer for Data Distribution

OGC Web Protocols

All are HTTP web service protocols WMS (Web Map Service) • portrayal/visualization oriented • Returns PNG/JPEG/GIF

WFS (Web Feature Service)• Raw GIS vector feature access.• Defaults to returning GML.

 WCS (Web Coverage Service)• Raw Raster data access.• Returns GeoTIFF, etc.

 

Page 4: Clip and Ship: MapServer for Data Distribution

MapServer and GDAL/OGR

GDAL/OGR • multi format raster/vector data access • multi format raster/vector data writing• http://www.gdal.org/

MapServer• Web map server• Supports WMS, WFS and WCS protocols• Uses GDAL/OGR for some data access and encoding• http://www.mapserver.org/

 

Page 5: Clip and Ship: MapServer for Data Distribution

CorpsMap

• MapServer 

• OpenLayers 

• GeoExt 

 

Page 6: Clip and Ship: MapServer for Data Distribution

MapServer Implementation

Map File: • OUTPUTFORMAT declarations for output formats• enable WMS, WFS and WCS • DUMP TRUE for underlying data access• attribute access and type details • declare supported coordinate systems

 

Page 7: Clip and Ship: MapServer for Data Distribution

Metadata to allow Export and Support Projections

WEB   ......   METADATA        "ows_title" "mywfs"        "ows_enable_request" "*"        "ows_srs" "EPSG:4326 EPSG:26915 "        "wfs_getfeature_formatlist" "Shapefile,FileGDB,geojson"   ENDEND 

Page 8: Clip and Ship: MapServer for Data Distribution

Including Attributes

• Controlled via gml_include_items and gml_exclude_items

• Separate multiple columns with commas

• Use the special keyword all with the gml_include_items.

Example:METADATA  "gml_include_items" "all"   "gml_exclude_items" "my_sensitive_column,other"   END

• Default behavior is to expose no attributes at all

Page 9: Clip and Ship: MapServer for Data Distribution

Attribute Level Controls

• gml_itemname_alias• gml_itemname_width• gml_itemname_precision• gml_itemname_type

o Integer, Real, Character,Date, Boolean or

• "gml_types" "auto"o defines all field types from sourceo OGR, Oracle, PostGIS and Shapefile

• Default is everything is a string!

Page 10: Clip and Ship: MapServer for Data Distribution

Geometry Type

gml/ows/wfs_geomtype (Optional)• Geometry, Point, LineString, Polygon, MultiPoint,

MultiLineString, MultiPolygon, GeometryCollection or None

• Also 2.5D version - Point25D, LineString25D, ...

• Defaults to 2D based on layer type

• Used for GML and OGR output

Page 11: Clip and Ship: MapServer for Data Distribution

OutputFormat Declaration

Describes a OGR Format including

• layer creation options (LCO:*)

• dataset creation options (DSCO:*)

• formo Simple / Multipart / Zip

•  storageo  Memory / Filesystem / Stream

• filename (default is result.dat)

Page 12: Clip and Ship: MapServer for Data Distribution

Example Output Formats

OUTPUTFORMAT  NAME "Shapefile"  DRIVER "OGR/ESRI Shapefile"  FORMATOPTION "STORAGE=memory"  FORMATOPTION "FORM=zip"  FORMATOPTION "FILENAME=%outfile%.zip" END  OUTPUTFORMAT  NAME "FileGDB"  DRIVER "OGR/FileGDB"  FORMATOPTION "STORAGE=filesystem"  FORMATOPTION "FORM=zip"  FORMATOPTION "FILENAME=%outfile%.gdb.zip" END 

Page 13: Clip and Ship: MapServer for Data Distribution

More Examples 

OUTPUTFORMAT  NAME "geojson"  DRIVER "OGR/GEOJSON"  MIMETYPE "application/json; subtype=geojson"  FORMATOPTION "STORAGE=stream"  FORMATOPTION "FORM=SIMPLE"END

OUTPUTFORMAT  NAME "OGRGML"  DRIVER "OGR/GML"  FORMATOPTION "STORAGE=memory"  FORMATOPTION "FORM=zip"  FORMATOPTION "FILENAME=%outfile%.gml.zip"END

Page 14: Clip and Ship: MapServer for Data Distribution

Even More Examples 

OUTPUTFORMAT  NAME "MIDMIF"  DRIVER "OGR/MapInfo File"  FORMATOPTION "STORAGE=filesystem"  FORMATOPTION "FORM=multipart"  FORMATOPTION "DSCO:FORMAT=MIF"  FORMATOPTION "FILENAME=result.mif"END

OUTPUTFORMAT  NAME "CSV"  DRIVER "OGR/CSV"  MIMETYPE "text/csv"  FORMATOPTION "LCO:GEOMETRY=AS_WKT"  FORMATOPTION "STORAGE=filesystem"  FORMATOPTION "FORM=simple"  FORMATOPTION "FILENAME=result.csv"END

Page 15: Clip and Ship: MapServer for Data Distribution

Make Request via WFS

http://server/cgi-bin/mapserv6?map=mymapfile.map&service=wfs&version=1.1.0&request=getFeature&typename=myLayer&outputformat=Shapefile

Page 16: Clip and Ship: MapServer for Data Distribution

Make a request for projected data (requires WFS 1.1.0 or later)

http://server/cgi-bin/mapserv6?map=mymapfile.map&service=wfs&version=1.1.0&request=getFeature&typename=myLayer&outputformat=FileGDB&srsname=EPSG:26915

Page 17: Clip and Ship: MapServer for Data Distribution

Clip and Ship

http://server/cgi-bin/mapserv6?map=mymapfile.map&service=wfs&version=1.1.0&request=getFeature&typename=myLayer&outputformat=Shapefile&Filter=<Filter> <BBOX>   <PropertyName>      <Name>NAME</Name>   </PropertyName>   <Box srsName='EPSG:4326'>     <Coordinates>-95.844,40.253 -95.384,40.483</coordinates>   </Box>  </BBOX></Filter>

Page 18: Clip and Ship: MapServer for Data Distribution

Validation for Filename Substitution

WEB   ....     METADATA     ...     END          VALIDATION         outfile "."         default_outfile "result"     ENDEND

Page 19: Clip and Ship: MapServer for Data Distribution

Request with Filename

http://server/cgi-bin/mapserv6?map=mymapfile.map&service=wfs&version=1.1.0&request=getFeature&typename=myLayer&outputformat=Shapefile&outfile=myshapefile

Page 20: Clip and Ship: MapServer for Data Distribution

Other Clip and Ship Options

• GeoServer has roughly similar WFS output extensions

• Suggestions from audience?

Page 21: Clip and Ship: MapServer for Data Distribution

Lessons Learned

• No temporary files (for some formats)

• Only method to limit download size is maxfeatures

• No method to limit extent of data download

• Every SRS supported for download needs to be enumerated

Page 22: Clip and Ship: MapServer for Data Distribution

Conclusion

Docs are available at • OGR Output - http://mapserver.org/output/ogr_output.html

• WFS Server - http://mapserver.org/ogc/wfs_server.html

Supported by MapGears                www.mapgears.com

US Army Corps of Engineers 

Page 23: Clip and Ship: MapServer for Data Distribution

CorpsMap Viewer 

OpenLayers / GeoExt / MapServer 6 / Oracle based Web Viewer

Page 24: Clip and Ship: MapServer for Data Distribution

Exporting a data layer

Page 25: Clip and Ship: MapServer for Data Distribution

Shapefile Export

Page 26: Clip and Ship: MapServer for Data Distribution

Zipped Shapefile Generatedhttp://maps.crrel.usace.army.mil:7778/cgi-bin/mapserv6?map=/htdocs/cm2_dev/cm2_test.map &service=wfs&version=1.1.0&request=getFeature&outputformat=Shapefile&outfile=NOAA_Streamgages &Filter=<Filter><BBOX><PropertyName><Name>NAME</Name></PropertyName> <Box srsName='EPSG:4326'><coordinates>-111.626587,36.998444 98.673706,40.992601</coordinates> </Box></BBOX></Filter>&SRSNAME=EPSG:4326&typename=ahpsobsl