Bug report #10634

WMS provider: Cannot calculate extent

Added by dr - over 6 years ago. Updated almost 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Web Services clients/WMS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:duplicate
Crashes QGIS or corrupts data:No Copied to github as #:19037

Description

I have local MapServer-based WMS server which can send data in two SRS: EPSG:4326 and EPSG:3857. When I add layer using SRS EPSG:4326 all works fine, but when I try to add layer using SRS EPSG:3857 I get error message:

WMS provider: Cannot calculate extent
Raster layer: Provider is not valid (provider: wms, URI: crs=EPSG:3857&dpiMode=2&featureCount=10&format=image/png&layers=building&styles=&url=http://192.168.250.105/cgi-bin/wms?VERSION%3D1.1.1

In QGIS 1.8 this WMS-layer works fine with both SRS.

Example of map-file:

MAP

  NAME "Vega WMS Server" 

  SYMBOLSET         "symbols/symbols.sym" 
  FONTSET           "fonts/fonts.list" 

  OUTPUTFORMAT
      NAME          "png" 
      EXTENSION     "png" 
      MIMETYPE      "image/png" 
      DRIVER         AGG/PNG
      IMAGEMODE      RGBA
      FORMATOPTION  "INTERLACE=OFF" 
  END

  PROJECTION
      "init=epsg:3857" 
  END

  WEB
    METADATA
      "wms_title"          "WMS Demo Server for MapServer" 
      "wms_onlineresource" "http://10.22.0.9/cgi-bin/mapserv?map=/home/rykovd/wms/wms.map&" 
      "wms_srs"            "EPSG:4326 EPSG:3857" 
      "wms_abstract"       "Saint Petersburg demo WMS" 
      "wms_enable_request" "*" 
      "wms_encoding"       "utf-8" 
     END
  END

  LAYER
    NAME "building" 
    METADATA
      "wms_title"          "Building" 
      "gml_include_items"  "all" 
      "wms_enable_request" "*" 
      "wms_extent"         "3277518.64189396 8321348.77352887 3420433.60980062 8453918.88750861" 
    END
    TEMPLATE dummy.html
    TYPE POLYGON
    CONNECTIONTYPE  postgis
    CONNECTION     "user=pguser password=topsecret dbname=dbvega host=localhost" 
    DATA           "webmercator from building_polygon" 
    CLASS
        STYLE
            COLOR        206 154 156
            OUTLINECOLOR 106 106 106
        END
    END
  END

END

Related issues

Related to QGIS Application - Bug report #14589: GetCapabilities gets cached in a confusing way (even when... Closed 2016-03-29

History

#1 Updated by dr - over 6 years ago

GetCapabilities response:

<?xml version='1.0' encoding="utf-8" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd" 
 [
 <!ELEMENT VendorSpecificCapabilities EMPTY>
 ]>  <!-- end of DOCTYPE declaration -->

<WMT_MS_Capabilities version="1.1.1">

<!-- MapServer version 6.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->

<Service>
  <Name>OGC:WMS</Name>
  <Title>WMS Demo Server for MapServer</Title>
  <Abstract>Saint Petersburg demo WMS</Abstract>
  <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/>
  <ContactInformation>
  </ContactInformation>
</Service>

<Capability>
  <Request>
    <GetCapabilities>
      <Format>application/vnd.ogc.wms_xml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </GetCapabilities>
    <GetMap>
      <Format>image/png</Format>
      <Format>image/jpeg</Format>
      <Format>image/gif</Format>
      <Format>image/png; mode=8bit</Format>
      <Format>application/x-pdf</Format>
      <Format>image/svg+xml</Format>
      <Format>image/tiff</Format>
      <Format>application/vnd.google-earth.kml+xml</Format>
      <Format>application/vnd.google-earth.kmz</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </GetMap>
    <GetFeatureInfo>
      <Format>text/plain</Format>
      <Format>application/vnd.ogc.gml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </GetFeatureInfo>
    <DescribeLayer>
      <Format>text/xml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </DescribeLayer>
    <GetLegendGraphic>
      <Format>image/png</Format>
      <Format>image/jpeg</Format>
      <Format>image/gif</Format>
      <Format>image/png; mode=8bit</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </GetLegendGraphic>
    <GetStyles>
      <Format>text/xml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.250.105/cgi-bin/wms?"/></Post>
        </HTTP>
      </DCPType>
    </GetStyles>
  </Request>
  <Exception>
    <Format>application/vnd.ogc.se_xml</Format>
    <Format>application/vnd.ogc.se_inimage</Format>
    <Format>application/vnd.ogc.se_blank</Format>
  </Exception>
  <VendorSpecificCapabilities />
  <UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0"/>
  <Layer>
<!-- WARNING: The layer name 'Vega WMS Server' might contain spaces or invalid characters or may start with a number. This could lead to potential problems. -->
    <Name>Vega WMS Server</Name>
    <Title>WMS Demo Server for MapServer</Title>
    <Abstract>Saint Petersburg demo WMS</Abstract>
    <SRS>EPSG:4326</SRS>
    <SRS>EPSG:3857</SRS>
    <LatLonBoundingBox minx="-8.98315e-06" miny="-8.98315e-06" maxx="-8.98315e-06" maxy="-8.98315e-06" />
    <BoundingBox SRS="EPSG:3857" 
                minx="-1" miny="-1" maxx="-1" maxy="-1" />

    <Layer queryable="1" opaque="0" cascaded="0">
        <Name>building</Name>
        <Title>Building</Title>
        <LatLonBoundingBox minx="29.4425" miny="59.646" maxx="30.7263" maxy="60.2425" />
        <BoundingBox SRS="EPSG:3857" 
                    minx="3.27752e+06" miny="8.32135e+06" maxx="3.42043e+06" maxy="8.45392e+06" />
    </Layer>

  </Layer>
</Capability>
</WMT_MS_Capabilities>

#2 Updated by dr - over 6 years ago

I've fixed my problem by manually adding the following option for root MAP object of map-file:

EXTENT            3.27621e+06 8.31941e+06 3.42256e+06 8.45391e+06

In this case MapServer returns correct values of LatLonBoundingBox and BoundingBox of root Layer element of GetCapabilities response. But it is not clear for me why QGIS uses values of these options if values of LatLonBoundingBox and BoundingBox for each inner Layer element are correct?

#3 Updated by Luis Fajardo about 5 years ago

I have same problem with QGIS 2.4.0 on Debian 8 trying to add any of the following WMS services:

This is part of the capability response:

<SRS>EPSG:32628</SRS>
<SRS>EPSG:4326</SRS>
<SRS>EPSG:32627</SRS>
<LatLonBoundingBox minx="-18.4913" miny="26.582" maxx="-13.0688" maxy="30.4726"/>
<BoundingBox SRS="EPSG:32628" minx="164622" miny="2.94455e+06" maxx="685418" maxy="3.37115e+06"/>

Is it a problem with QGis or should I complain for the server configuration?

In the while, dr, what dou you mean with adding an option "for root MAP object of map-file"? What file should I edit? How can I add such an option?

Sincerely,
Luis.

P.S.: The following is the whole capability response I get from server:

<!-- end of DOCTYPE declaration -->
<WMT_MS_Capabilities version="1.1.1"><!-- MapServer 5.0 vg 1.6 GRAFCAN 2008 -->
 <Service>
  <Name>OGC:WMS</Name>
  <Title>IDECanarias Ordenación de Espacios Naturales Protegidos</Title>
  <Abstract>Ordenación de Espacios Naturales Protegidos. Propiedad del Gobierno de Canarias.</Abstract>
  <KeywordList> 
   <Keyword>WMS</Keyword>
   <Keyword>CLASIFICACION</Keyword>
   <Keyword> ZONIFICACION</Keyword>
   <Keyword>EENNPP</Keyword>
   <Keyword> ESPACIOS NATURALES PROTEGIDOS</Keyword>
   <Keyword>CANARIAS</Keyword>
   <Keyword>GRAFCAN</Keyword>
   <Keyword>CANARY</Keyword>
   <Keyword>ISLANDS</Keyword>
   <Keyword>PLANNING</Keyword>
  </KeywordList>
  <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
  <ContactInformation>
   <ContactPersonPrimary>
    <ContactPerson/> 
    <ContactOrganization>Cartografica de Canarias S.A. (GRAFCAN)</ContactOrganization>
   </ContactPersonPrimary>
   <ContactElectronicMailAddress>[email protected]</ContactElectronicMailAddress>
  </ContactInformation>
  <Fees>none</Fees>
  <AccessConstraints>Acceso libre. Prohibido el uso comercial y la descarga masiva de información.</AccessConstraints>
 </Service>
 <Capability>
  <Request>
   <GetCapabilities>
    <Format>application/vnd.ogc.wms_xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </GetCapabilities>
   <GetMap> 
    <Format>image/png</Format>
    <Format>image/gif</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </GetMap>
   <GetFeatureInfo>
    <Format>text/html</Format>
    <Format>text/plain</Format>
    <Format>application/vnd.ogc.gml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </GetFeatureInfo>
   <DescribeLayer>
    <Format>text/xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </DescribeLayer>
   <GetLegendGraphic>
    <Format>image/png</Format>
    <Format>image/gif</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </GetLegendGraphic>
   <GetStyles>
    <Format>text/xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Get>
      <Post>
       <OnlineResource xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?"/>
      </Post>
     </HTTP>
    </DCPType>
   </GetStyles>
  </Request>
  <Exception>
   <Format>application/vnd.ogc.se_xml</Format>
   <Format>application/vnd.ogc.se_inimage</Format>
   <Format>application/vnd.ogc.se_blank</Format>
  </Exception>
  <VendorSpecificCapabilities/>
  <UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0"/>
  <Layer>
   <Name>WMS_ENP_ORD</Name>
   <Title>IDECanarias Ordenación de Espacios Naturales Protegidos</Title>
   <SRS>EPSG:32628</SRS>
   <SRS>EPSG:4326</SRS>
   <SRS>EPSG:32627</SRS>
   <LatLonBoundingBox minx="-18.4913" miny="26.582" maxx="-13.0688" maxy="30.4726"/>
   <BoundingBox SRS="EPSG:32628" minx="164622" miny="2.94455e+06" maxx="685418" maxy="3.37115e+06"/>
   <Layer queryable="1" opaque="0" cascaded="0">
    <Name>ENP</Name>
    <Title>Ordenación de Espacios Naturales</Title>
    <SRS>EPSG:32628</SRS>
    <LatLonBoundingBox minx="-17.9545" miny="27.9866" maxx="-14.012" maxy="28.8333"/>
    <BoundingBox SRS="EPSG:32628" minx="211615" miny="3.09918e+06" maxx="596387" maxy="3.18952e+06"/>
    <Style>
     <Name>default</Name>
     <Title>default</Title>
     <LegendURL width="20" height="10">
      <Format>image/png</Format>
      <OnlineResource xlink:type="simple" xlink:href="http://idecan2.grafcan.es/ServicioWMS/ENP_ORD?version=1.1.1&service=WMS&request=GetLegendGraphic&layer=ENP&format=image/png"/>
     </LegendURL>
    </Style>
    <ScaleHint min="24.9456413243303" max="0"/>
    <!-- WARNING: Only MINSCALEDENOM and no MAXSCALEDENOM specified in the mapfile. A default value of 0 has been returned for the Max ScaleHint but this is probably not what you want. 
 -->
   </Layer>
  </Layer>
 </Capability>
</WMT_MS_Capabilities>

#4 Updated by Matthias Kuhn over 4 years ago

Happened to me with a QGIS server where the project title and the file name were different.
Once the file was renamed, it would properly load.

#5 Updated by Giovanni Manghi over 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#6 Updated by Giovanni Manghi about 3 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

see also #14589-15

#7 Updated by Giovanni Manghi almost 3 years ago

  • Resolution set to duplicate
  • Status changed from Feedback to Closed

This is (was) a caching problem, should be ok an all the latest releases.

Also available in: Atom PDF