Skip to main content
Notice removed Draw attention by afaf12
Bounty Ended with AndreJ's answer chosen by afaf12
Tweeted twitter.com/#!/StackGIS/status/458489270790291456
Notice added Draw attention by afaf12
Bounty Started worth 100 reputation by afaf12
Removed unnecessary information, added code examples to the end of the document.
Source Link
afaf12
  • 84
  • 2
  • 15

Which projection correspondsshould I use to get my shapefilesWMS service to work?

 

All of my shapefiles have exactly the same WKT.prj files with this content 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.

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]]

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

I want to know what changesWhat I must make to these two lines in my mapfile, for it to fit my shapefileshave 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...

"wms_srs"             "EPSGhttp:4269 EPSG//localhost:4326"1025/cgi-bin/mapserv.exe
"init=epsg?map=C:42304"\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map
&SERVICE=WMS&VERSION=1.1.1%20
&REQUEST=GetCapabilities

my mapfile2.map looks like this:I get a response XML document with no errors and warnings.


When I send a GetMap request...

MAP
    # mapfile prieks MapServer + Openlayers testa aplikacijas

    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvijas_karte
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"           "MapServer Openlayers demo application"
            "wms_onlineresource"  "httphttp://localhost:1025/cgi-bin/mapserv.exe
?map=C:\MS4W\ms4w\apps\gis\mapfile2\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map&"
            "wms_srs"             "EPSG:4269 EPSG:4326"
            # "wms_enable_request"
        END
    END

    PROJECTION
        "init=epsg:42304"
    END
    
# example layer
    LAYERmap
        METADATA&SERVICE=WMS
            "wms_title"           "example layer"&VERSION=1.1.1%20
            "wms_srs"             "EPSG:4269 EPSG:4326"&STYLES=
        END&REQUEST=GetMap
        PROJECTION&LAYERS=lat_rob_region
            "init=epsg&SRS=EPSG:42304"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS DEFAULT
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 03059%20
            END&BBOX=313187.4,146161.56,766469.92,470367.64
        END&WIDTH=800
    END&HEIGHT=600%20
END&FORMAT=image/png

Edit #1:

I tried using EPSG:3059 (LKS92 / Latvia TM), since the maps are Latvian. Accessing http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&SERVICE=WMS&VERSION=1.1.1%20&REQUEST=GetCapabilities gave me an XML document which describes the WMS, no error messages.

Now when I try to test my WMS viaget this linkmessage as response: http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&SERVICE=WMS&VERSION=1.1.1%20&REQUEST=GetMap&LAYERS=lat_rob_region&STYLES=&SRS=EPSG:3059%20&BBOX=313187.4,146161.56,766469.92,470367.64&WIDTH=800&HEIGHT=600%20&FORMAT=image/png

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


If I get this error messageaccess mapfile via browser, I can see the layer displayed correctly:

msWMSLoadGetMapParams()http: WMS server error//localhost:1025/cgi-bin/mapserv. Invalid SRS given exe?map=C:
SRS must be valid for all requested layers\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map&layer=lat_rob_region

I can't figure out what epsg code to use.

Edit #2, changed wms_srs and init, according to suggestions:mapfile2.map:

MAP 

    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/appsApache/htdocs/gis/tmp/ms_errorlog.txt"
    DEBUG 5
    NAME latvija_mapmap
    STATUS ON
    SIZE 800 500
 
    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles""shapefiles3"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template"MapServerCGI.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/gis/output/"
        IMAGEURL "/gis/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demotesta application"aplikacija"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\apps\gis\mapfile2\MS4W/ms4w/Apache/htdocs/gis/mapfile2.map&"
            "wms_srs"               "EPSG:3059"map"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
          "wms_srs"  "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"END
            STYLE
                COLOR 0 255 0PROJECTION
            END"init=epsg:3059"
        END
    END 

# Largest riverslat_rob_region
    LAYER
        METADATA
            "wms_title"           "largest rivers layer""lat_rob_region"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region""lat_rob_region"
        DATA lat_upld_regionlat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes""lat_rob_region"
            STYLE
                COLOR 0 0 255 0
            END
        END
    END 

END

edit #3WKT definition: I tried converting my shapefiles with QGis. I converted them to WGS 84, EPSG: 4326 . I also tried some other shapefiles which were EPSG: 4326 already. Error remains:

