3

All of my shapefiles have exactly the same WKT. Using http://prj2epsg.org I have verified that EPSG:3059 has the same parameters as WKT definition of my shapefiles, so I'm using 3059 in my mapfile.

I want to know what changes I must make in my mapfile for my WMS service to work.

What I have tried:

  • I thought maybe epsg:3059 is not supported by my mapserver version 6.0.3. I checked file C:\MS4W\ms4w\proj\nad\epsg and 3059 is listed there. Still, I tried to convert the shapefile to different epsg, for example, 4326 and 3857. No success. I also tried setting up the newest stable Mapserver version 6.4.1. No success.

When I send GetCapabilities request...

http://localhost:1025/cgi-bin/mapserv.exe
?map=C:\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map
&SERVICE=WMS&VERSION=1.1.1%20
&REQUEST=GetCapabilities

I get a response XML document with no errors and warnings.


When I send a GetMap request...

http://localhost:1025/cgi-bin/mapserv.exe
?map=C:\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map
&SERVICE=WMS
&VERSION=1.1.1%20
&STYLES=
&REQUEST=GetMap
&LAYERS=lat_rob_region
&SRS=EPSG:3059%20
&BBOX=313187.4,146161.56,766469.92,470367.64
&WIDTH=800
&HEIGHT=600%20
&FORMAT=image/png

I get this message as response:

...
msWMSLoadGetMapParams(): WMS server error. Invalid SRS given : SRS must be valid for all requested layers.
...


If I access mapfile via browser, I can see the layer displayed correctly:

http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map&layer=lat_rob_region

mapfile2.map:

MAP

    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/Apache/htdocs/gis/tmp/log.txt"
    DEBUG 5
    NAME map
    STATUS ON
    SIZE 800 500
    EXTENT 313187.4 146161.56 766469.92 470367.64
    UNITS METERS
    SHAPEPATH "shapefiles3"
    IMAGECOLOR 155 155 155

    WEB
        TEMPLATE "MapServerCGI.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/gis/output/"
        IMAGEURL "/gis/output/"

        METADATA
            "wms_title"             "MapServer Openlayers testa aplikacija"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map"
            "wms_enable_request"    "*"
            "wms_srs"               "EPSG:3059"

        END
    END

    PROJECTION
        "init=epsg:3059"
    END

# lat_rob_region
    LAYER
        METADATA
            "wms_title"           "lat_rob_region"
            "wms_srs"             "EPSG:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "lat_rob_region"
            STYLE
                COLOR 0 255 0
            END
        END
    END

END

WKT definition:

PROJCS["GRS_1980_Transverse_Mercator",
GEOGCS["GCS_GRS_1980",
DATUM["D_GRS_1980",
SPHEROID["GRS_1980",6378137,298.257222101]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",500000],
PARAMETER["False_Northing",-6000000],
PARAMETER["Central_Meridian",24],
PARAMETER["Scale_Factor",0.9996],
PARAMETER["Latitude_Of_Origin",0],
UNIT["Meter",1]]

GetCapabilities.xml looks like this:

<?xml version='1.0' encoding="ISO-8859-1" 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.0.3 (MS4W 3.0.6) OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE 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>MapServer Openlayers testa aplikacija</Title>
  <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/>
  <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://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></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://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></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://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Post>
        </HTTP>
      </DCPType>
    </GetFeatureInfo>
    <DescribeLayer>
      <Format>text/xml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></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://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Post>
        </HTTP>
      </DCPType>
    </GetLegendGraphic>
    <GetStyles>
      <Format>text/xml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></Get>
          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;"/></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>karte</Name>
    <Title>MapServer Openlayers testa aplikacija</Title>
    <Abstract>karte</Abstract>
    <SRS>EPSG:3059</SRS>
    <LatLonBoundingBox minx="20.809" miny="55.3892" maxx="28.5475" maxy="58.3742" />
    <BoundingBox SRS="EPSG:3059"
                minx="313187" miny="146162" maxx="766470" maxy="470368" />
    <Layer queryable="0" opaque="0" cascaded="0">
        <Name>lat_rob_region</Name>
        <Title>lat_rob_region</Title>
        <SRS>EPSG:3059</SRS>
        <LatLonBoundingBox minx="20.829" miny="55.6313" maxx="28.4458" maxy="58.0913" />
        <BoundingBox SRS="EPSG:3059"
                    minx="312878" miny="172940" maxx="762571" maxy="438874" />
        <Style>
          <Name>default</Name>
          <Title>default</Title>
          <LegendURL width="119" height="21">
             <Format>image/png</Format>
             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&amp;version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=lat_rob_region&amp;format=image/png&amp;STYLE=default"/>
          </LegendURL>
        </Style>
    </Layer>
  </Layer>
</Capability>
</WMT_MS_Capabilities>

4 Answers 4

2
+100

I don't know why you have set EPSG:42304 as projection. This value is not defined in the SRS list or the EPSG registry.

EPSG:3059 has the same parameters as your WKT definition. You have to add it to your list of wms_srs to allow requests in that srs.


EDIT

Looking at your WMS request: Why do you send &SRS=EPSG:3059%20 ? Can you try without %20?

4
  • I have set EPSG:3059 to be both projection and SRS. Is that correct? Error message about SRS remains.
    – afaf12
    Commented Apr 13, 2014 at 18:06
  • I wasn't able to locate a source/author for 42304 other than a reference to a 'Chameleon' demo, but I did see several definitions that describe it as "NAD83 LCC for Canada", so that could be part of the problem.
    – Chris W
    Commented Apr 13, 2014 at 18:09
  • I have had no success with using EPSG:3059. Question is updated with details.
    – afaf12
    Commented Apr 21, 2014 at 22:33
  • You are right again, you should add that to your answer.
    – afaf12
    Commented Apr 23, 2014 at 4:17
1

&SRS=EPSG:3059%20

That %20 is an escaped white space. You need to get the white space out of the query string.

0

When I pasted your WKT into http://prj2epsg.org - it suggested a number of possible codes one of which is epsg:3059 another possible one is EPSG:25884 TM Baltic93.

But it looks like your problem is to do with your MapServer set up not the projection of the shapefile.

2
  • 1
    EPSG:25884 has +y_0=0 which might lead to wrong placement.
    – AndreJ
    Commented Apr 13, 2014 at 17:42
  • I switched to using epsg:3059 as both projection and SRS. Is that correct? Added a fragment of my mapfile to my question, see edit #2. I still get the same error about invalid SRS. And thank you for the useful link!
    – afaf12
    Commented Apr 13, 2014 at 18:01
0

Couple of suggestions: It would not harm to add projection block also to LAYER as

 PROJECTION    
 "init=epsg:3059"    
 END

Do you perhaps have other layers in you mapfile set to STATUS DEFAULT and missing some projection data? Could you show your whole mapfile, the one you pasted is probably a shortened version? By looking at the GetCapabilities it looks like you have configured the layer lat_rob_region to belong under group layer karte

I tried your mapfile modified slightly to suit my own shapefile and it did work for me so there should not be anything fundamentally wrong with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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