Skip to main content
3 of 5
added 2061 characters in body
afaf12
  • 84
  • 2
  • 15

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, 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
afaf12
  • 84
  • 2
  • 15