I'm trying to display a text layer using MapServer, but I'm kind of confused how to get it to display properly.
When opening the .TAB file in a GIS application (in this case, MapInfo Profressional) the labels show up correctly. They all show up in the correct location with varying sizes and angles.
When looking at the output of MapServer for this layer, there are the following problems:
The layer is blank unless I set
STYLEITEM "AUTO" for the layer. If I try to set the style manually, the settings seem to be ignored.
When displaying the layer using
STYLEITEM "AUTO", all of the labels are rendered in the same font size and with no rotation.
Excerpt from the .map file is below (I've excluded other layers):
MAP NAME mymap IMAGETYPE PNG EXTENT 259997 100002 399997 160002 SIZE 550 450 SHAPEPATH "./" CONFIG "MS_ERRORFILE" "/var/log/mapserver/mymap_error.log" WEB LOG '/var/log/mapserver/mymap.log' METADATA WMS_TITLE "My WMS Title" wms_srs "EPSG:27700" wfs_srs "EPSG:27700" wfs_title "WFS Test" wfs_enable_request "*" ows_enable_request "*" wfs_onlineresource "http://[AN IP]/maps/vectors/mymap&" ows_onlineresource "http://[AN IP]/maps/vectors/mymap&" wfs_maxfeatures "50" END #METADATA END #WEB PROJECTION "init=epsg:27700" END #PROJECTION LAYER NAME "Mastermap_Text" DEBUG 2 METADATA "wfs_typename" "Mastermap_Text" wfs_title "Mastermap_Text" wfs_srs "EPSG:27700" gml_include_items "all" gml_featureid "PRN" wfs_enable_request "*" ows_enable_request "*" END #METADATA TYPE ANNOTATION STATUS OFF DUMP TRUE CONNECTIONTYPE OGR CONNECTION "/path/to/maps/vectors/Mastermap_Text.tab" STYLEITEM "AUTO" PROJECTION "init=epsg:27700" END #PROJECTION CLASS NAME "Mastermap_Text" END #CLASS END #LAYER
When trying to view this layer, I'm using an URL similar to:
http://[AN IP ADDRESS]/maps/vectors/mymap?LAYERS=Mastermap_Text&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A27700&BBOX=328800,146642,329680,147522&WIDTH=256&HEIGHT=256
As states, the above .map file results in an image of the text labels being generated, but they are all the same font size and they have no rotation.
If I remove the
STYLEITEM "AUTO" line and add a
STYLE block to the
SIZE attributes), I get a blank image.
Similarly, adding a
LABEL block with the respective styles also doesn't help.
What am I doing wrong?
Edit to add images:
Mastermap_Text layer viewed using MapInfo Professional
Mastermap_Text layer rendered by MapServer when using the above URL
Mastermap_Text layer generated by shp2img:
shp2img -m mymap.map -o test.png -l Mastermap_Text