C# Class SharpMap.Web.Wms.WmsServer

This is a helper class designed to make it easy to create a WMS Service
显示文件 Open project: jumpinjackie/fdotoolbox

Public Methods

Method Description
ParseQueryString ( SharpMap map, Capabilities description ) : void

Generates a WMS 1.3.0 compliant response based on a SharpMap.Map and the current HttpRequest.

The Web Map Server implementation in SharpMap requires v1.3.0 compatible clients, and support the basic operations "GetCapabilities" and "GetMap" as required by the WMS v1.3.0 specification. SharpMap does not support the optional GetFeatureInfo operation for querying.

Creating a WMS server in ASP.NET is very simple using the classes in the SharpMap.Web.Wms namespace. void page_load(object o, EventArgs e) { //Get the path of this page string url = (Request.Url.Query.Length>0?Request.Url.AbsoluteUri.Replace(Request.Url.Query,""):Request.Url.AbsoluteUri); SharpMap.Web.Wms.Capabilities.WmsServiceDescription description = new SharpMap.Web.Wms.Capabilities.WmsServiceDescription("Acme Corp. Map Server", url); // The following service descriptions below are not strictly required by the WMS specification. // Narrative description and keywords providing additional information description.Abstract = "Map Server maintained by Acme Corporation. Contact: [email protected]. High-quality maps showing roadrunner nests and possible ambush locations."; description.Keywords.Add("bird"); description.Keywords.Add("roadrunner"); description.Keywords.Add("ambush"); //Contact information description.ContactInformation.PersonPrimary.Person = "John Doe"; description.ContactInformation.PersonPrimary.Organisation = "Acme Inc"; description.ContactInformation.Address.AddressType = "postal"; description.ContactInformation.Address.Country = "Neverland"; description.ContactInformation.VoiceTelephone = "1-800-WE DO MAPS"; //Impose WMS constraints description.MaxWidth = 1000; //Set image request size width description.MaxHeight = 500; //Set image request size height //Call method that sets up the map //We just add a dummy-size, since the wms requests will set the image-size SharpMap.Map myMap = MapHelper.InitializeMap(new System.Drawing.Size(1,1)); //Parse the request and create a response SharpMap.Web.Wms.WmsServer.ParseQueryString(myMap,description); }

Private Methods

Method Description
GetEncoderInfo ( String mimeType ) : System.Drawing.Imaging.ImageCodecInfo

Used for setting up output format of image file

ParseBBOX ( string strBBOX ) : SharpMap.Geometries.BoundingBox

Parses a boundingbox string to a boundingbox geometry from the format minx,miny,maxx,maxy. Returns null if the format is invalid

Method Details

ParseQueryString() public static method

Generates a WMS 1.3.0 compliant response based on a SharpMap.Map and the current HttpRequest.

The Web Map Server implementation in SharpMap requires v1.3.0 compatible clients, and support the basic operations "GetCapabilities" and "GetMap" as required by the WMS v1.3.0 specification. SharpMap does not support the optional GetFeatureInfo operation for querying.

Creating a WMS server in ASP.NET is very simple using the classes in the SharpMap.Web.Wms namespace. void page_load(object o, EventArgs e) { //Get the path of this page string url = (Request.Url.Query.Length>0?Request.Url.AbsoluteUri.Replace(Request.Url.Query,""):Request.Url.AbsoluteUri); SharpMap.Web.Wms.Capabilities.WmsServiceDescription description = new SharpMap.Web.Wms.Capabilities.WmsServiceDescription("Acme Corp. Map Server", url); // The following service descriptions below are not strictly required by the WMS specification. // Narrative description and keywords providing additional information description.Abstract = "Map Server maintained by Acme Corporation. Contact: [email protected]. High-quality maps showing roadrunner nests and possible ambush locations."; description.Keywords.Add("bird"); description.Keywords.Add("roadrunner"); description.Keywords.Add("ambush"); //Contact information description.ContactInformation.PersonPrimary.Person = "John Doe"; description.ContactInformation.PersonPrimary.Organisation = "Acme Inc"; description.ContactInformation.Address.AddressType = "postal"; description.ContactInformation.Address.Country = "Neverland"; description.ContactInformation.VoiceTelephone = "1-800-WE DO MAPS"; //Impose WMS constraints description.MaxWidth = 1000; //Set image request size width description.MaxHeight = 500; //Set image request size height //Call method that sets up the map //We just add a dummy-size, since the wms requests will set the image-size SharpMap.Map myMap = MapHelper.InitializeMap(new System.Drawing.Size(1,1)); //Parse the request and create a response SharpMap.Web.Wms.WmsServer.ParseQueryString(myMap,description); }
public static ParseQueryString ( SharpMap map, Capabilities description ) : void
map SharpMap Map to serve on WMS
description Capabilities Description of map service
return void