WMS GetMap request error with width en height parameters

595
2
08-06-2012 11:16 PM
Labels (1)
martindevos
New Contributor II
According to the IOS/OGC WMS 1.3.0  specification the width and height parameters of the GetMap function are integers.
The ArcGIS Server Web API's are calling this GetMap function with floating point values for width and height.
Some WMS service providers that follow the specification correctly are having trouble with these floating point numbers where integers are expected.  Is there a way to make the API's do this request with integers for the width and height parameters in stead of floats ?
0 Kudos
2 Replies
AnttiKajanus1
Occasional Contributor III
Interesting since the WmsLayer's GetUrl-method takes height and width as a integers and the values are added to the query string from integers

public override void GetUrl(ESRI.ArcGIS.Client.Geometry.Envelope extent, int width, int height,
   DynamicMapServiceLayer.OnUrlComplete onComplete)
  {
   int extentWKID = (extent.SpatialReference != null) ? extent.SpatialReference.WKID : 0;
   string baseUrl = MapUrl ?? Url;
   StringBuilder mapURL = new StringBuilder(baseUrl);


   if (!baseUrl.Contains("?"))
    mapURL.Append("?");
   else if (!baseUrl.EndsWith("&"))
    mapURL.Append("&");
   mapURL.Append("SERVICE=WMS&REQUEST=GetMap");
   mapURL.AppendFormat("&WIDTH={0}", width);
   mapURL.AppendFormat("&HEIGHT={0}", height);
<Snip>

Did I miss something here?
0 Kudos
martindevos
New Contributor II
Interesting since the WmsLayer's GetUrl-method takes height and width as a integers and the values are added to the query string from integers

public override void GetUrl(ESRI.ArcGIS.Client.Geometry.Envelope extent, int width, int height,
   DynamicMapServiceLayer.OnUrlComplete onComplete)
  {
   int extentWKID = (extent.SpatialReference != null) ? extent.SpatialReference.WKID : 0;
   string baseUrl = MapUrl ?? Url;
   StringBuilder mapURL = new StringBuilder(baseUrl);


   if (!baseUrl.Contains("?"))
    mapURL.Append("?");
   else if (!baseUrl.EndsWith("&"))
    mapURL.Append("&");
   mapURL.Append("SERVICE=WMS&REQUEST=GetMap");
   mapURL.AppendFormat("&WIDTH={0}", width);
   mapURL.AppendFormat("&HEIGHT={0}", height);
<Snip>

Did I miss something here?



If you run the sample from arcgis.com :
http://help.arcgis.com/en/webapi/javascript/arcgis/demos/layers/layers_wms.html
then the request that gets generated and sent by the api is :
http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServ...

As you can see, the width and height are not integers (as demanded by the specification).
Now, the arcgis sample server deals with these decimal numbers, but other service proveders don't.
For instance if i use the api on this service :
http://wms.agiv.be/inspire/wms/administratieve_eenheden?SERVICE=WMS&REQUEST=GetCapabilities&version=...
then the generated reques is :
http://wms.agiv.be/inspire/wms/administratieve_eenheden?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&...
which gives me a blank screen.
If i remove the decimal fractions in width and height then i get a correct image.


Guys, Sorry for the above, this problem only occurs in the javascript API (which I use for testing) and not in the WPF API.  Sorry.
0 Kudos