Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of Minnesota Mapserver WMS/WFS Documentation with Examples

Similar presentations


Presentation on theme: "University of Minnesota Mapserver WMS/WFS Documentation with Examples"— Presentation transcript:

1 University of Minnesota Mapserver WMS/WFS Documentation with Examples
WMS / WFS How To University of Minnesota Mapserver WMS/WFS Documentation with Examples Gayathri Swaminathan University of Oklahoma

2 Table of Contents. Introduction Web Map Server (WMS)
Setting up a WMS Server WMS Client Implementations Web Feature Server (WFS) WFS Client Implementations Appendix

3 1.Introduction WMS* Mapserver web The Internet Application
Client 1 WMS* Mapserver web Application Implementation (Server) The Internet Client 2 WFS** Client n Mapserver Web Application with WMS and WFS service * Web map service ** Web feature service

4 1.1 Terminologies WMS – Web map service / server
WFS – Web Feature service / server OGC – Open GIS Consortium Mapserver – University of Minnesota’s Internet Mapping Software GML – Geographic markup language

5 1.2 Standards 1) Who sets the WMS/ WFS standards?
OpenGIS Consortium (OGC) – This organization is analogous to the IEEE or ANSI in organizing and coordinating the various GIS specific application development. 2) Where can I find WMS/WFS related information? WMS specification: WMS specification: WMS specification: WMS-Dev mailing list and archive: WMS FAQ: WMS XML Capabilities validator: WMS Cookbook: WFS specification: GML specification:

6 2. Web map server According to the Mapserver WMS How to document, “A WMS (or Web Map Server) allows for use of data from several different servers, and enables for the creation of a network of Map Servers from which clients can build customized maps.” GetCapabilities WMS CGI Implementation Request Types GetMap GetFeatureInfo DescribeLayer Mandatory requests supported per OGC recommendations Optional requests of some implementations Client’s Computer Per Mapserver’s website, Mapserver supports the following WMS versions: 1.0.0, 1.0.7, (a.k.a ), and 1.1.1

7 2.1 Request Types GetCapabilities Client GetMap Client GetFeatureInfo
XML document with metadata of the WMS Client GetMap Client GetFeatureInfo Client Text/ Plain attribute information Clicks on map Send request Text/ Plain using Mapserver query templates set in wms_feature_info_mime_type GML features XML description of One or more layers (currently supported Only in SLD servers) DescribeLayer* Client * NOT SUPPORTED IN MAPSERVER

8 3. Setting up a WMS Server All WMS requests are handled by the mapserver CGI. 1. Compilation settings: In unix, mapserver should have been compiled with the “with_wms” option. In windows, the nmake.opt file should have the WMS settings uncommented and then compiled. As a result, when you do a mapserv –v the SUPPORTS should include WMS_SERVER Example 1. On Unix: $ ./mapserv -v MapServer version 4.2-beta1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE Example 2. On Windows: C:\apache\cgi-bin> mapserv -v MapServer version 4.2-beta1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS-WFS_SERVER SUPPORTS=WFS_CLIENT INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

