[mapserver-users] Cannot get my layer to render via WMS...
Jeff McKenna
jmckenna at gatewaygeomatics.com
Wed Mar 24 07:28:19 PDT 2010
mapper99 wrote:
> Here is a map file I have:
>
> MAP
>
> NAME "WMSTEST"
> EXTENT -91.409324 40.696301 -90.942253 41.074178
> SIZE 800 600
> IMAGECOLOR 255 255 255
>
> PROJECTION
> "init=epsg:4326"
> END
>
> WEB
> IMAGEPATH "/ms4w/tmp/ms_tmp/"
> IMAGEURL "/ms_tmp/"
> METADATA
> "wms_title" "WMS Test Server" ##required
> "wms_onlineresource"
> "http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&" ##required
> "wms_srs" "EPSG:4326" ##recommended
> END
> END
>
>
> LAYER
> NAME "test"
> EXTENT -91.409324 40.696301 -90.942253 41.074178
> METADATA
> "wms_title" "TestLayer" ##required
> END
>
> PROJECTION
> "init=epsg:4326" ##recommended
> END
>
> STATUS ON
> TYPE POLYGON
> CONNECTIONTYPE POSTGIS
> CONNECTION "host=127.0.0.1 port=5432 dbname=MarkGIS user=postgres
> password=theguy"
> DATA "geog FROM test USING SRID=4326 USING UNIQUE gid"
>
> CLASSITEM 'cousubfp00'
> CLASS
> NAME 'default'
> EXPRESSION ''
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 106 72 44
> END
> END
> CLASS
> NAME 'cousubfp00 = 90207'
> EXPRESSION '90207'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 130 86 84
> END
> END
> CLASS
> NAME 'cousubfp00 = 90401'
> EXPRESSION '90401'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 160 64 74
> END
> END
> CLASS
> NAME 'cousubfp00 = 90813'
> EXPRESSION '90813'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 137 230 122
> END
> END
> CLASS
> NAME 'cousubfp00 = 90887'
> EXPRESSION '90887'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 84 173 118
> END
> END
> CLASS
> NAME 'cousubfp00 = 90888'
> EXPRESSION '90888'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 149 106 236
> END
> END
> CLASS
> NAME 'cousubfp00 = 91347'
> EXPRESSION '91347'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 31 170 38
> END
> END
> CLASS
> NAME 'cousubfp00 = 91401'
> EXPRESSION '91401'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 64 29 27
> END
> END
> CLASS
> NAME 'cousubfp00 = 92010'
> EXPRESSION '92010'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 176 211 126
> END
> END
> CLASS
> NAME 'cousubfp00 = 92112'
> EXPRESSION '92112'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 116 167 107
> END
> END
> CLASS
> NAME 'cousubfp00 = 92906'
> EXPRESSION '92906'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 164 26 212
> END
> END
> CLASS
> NAME 'cousubfp00 = 92924'
> EXPRESSION '92924'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 94 224 133
> END
> END
> CLASS
> NAME 'cousubfp00 = 93390'
> EXPRESSION '93390'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 246 101 186
> END
> END
> CLASS
> NAME 'cousubfp00 = 94080'
> EXPRESSION '94080'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 161 96 208
> END
> END
> CLASS
> NAME 'cousubfp00 = 94203'
> EXPRESSION '94203'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 218 17 190
> END
> END
> CLASS
> NAME 'cousubfp00 = 94488'
> EXPRESSION '94488'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 93 61 209
> END
> END
> CLASS
> NAME 'cousubfp00 = 94658'
> EXPRESSION '94658'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 200 70 144
> END
> END
> CLASS
> NAME 'cousubfp00 = 94803'
> EXPRESSION '94803'
> STYLE
> SYMBOL 0
> OUTLINECOLOR 0 0 0
> COLOR 45 32 194
> END
> END
> CLASS
> OUTLINECOLOR 32 32 32
> END
> END
>
> END
>
> If I use this URL:
>
> http://localhost:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/mapfiles/testwms.map&layer=test&mode=map
>
> The map draws fine. If I try and consume this map via a WMS client like
> QGIS, the data does not draw. GetCapabilities appears to be fine:
>
> http://localhost:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/mapfiles/testwms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
>
> returns:
>
> <?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 5.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG
> 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 SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE -->
>
> <Service>
> <Name>OGC:WMS</Name>
> <Title>WMS Test Server</Title>
> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/>
> <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:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Post>
> </HTTP>
> </DCPType>
> </GetCapabilities>
> <GetMap>
> <Format>image/gif</Format>
> <Format>image/png</Format>
> <Format>image/png; mode=24bit</Format>
> <Format>image/jpeg</Format>
> <Format>image/vnd.wap.wbmp</Format>
> <Format>image/tiff</Format>
> <Format>image/svg+xml</Format>
> <DCPType>
> <HTTP>
> <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></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:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></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:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Post>
> </HTTP>
> </DCPType>
> </DescribeLayer>
> <GetLegendGraphic>
> <Format>image/gif</Format>
> <Format>image/png</Format>
> <Format>image/png; mode=24bit</Format>
> <Format>image/jpeg</Format>
> <Format>image/vnd.wap.wbmp</Format>
> <DCPType>
> <HTTP>
> <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></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:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></Get>
> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&"/></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>WMSTEST</Name>
> <Title>WMS Test Server</Title>
> <SRS>EPSG:4326</SRS>
> <LatLonBoundingBox minx="-91.4093" miny="40.6963" maxx="-90.9423"
> maxy="41.0742" />
> <BoundingBox SRS="EPSG:4326"
> minx="-91.4093" miny="40.6963" maxx="-90.9423"
> maxy="41.0742" />
> <Layer queryable="0" opaque="0" cascaded="0">
> <Name>test</Name>
> <Title>TestLayer</Title>
> <SRS>EPSG:4326</SRS>
> <LatLonBoundingBox minx="-3.40282e+038" miny="-3.40282e+038"
> maxx="3.40282e+038" maxy="3.40282e+038" />
> <BoundingBox SRS="EPSG:4326"
> minx="-3.40282e+038" miny="-3.40282e+038"
> maxx="3.40282e+038" maxy="3.40282e+038" />
> <Style>
> <Name>default</Name>
> <Title>default</Title>
> <LegendURL width="161" height="329">
> <Format>image/png</Format>
> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:type="simple"
> xlink:href="http://localhost:8080/cgi-bin/mapserv.exe?map=testwms.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=test&format=image/png&STYLE=default"/>
> </LegendURL>
> </Style>
> </Layer>
> </Layer>
> </Capability>
> </WMT_MS_Capabilities>
>
> But nothing draws in the map? What am I doing wrong here?
>
>
I think the step you are missing is to verify that your GetMap request
works. (manually generate a GetMap URL and try that in a browser, like
you did for your GetCapabilities request). Once you verify that that
manual GetMap works, then you should try to access your WMS layers in
various WMS clients (like QGIS).
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/
More information about the MapServer-users
mailing list