I'm connecting to a WMS server and found that the longitudes LatLonBoundingBox specified for some of the values are slightly outside of the +/-180 range (such as 180.05). Are these values considered valid (I couldn't find anything in the schema that seemed to enforcer a range)?

If they are valid, should they be treated as rounding errors (maybe the values were auto generated) and clamped to +/-180, or should they be normalized in the +/-180 range, so 180.05 might become -179.95?

Also note that in this particular case, the parent layer's bounds are listed as -90/90 and -180/180.


  • You will run into problems trying to enforce a [-180,+180] range for longitudes of bounding boxes. This issue is examined in detail in another thread. – whuber Jan 16 '12 at 20:07

You need to distinguish between LatLonBoundingBox and BoundingBox,

The bounds of a BoundingBox are limited by the SRS definition, there's no need to restrict yourself to degrees.

The LatLonBoundingBox is intended as a guide for searches, there is no requirement for the LatLonBoundingBox to be a bounding box that accurately encompasses the data.

As you say the schema (well DTD) only defines the attributes for the LatLonBoundingBox and a hint to what the values should be like:

<!-- The LatLonBoundingBox attributes indicate the edges of the enclosing
rectangle in latitude/longitude decimal degrees (as in SRS EPSG:4326 [WGS1984 lat/lon]). -->

<!ELEMENT LatLonBoundingBox EMPTY>
<!ATTLIST LatLonBoundingBox 
      minx CDATA #REQUIRED
      miny CDATA #REQUIRED
      maxx CDATA #REQUIRED
      maxy CDATA #REQUIRED> 

We know that EPSG:4326 has defined bounds of -180 -90 +180 +90, so values of 180.05 aren't correct, but a parser wouldn't find an error.

With WMS 1.3.0 we get XML schema that more strictly constrain the values (the actual element names have changed but they serve the same purpose):

<element name="EX_GeographicBoundingBox">
<documentation>The EX_GeographicBoundingBox attributes indicate the limits of the enclosing rectangle in longitude and latitude decimal degrees.
<element name="westBoundLongitude" type="wms:longitudeType"/>
<element name="eastBoundLongitude" type="wms:longitudeType"/>
<element name="southBoundLatitude" type="wms:latitudeType"/>
<element name="northBoundLatitude" type="wms:latitudeType"/>

<simpleType name="longitudeType">
    <restriction base="double">
        <minInclusive value="-180"/>
        <maxInclusive value="180"/>
<simpleType name="latitudeType">
    <restriction base="double">
        <minInclusive value="-90"/>
        <maxInclusive value="90"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.