[mapserver-users] labeling question w/ OGR styleitem "auto"

Alex Rice alex_rice at arc.to
Tue Jul 23 11:33:05 PDT 2002


Hi, I am using STYLEITEM "AUTO"  with some Mapinfo files and it's 
working fantastically well. However, I can't get labels to 
render. The legend shows a white rectangle with a single pixel in 
the middle of it.
However, if I remove the "auto" layer for labels and add a layer 
with a manually defined class for the labels, then they render.  
The OGR demo apps which are at dmsolutions.ca appear to just use 
STYLEITEM "AUTO" and the labels magically render.  What am I 
doing wrong? I am using the stock symbols_mapinfo.sym which is 
recommended for starting with. Here is the layer format, ogrinfo 
output:

Layer name: INDDIST
Geometry: Polygon
Feature Count: 467
Extent: (68.123077, 8.030642) - (97.338745, 37.052483)
Layer SRS WKT:
GEOGCS["unnamed",
     DATUM["MIF 0",
         SPHEROID["WGS 84 (MAPINFO Datum 0)",6378137.01,298.257223563],
         TOWGS84[0,0,0,0,0,0,0]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433]]
Dist_name: String (37.0)
Dist_HQ: String (40.0)
Dist_area: Real (13.2)
OGRFeature(INDDIST):1
   Dist_name (String) = Adilabad
   Dist_HQ (String) = Adilabad
   Dist_area (Real) =      16105.00
   Style = BRUSH(fc:#fff4d0,bc:#ffffff,id:"mapinfo-brush-2.ogr-
brush-0");PEN(w:1p
x,c:#000000,id:"mapinfo-pen-2.ogr-pen-0")
   POLYGON ((...))
...

Here is the relevant parts of my mapfile:
--
SYMBOLSET "/Users/alex/Sites/mapserver/symbols/symbols_mapinfo.sym"  
...
LAYER
   NAME "INDDIST"
   TYPE POLYGON
   STATUS DEFAULT
   CONNECTIONTYPE OGR
   CONNECTION 
"/Users/alex/Sites/mapserver/apps/tutorial/mapinfo/Map_Data/Asia/India/INDDIST.
TAB"
   STYLEITEM "AUTO"
   CLASS
      NAME "Districts"
   END
END # Layer

LAYER # districts labels
   NAME "INDDIST"
   TYPE ANNOTATION
   CONNECTIONTYPE OGR
   CONNECTION 
"/Users/alex/Sites/mapserver/apps/tutorial/mapinfo/Map_Data/Asia/India/INDDIST.
TAB"
   STATUS DEFAULT
   STYLEITEM "AUTO"
   LABELITEM "Dist_name"
   CLASS
   	Name "Dist_name"
   END # class
END # layer
  
--
So with the above mapfile layers, I see the regions nicely 
rendered and colored, but not labeled. If I change the layer for 
districts labels to the following, then the labels render.

LAYER # districts labels
   NAME "INDDIST"
   TYPE ANNOTATION
   CONNECTIONTYPE OGR
   CONNECTION 
"/Users/alex/Sites/mapserver/apps/tutorial/mapinfo/Map_Data/Asia/India/INDDIST.
TAB"
   STATUS DEFAULT
   LABELITEM "Dist_name"
   CLASS
      NAME "District Name"
	 COLOR -1 -1 -1
    	 LABEL
       	COLOR 0 0 0
       	SHADOWCOLOR 218 218 218
       	SHADOWSIZE 2 2
      	 TYPE BITMAP
      	 SIZE MEDIUM
      	 POSITION CC
      	 PARTIALS FALSE
      	 BUFFER 2
    	 END # label
   END # class
END # layer  
--

TIA

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alex_rice at arc.to
alrice at swcp.com





More information about the MapServer-users mailing list