Select to view content in your preferred language

WmsLayer is set to the wrong extent

1084
2
01-20-2012 08:26 AM
ZachPride
Emerging Contributor
Hello again!

In the process of investigating alternative layer types, I've tried using the WmsLayer to help handle the messiness of constructing GetMap URLs. I have layers in a GeoServer instance, set up a proxy handler & everything is working great. There is one curious thing however is the Extent property is getting set incorrectly. What is really curious is that not only is it incorrect but is actually the extent of another layer in my GeoServer!

My coordinate system for everything is EPSG:4326 and other zoom to extent operations on other layers work just fine. It's only the WmsLayers I make from my GeoServer that always get this one extent. I suppose this could actually be a GeoServer error? My layers listed in a GetCapabilities call all have unique and appropriate bounding boxes... Why would it just pick this one as a default before knowing what Layers I choose to load?
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
Could you share the URl of your Wms service (or if private, the GetCapabilities result) ?

This would be helpful for us.

Thanks.
0 Kudos
ZachPride
Emerging Contributor
Apologies for the late response - I took the weekend off 😄

The response is quite large and unfortunately still private but I think I can offer a scrubbed transcript:
[HTML]<?xml version="1.0" encoding="UTF-8"?>
<WMS_Capabilities version="1.3.0" updateSequence="437" xmlns="http://www.opengis.net/wms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wms http://domain:port/geoserver/schemas/wms/1.3.0/capabilities_1_3_0.xsd">
  <Service>
    <Name>WMS</Name>
    <Title>GeoServer Web Map Service</Title>
    <Abstract>A compliant implementation of WMS plus most of the SLD extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
    <KeywordList>
      <Keyword>WFS</Keyword>
      <Keyword>WMS</Keyword>
      <Keyword>GEOSERVER</Keyword>
    </KeywordList>
    <OnlineResource xlink:type="simple" xlink:href="http://geoserver.sourceforge.net/html/index.php"/>
    <ContactInformation>
      <ContactPersonPrimary>
        <ContactPerson></ContactPerson>
        <ContactOrganization></ContactOrganization>
      </ContactPersonPrimary>
      <ContactPosition></ContactPosition>
      <ContactAddress>
        <AddressType></AddressType>
        <Address></Address>
        <City></City>
        <StateOrProvince></StateOrProvince>
        <PostCode></PostCode>
        <Country></Country>
      </ContactAddress>
      <ContactVoiceTelephone/>
      <ContactFacsimileTelephone/>
      <ContactElectronicMailAddress/>
    </ContactInformation>
    <Fees>NONE</Fees>
    <AccessConstraints>NONE</AccessConstraints>
  </Service>
  <Capability>
    <Request>
      <GetCapabilities>
        <Format>text/xml</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&"/>
            </Get>
            <Post>
              <OnlineResource xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&"/>
            </Post>
          </HTTP>
        </DCPType>
      </GetCapabilities>
      <GetMap>
        <Format>image/png</Format>
        <Format>application/atom+xml</Format>
        <Format>application/pdf</Format>
        <Format>application/vnd.google-earth.kml+xml</Format>
        <Format>application/vnd.google-earth.kmz</Format>
        <Format>image/gif</Format>
        <Format>image/jpeg</Format>
        <Format>image/svg+xml</Format>
        <Format>image/tiff</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&"/>
            </Get>
          </HTTP>
        </DCPType>
      </GetMap>
      <GetFeatureInfo>
        <Format>text/plain</Format>
        <Format>application/vnd.ogc.gml</Format>
        <Format>text/html</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&"/>
            </Get>
          </HTTP>
        </DCPType>
      </GetFeatureInfo>
    </Request>
    <Exception>
      <Format>XML</Format>
      <Format>INIMAGE</Format>
      <Format>BLANK</Format>
    </Exception>
    <Layer>
      <Title>GeoServer Web Map Service</Title>
      <Abstract>A compliant implementation of WMS plus most of the SLD extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
      <CRS>AUTO:42001</CRS>
  <!-- A lot of these -->
  <!-- ... -->
      <CRS>EPSG:42303</CRS>
      <CRS>CRS:84</CRS>
      <EX_GeographicBoundingBox>
        <westBoundLongitude>-180.0</westBoundLongitude>
        <eastBoundLongitude>760774.181</eastBoundLongitude>
        <southBoundLatitude>-90.0</southBoundLatitude>
        <northBoundLatitude>4472358.007</northBoundLatitude>
      </EX_GeographicBoundingBox>
      <Layer queryable="1">
        <Name>af:AF_Districts_polygon</Name>
        <Title>AF_Districts_polygon</Title>
        <Abstract/>
        <KeywordList>
          <Keyword>afghan</Keyword>
          <Keyword>district</Keyword>
        </KeywordList>
        <CRS>EPSG:4326</CRS>
        <CRS>CRS:84</CRS>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>60.505</westBoundLongitude>
          <eastBoundLongitude>74.894</eastBoundLongitude>
          <southBoundLatitude>29.362</southBoundLatitude>
          <northBoundLatitude>38.491</northBoundLatitude>
        </EX_GeographicBoundingBox>
        <BoundingBox CRS="EPSG:4326" minx="29.362" miny="60.505" maxx="38.491" maxy="74.894"/>
        <Style>
          <Name>polygon</Name>
          <Title>Default Polygon</Title>
          <Abstract>A sample style that draws a polygon</Abstract>
          <LegendURL width="20" height="20">
            <Format>image/png</Format>
            <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&he..."/>
          </LegendURL>
        </Style>
      </Layer>
      <Layer queryable="1">
        <Name>sa:Active-Global-FireHotspot</Name>
        <Title>Active-Global-FireHotspot</Title>
        <Abstract/>
        <KeywordList>
          <Keyword>fire</Keyword>
          <Keyword>global</Keyword>
        </KeywordList>
        <CRS>EPSG:4326</CRS>
        <CRS>CRS:84</CRS>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>-175.069</westBoundLongitude>
          <eastBoundLongitude>168.14</eastBoundLongitude>
          <southBoundLatitude>-50.795</southBoundLatitude>
          <northBoundLatitude>55.03</northBoundLatitude>
        </EX_GeographicBoundingBox>
        <BoundingBox CRS="EPSG:4326" minx="-50.795" miny="-175.069" maxx="55.03" maxy="168.14"/>
        <Attribution>
          <Title>MODIS Global Fire Web Mapping Service</Title>
          <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://firefly.geog.umd.edu/firms/shapes.htm"/>
        </Attribution>
        <Style>
          <Name>point</Name>
          <Title>Default Point</Title>
          <Abstract>A sample style that draws a point</Abstract>
          <LegendURL width="20" height="20">
            <Format>image/png</Format>
            <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&he..."/>
          </LegendURL>
        </Style>
      </Layer>
      <Layer queryable="1">
        <Name>africa:africa</Name>
        <Title>africa</Title>
        <Abstract/>
        <KeywordList/>
        <CRS>EPSG:4326</CRS>
        <CRS>CRS:84</CRS>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>-17.537</westBoundLongitude>
          <eastBoundLongitude>51.413</eastBoundLongitude>
          <southBoundLatitude>-46.97</southBoundLatitude>
          <northBoundLatitude>37.539</northBoundLatitude>
        </EX_GeographicBoundingBox>
        <BoundingBox CRS="EPSG:4326" minx="-46.97" miny="-17.537" maxx="37.539" maxy="51.413"/>
        <Style>
          <Name>polygon</Name>
          <Title>Default Polygon</Title>
          <Abstract>A sample style that draws a polygon</Abstract>
          <LegendURL width="20" height="20">
            <Format>image/png</Format>
            <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://domain:port/geoserver/ows?SERVICE=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&he..."/>
          </LegendURL>
        </Style>
      </Layer>
   <!-- And so on... -->
    </Layer>
  </Capability>
</WMS_Capabilities>
[/HTML]

Apologies again for the verbose response, I tried to cut things out I think are in no way relevant to this. The issue I'm seeing is that no matter which layer I specify in the WmsLayers.Layers property, the Extent that it uses is always the first layer in this response - here af:AF_Districts_polygon. I just tried and experiment and disabled that layer, which made sa:Active-Global-FireHotspot the "first" layer and now the extent is always its bounds. I might be overestimating what the WmsLayer is capable of but I was hoping that it could use these WMS requests to fetch the bounding box for whatever layer I choose from the list - is this not the case?
0 Kudos