msWMSLoadGetMapParams(): WMS server errorPROJCS["GRS_1980_Transverse_Mercator",
GEOGCS["GCS_GRS_1980",
DATUM["D_GRS_1980",
SPHEROID["GRS_1980",6378137,298. Invalid SRS given :257222101]],
SRS must be valid for all requested layersPRIMEM["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]]
 

I uploaded an archive with some shapefiles, in case someone wants to have a look. ContentsGetCapabilities.xml looks like this:

3059<?xml version='1.0' encoding="ISO-8859-1" onestandalone="no" shapefile?>
<!DOCTYPE asWMT_MS_Capabilities ISYSTEM got"http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"
 it[
 <!ELEMENT VendorSpecificCapabilities EMPTY>
 ]>  <!-- end of DOCTYPE declaration -->

<WMT_MS_Capabilities version="1.1.1">
3059_to_4326
<!-- 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>
 same shapefile,<Name>OGC:WMS</Name>
 converted with<Title>MapServer QGisOpenlayers testa aplikacija</Title>
4326  <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;"/>
 different shapefile,<ContactInformation>
 untouched by</ContactInformation>
</Service>

<Capability>
 me <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>

It is hosted here: http://www.filedropper.com/shapefiles

Which projection corresponds to my shapefiles?

All of my shapefiles have exactly the same .prj files with this content:

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]]

I want to know what changes I must make to these two lines in my mapfile, for it to fit my shapefiles:

"wms_srs"             "EPSG:4269 EPSG:4326"
"init=epsg:42304"

my mapfile2.map looks like this:

MAP
    # mapfile prieks MapServer + Openlayers testa aplikacijas

    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvijas_karte
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"           "MapServer Openlayers demo application"
            "wms_onlineresource"  "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"             "EPSG:4269 EPSG:4326"
            # "wms_enable_request"
        END
    END

    PROJECTION
        "init=epsg:42304"
    END
    
# example layer
    LAYER
        METADATA
            "wms_title"           "example layer"
            "wms_srs"             "EPSG:4269 EPSG:4326"
        END
        PROJECTION
            "init=epsg:42304"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS DEFAULT
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END
END

Edit #1:

I tried using EPSG:3059 (LKS92 / Latvia TM), since the maps are Latvian. Accessing http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&SERVICE=WMS&VERSION=1.1.1%20&REQUEST=GetCapabilities gave me an XML document which describes the WMS, no error messages.

Now when I try to test my WMS via this link: http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&SERVICE=WMS&VERSION=1.1.1%20&REQUEST=GetMap&LAYERS=lat_rob_region&STYLES=&SRS=EPSG:3059%20&BBOX=313187.4,146161.56,766469.92,470367.64&WIDTH=800&HEIGHT=600%20&FORMAT=image/png

I get this error message:

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

I can't figure out what epsg code to use.

Edit #2, changed wms_srs and init, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500
 
    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

END

edit #3: I tried converting my shapefiles with QGis. I converted them to WGS 84, EPSG: 4326 . I also tried some other shapefiles which were EPSG: 4326 already. Error remains:

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

I uploaded an archive with some shapefiles, in case someone wants to have a look. Contents:

3059 - one shapefile as I got it.
3059_to_4326 - same shapefile, converted with QGis
4326 - different shapefile, untouched by me.

It is hosted here: http://www.filedropper.com/shapefiles

Which projection should I use to get my WMS service to work?

 

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>
added 413 characters in body
Source Link
afaf12
  • 84
  • 2
  • 15
msWMSLoadGetMapParams(): WMS server error. Invalid SRS given :  
SRS must be valid for all requested layers. I can't figure out what epsg code to use.

I can't figure out what epsg code to use.


Edit #2, changed wms_srs and init, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

END

edit #3: I tried converting my shapefiles with QGis. I converted them to WGS 84, EPSG: 4326 . I also tried some other shapefiles which were EPSG: 4326 already. Error remains:

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

I uploaded an archive with some shapefiles, in case someone wants to have a look. Contents:

3059 - one shapefile as I got it.
3059_to_4326 - same shapefile, converted with QGis
4326 - different shapefile, untouched by me.

It is hosted here: http://www.filedropper.com/shapefiles

msWMSLoadGetMapParams(): WMS server error. Invalid SRS given : SRS must be valid for all requested layers. I can't figure out what epsg code to use.

Edit #2, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

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

I can't figure out what epsg code to use.


Edit #2, changed wms_srs and init, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

END

edit #3: I tried converting my shapefiles with QGis. I converted them to WGS 84, EPSG: 4326 . I also tried some other shapefiles which were EPSG: 4326 already. Error remains:

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

I uploaded an archive with some shapefiles, in case someone wants to have a look. Contents:

3059 - one shapefile as I got it.
3059_to_4326 - same shapefile, converted with QGis
4326 - different shapefile, untouched by me.

It is hosted here: http://www.filedropper.com/shapefiles

added 2061 characters in body
Source Link
afaf12
  • 84
  • 2
  • 15

Edit #2, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

END

Edit #2, according to suggestions:

MAP
    CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/apps/gis/tmp/ms_error.txt"
    DEBUG 5
    NAME latvija_map
    STATUS ON
    SIZE 800 500

    EXTENT 313187.4 146161.56 766469.92 470367.64
    
    UNITS METERS
    SHAPEPATH "shapefiles"
    IMAGECOLOR 155 155 155
   
    WEB
        TEMPLATE "template.html"
        IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
        IMAGEURL "/output/"
        
        METADATA
            "wms_title"             "MapServer Openlayers demo application"
            "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv?map=C:\MS4W\ms4w\apps\gis\mapfile2.map&"
            "wms_srs"               "EPSG:3059"
            "wms_enable_request"    "*"
        END
    END

    PROJECTION
        "init=epsg:3059"
    END
    
# Latvia body
    LAYER
        METADATA
            "wms_title"           "body layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_rob_region"
        DATA lat_rob_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "fons"
            STYLE
                COLOR 0 255 0
            END
        END
    END 

# Largest rivers
    LAYER
        METADATA
            "wms_title"           "largest rivers layer"
            "wms_srs"             "EPSG:3059"
        END
        PROJECTION
            "init=epsg:3059"
        END
        NAME "lat_upld_region"
        DATA lat_upld_region
        STATUS ON
        TYPE POLYGON
        CLASS
            NAME "upes"
            STYLE
                COLOR 0 0 255
            END
        END
    END 

END
added 806 characters in body
Source Link
afaf12
  • 84
  • 2
  • 15
Loading
Source Link
afaf12
  • 84
  • 2
  • 15
Loading