9 3. Setting up WMS Continued.,
2. Set up map file - Mapserver For a WMS server implementation it is required to add metadata information for each layer that is to be advertised by the server. As recommended by WMS Mapserver How to documentation ( At the map level: Map NAME Map PROJECTION Map Metadata (in the WEB Object): wms_title wms_onlineresource wms_srs (unless PROJECTION object is defined using "init=epsg:...") And for each layer: Layer NAME Layer PROJECTION Layer Metadata wms_srs (optional since the layers inherit the map's SRS value) For a detailed description of each of the parameters mentioned above, visit the “Mapserver WMS How to” web page.

10 3.1 Test WMS Server Test recommendations from the Mapserver How to:
1. GetCapabilities: In a web browser, type in the URL, Substitute my.host.com with your website and mywms.map with the absolute path to the map file in your web server Result: This request should return an XML document and prompt to save file. Save the file and open it in a XML Editor or text editors like notepad, EMacs etc., 2. GetMap &REQUEST=GetMap&layers=state,province If map layers state and province STATUS ON or DEFAULT then an image of the map with the layers is displayed in the Browser A complete GetMap request example: , , , &WIDTH=400&HEIGHT=300&FORMAT=image/png

11 3.2 GetMap Parameters FORMAT WMS Server (mapserver cgi location)
VERSION REQUEST LAYERS STYLE SRS BBOX WIDTH HEIGHT FORMAT WMS Server (mapserver cgi location) WMS request version Spatial reference system from EPSG file Width of returned map image Format of returned map image Map layers Map file Bounding box corners (lower left, upper right) in SRS units Request-GetMap Rendering Style for SLD support. Mapserver currently does not support this, leave empty Height of returned map image

12 3.3 WMS Samples 1. MAP PARAMETERS – 2. LAYER PARAMETERS –
Sample Map file: 1. MAP PARAMETERS – NAME TAMILNADU ….. WEB EMPTY “norecords.htm" TEMPLATE “tamilnadumap.htm" IMAGEPATH “/tmp/" IMAGEURL "/tmp/" METADATA "wms_title“ “TamilNadu WMS Server" "wms_abstract" “Tamilnadu" "wms_extent" " " "wms_accesscontraints" "none" "wms_contactperson" “Mahalakshmi" "wms_contactorganization" “Tamil Nadu" "wms_contactposition" "Software Engineer" "wms_fees" "none" "wms_onlineresource" " "wms_srs" "EPSG:99999" END 2. LAYER PARAMETERS – LAYER NAME state TYPE POLYGON STATUS DEFAULT DATA county PROJECTION #GEOGRAPHIC NAD83 proj=longlat ellps=GRS80 no_defs CLASS COLOR "wms_title" "State" "wms_srs" "EPSG:4019"

13 4. WMS Client Implementations
Browser WMS Server Mapserver WMS Client Arc Explorer

14 4.1 Connect from a browser Form URL(s) and make request to WMS Server
1. GetCapabilities Example: – Will get a XML document with Metadata information of the WMS Server. 2. GetMap Example: Get me a map of Tamilnadu state with rivers layer of size 500x700 – Will get a map of tamil nadu state with the rivers layer per definition in tnmap.map Things to consider: Do a GetCapabilities and see the advertised SRS codes. For example, Lat/Lon projection, State Plane etc., When forming requests build from bare bones! Start with the mandatory required parameters and then add on Image formats available for example, jpeg, png etc., can also be found in the GetCapabilities NO STYLES SUPPORTED! MapServer currently does not support SLD based rendering stlyes Some WMS servers charge a fee, which is again mentioned in the GetCapabilities returned XML document

15 4.2 Connect from Mapserver WMS Client
When there is a mapserver web application that requires connect to another server for obtaining certain layers and features, Mapserver WMS Client can be used. What is needed? Mapserver CGI compiled with WMS_CLIENT SUPPORT. When run in prompt, mapserver cgi should respond with a “Supports=WMS_CLIENT”. Mapfile,Templates definition similar to any other mapserver implementation. WMS Client Layer Definition ### RIVERS FROM TAMILNADU WMS SERVER### LAYER NAME riverscl TYPE POLYGON      STATUS ON      CONNECTIONTYPE WMS      CONNECTION " bin/mapserv?map=tnmap.map&VERSION=1.1.1&layers=rivers&TRANSPARENT=TRUE" METADATA      "wms_title" “Rivers"      "wms_name" “riverscl"      "wms_server_version" "1.1.1"      "wms_format" "image/jpeg"      "wms_srs" "EPSG: 4326" END END The layer definition above makes a WMS request to the TNMAPSERVER with a TNMAP.MAP for a rivers layer in Lat/Lon projection (EPSG code: 4326)

16 4.3 Connect from Arc Explorer
Here is a good documentation on the ArcExplorer connection, What steps are needed? The following steps are a synopsis of the documentation URL above: Get Capabilities - Use PHP to fake WMS compatibility (visit and follow instructions under Using PHP to fake WMS compliance) Download ArcExplorer - Java Edition from ESRI’s website Download the ArcExplorer Interoperability Extension for ArcExplorer Install ArcExplorer and then the extension in your computer Open ArcExplorer, and click on Interoperability->Connect to WMS Enter the URL to PHP file created in step 2, click ‘OK’ This should connect to the WMS Server and bring in all layers advertised by the WMS Server Just click on the checkbox next to a layer, to view layer

17 5. Web Feature Server (WFS)
According to Mapserver’s web site Web Feature Service or WFS is, “A WFS ( Web Feature Service ) publishes feature-level geospatial data to the web. This means that instead of returning an image, as MapServer has traditionally done, the client now obtains fine-grained information about specific geospatial features of the underlying data, at both the geometry AND attribute levels.” What is required? Mapserver compiled with PROJ or greater and GDAL or greater WFS parameters are also configured in the metadata information, follow instructions here, on how to set up MAP metadata and LAYER metadata. The WFS does not allow a layer to be advertised in more than one SRS. Mapserver implictly uses the top-level SRS for all the layers defined, or if the top-level is not present (like a map projection), then the individual layer SRSs’ are used. As indicated in the WFS Server How to, “As a rule of thumb, simply set the wfs_srs at the map level (in web metadata) and never set the wfs_srs metadata at the layer level and things will work fine for most cases”

18 6.WFS Client Implementation
A WFS client call can be made from a mapserver web application through a layer definition in the map file. What is needed? Mapserver compiled with WFS_CLIENT support , PROJ or higher, GDAL or higher libCurl 7.10 or higher Sample Layer Definition: LAYER NAME "mylayer" TYPE POINT CONNECTIONTYPE WFS CONNECTION " PROJECTION "init=epsg:4326" METADATA "wfs_connectiontimeout" "60" # Default is 30 seconds "wfs_latlonboundingbox" " " # Area covered by this layer END CLASS SYMBOL 'triangle' COLOR

19 7. Appendix Some useful URL(s)
WMS Cookbook - WMS How To - WMS Wiki - WFS - WFS Client How to - ACKNOWLEDGEMENTS: University of Minnesota – Mapserver Team, Developers and Users community that ever remain proactive in getting OpenGIS solutions work for community benefits.


Download ppt "University of Minnesota Mapserver WMS/WFS Documentation with Examples"

Similar presentations


Ads by Google