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

Martin, Daniel DMartin at erac.com
Tue Jul 23 17:32:52 EDT 2002


This is a known bug with Mapinfo OGR layers.  It is listed in bugzilla,
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=168

What I've been doing as a workaround is creating two layers, one with
STYLEITEM "auto" and the other is a TYPE Annotation.  If you give them both
the same name, they turn off and on together.

-Dan

-----Original Message-----
From: Alex Rice [mailto:alex_rice at arc.to]
Sent: Tuesday, July 23, 2002 1:33 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] labeling question w/ OGR styleitem "auto"


Hi, I am using STYLEITEM "AUTO"
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/INDDI
ST.
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/INDDI
ST.
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/INDDI
ST.
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