[mapserver-users] Is there a problem with layers when serving WMS?
Jeff Dege
jeff.dege at korterra.com
Fri Jun 25 08:19:57 PDT 2010
I loaded the map into an openlayers mapping website, zoomed until I saw the spurious labels. I then saved one of the 200x200 pixel tiles. I examined the saved tile, to confirm that the extra labels were present.
Then I used the openlayers lat/lon tool to identify the corners of the saved tile. I ran shp2img to create an image with a matching size and extent, using version MapServer Version 4.8.4 on Windows, and then again using MapServer version 5.6.1 on Ubuntu.
In both cases, the road geometry matched that of the tile I had saved. The labels, though, were very different. Using shp2img 4.8.4, the labels were closely aligned with the roads. Using shp2img 5.6.1, one of the labels was placed well away from the road feature that was associated with it, and one label appeared for a featured that didn't appear in the image at all.
The label specification I'm using:
LABEL
COLOR 175 140 29
OUTLINECOLOR 239 233 242
TYPE TRUETYPE
FONT vera-bold
SIZE 6
ANTIALIAS TRUE
ANGLE AUTO
POSITION AUTO
PARTIALS FALSE
MINDISTANCE 300
BUFFER 4
END
-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jeff McKenna
Sent: Friday, June 25, 2010 6:08 AM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Is there a problem with layers when serving WMS?
Jeff,
If I were you I would be degugging my mapfile with the shp2img
commandline utility. You can read the usual debugging steps at:
http://www.mapserver.org/optimization/debugging.html#step-5-test-your-mapfile
Also, if you are having problems with scales, you might want to create a
small mapfile with only that one problem scale (in other words remove
all scale parameters from mapfile) and then test with shp2img to make
sure your labels and features are drawn correctly.
Then once you have shp2img working good (you can also pass different
extents to the shp2img utility so that you can test your mapfile at
different extents/scales) you should then start testing your WMS service.
For testing a WMS service, the best way is to manually generate a
GetCapabilities URL in a browser, verify its response is valid, then
manually generate a GetMap URL in a browser for one layer. (this avoids
any issues with WMS clients like QGIS).
Once your manual URLs are working, then you can test in a WMS client,
such as QGIS.
(those debugging steps may be slow, but I do that for every WMS instance
I set up)
Have a great weekend.
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/
Jeff Dege wrote:
> I'm putting together a map via Mapserver and WMS (MapServer version
> 5.6.1 on Ubuntu 10.04), serving a set of shapefiles.
>
>
>
> The basic approach is to have a pair of layers for each class of
> highways - interstate, US highways, state highways, local roads, etc.
> One layer in each pair draws the geometry, the other draws the labels.
> In this way, the user can turn the labels on and off, as needed.
>
>
>
> I'm having a problem with highway labels showing up nowhere near where
> the highways are. At my outermost zoom, all I'm displaying is the major
> highway geometry and the interstate names. That works OK.
>
>
>
> When I zoom in a bit, to where I start displaying the US highway names,
> I see names all over the place, drawn where there are no geometries. I
> zoom in a bit more, and they go away. (I'm viewing this with Quantum
> GIS, loading the maps as WMS layers).
>
>
>
> To help track down what is going on, I took one of the names, did an
> "ogrinfo -where" to identify that there was, in fact, a featured with
> that name in the US highways shapefile. I then extracted just those
> features into a new shapefile, using ogr2ogr, and then loaded that as a
> vector layer in Quantum GIS. The aim was to find out where the feature
> that matched that name actually was.
>
>
>
> It was nowhere near the label. I set the new vector layer to draw in
> red, and it was easy to see. With a label from the WMS properly drawn
> alongside. But 75+ miles away, 600+ pixels across the map, was another
> label for that feature, nowhere near the feature it was supposed to be
> describing.
>
>
>
> I've never seen anything quite like this. But then, I'm just figuring
> out how to use mapserver to serve WMS.
>
>
>
> Are there any known "gotchas", when drawing label layers in WMS?
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list