ThinkGeo.com    |     Documentation    |     Premium Support

Full Extents of the map

Is there a method to obtain the Bounding Box of an entire overlay or of the entire map across all overlays? I suppose I would leverage the first option if I had a choice. Thanks.



Nelson,


I am afraid we don’t have that API, but you can do it by the following method.



private RectangleShape GetBoundingBox (Collection<Layer> layers)
{
    RectangleShape rectangleShape = null;
    foreach (Layer layer in layers)
    {
        if (layer.HasBoundingBox)
        {
            layer.Open();
if (rectangleShape == null)
            {
rectangleShape = layer.GetBoundingBox();
            }
            else
            {
rectangleShape.ExpandToInclude(layer.GetBoundingBox());
}
}
    }
return rectangleShape;
}


 


Also we have added it to our tracking system and consider adding it in the future.


Thanks,

ThinkGeo Support

 



Thank you, this works well.

You are welcome. 
  
 ThinkGeo Support