ThinkGeo.com    |     Documentation    |     Premium Support

V10 - WmsRasterLayer BoundingBox Discrepency

MapSuite,

I’m displaying a WmsRasterLayer in my client. There seems to be a discrepancy between the BoundingBox that is returned in GetCapabilities and the BoundingBox returned from the MapSuite GetBoundingBox method.

The following is from the GetCapabilities:

                <SRS>EPSG:3857</SRS>
                <BoundingBox maxx="-9680596.758261003" minx="-10123931.52231503" maxy="5250306.598852193" miny="4602120.598993891" SRS="EPSG:3857"/>

The following is what is returned from TheWmsRasterLayer.GetBoundingBox()
{-20037508.3427892,19971868.8804085,20037508.3427892,-19971868.8804086}

The MapUnit is set to Meter.

I would think these two BoundingBox values should be the same.

What are your thoughts?

Thanks,
Dennis

Hi Dennis,

In fact in our test sample you can see the GetBoundingBox return the value in capability file.

But I remembered some capability maybe contains many group valid bounding box, so please show us your server, so we can look into it.

Regards,

Ethan

hi Ethan,

The Capabilities of my WMS provider are quite large with many BoundingBox entries.

It would appear that the BoundingBox that is being returned corresponds to the first occurrence that matches only the projection of the loaded layer. However, it does not match the layer name itself.

The projection of my layer is EPSG:3857, of which there are many entries in the Capabilities…

I have emailed support@ThinkGeo.com with the Capabilities file attached.

Thanks,
Dennis

Hi Dennis,

We checked the mailbox, it looks we still hadn’t received that.

Maybe you can also upload that via our FTP or share in some network disk so we can download it.

Regards,

Ethan

Ethan,

I uploaded the Capabilities to my ThinkGeo customer upload website. You will find it at:
OriStarMapping/DiskStation2/home/Temp.

Dennis

Hi Dennis,

We get the capability file, it looks the file contains so many boundingbox and layer nested in layer, I am not sure whether it’s a standard format, our developer will look into it.

And because it’s not a online file, we need to build a special test project for parse it, please also let us know your code so we can know what’s the parameter you chosen.

Regards,

Ethan

hi Ethan,

Yes, the Capabilities that my WMS provider returns is quite complex.

The Capabilities has BoundingBox for the entire United States, for each individual US State, and then for each Projection of each US State. Plus like you said it has nested layers.

Since I was only loading the US State of ILL I had expected to see a BoundingBox that corresponded to only ILL.

If I were to load two US States would it be reasonable to expect that the BoundingBox would be comprised of the RectangleShape within which the two states are contained?

Below is the basic code that I’m using.

Thanks,
Dennis

WmsRasterLayer.ActiveLayerNames.Add(@“NearMap\United_States_of_America\ILL”);
WmsRasterLayer.Crs = “EPSG:3857”;
WmsRasterLayer.OutputFormat = “image/jpeg”;

WmsRasterLayer.Open();

TheServerCapabilitiesXml = WmsRasterLayer.GetServerCapabilitiesXml();

RectangleShape = WmsRasterLayer.GetBoundingBox();

Hi Dennis,

Thanks for your information, we review that today, it looks the value is parsed correct in server side, but the WmsRasterLayer.GetBoundingBox() only return the entire bounding-box for the root layer, if the root layer don’t contains a valid bounding-box, it will combine all child bounding-box.

We tired to find a workaround for you but failed.

Our developers will discuss about this to make sure whether we can do something for your requirement, because that should be big change for the format.

If you need that now, please use regular or indexofstring to find that from “TheServerCapabilitiesXml”.

Any discuss update I will let you know.

Regards,

Ethan

hi Ethan,

My concern about the GetBoundingBox method not returning an accurate BoundingBox is that it may adversely affect the overall operation of the application.

I’m capable to extracting, from the Capabilities, the BoundingBox for the layer and then using it as needed. But what is MapSuite doing in it’s own space with a BoundingBox that does not match the actual layer(s).

Thanks,
Dennis

Hi Dennis,

Our developers and managers discuss that today, this should be a design but not a bug.

The parameter for WMS server is only been sent to remote WMS server, for WMSLayer we only get all entire bounding box because we think it’s a whole. We tried also to find a workaround in our code but it looks we had’t found a solution to introduce the child layer and maintain the conception completely at the same time, so I think we won’t modify API about it.

Please try the code as below to get what you want:

 WmsRasterLayer wmsRasterLayer = new WmsRasterLayer(new Uri("Your Server"));
        wmsRasterLayer.ActiveLayerNames.Add(@"NearMap\United_States_of_America\ILL");
        wmsRasterLayer.Crs = "EPSG:3857";
        wmsRasterLayer.OutputFormat = "image/jpeg";

        wmsRasterLayer.Open();

        string TheServerCapabilitiesXml = wmsRasterLayer.GetServerCapabilitiesXml();

        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.LoadXml(TheServerCapabilitiesXml);

        string layerName = "NearMap\\United_States_of_America\\ILL";
        string SRS = "EPSG:3857";

        XmlNode xpathLayerRootNode = xmlDocument.SelectSingleNode("/WMT_MS_Capabilities/Capability/Layer");
        string xpathBBOXNode = "//Name[text()='" + layerName + "']/following-sibling::BoundingBox[@SRS='" + SRS + "']";

        XmlNode bboxNode = xpathLayerRootNode.SelectNodes(xpathBBOXNode)[0];

        RectangleShape rect = new RectangleShape(Double.Parse(bboxNode.Attributes[1].Value),
            Double.Parse(bboxNode.Attributes[2].Value),
            Double.Parse(bboxNode.Attributes[0].Value),
            Double.Parse(bboxNode.Attributes[3].Value));

Wish that’s helpful.

Regards,

Ethan

Ethan,

Thanks for the information.

Dennis

Hi Dennis,

Any question please let us know.

Regards,

Ethan