[mapserver-users] Re: Problem with Class Expression

Marc-André D. qc_mad at hotmail.com
Fri Mar 30 06:17:43 PDT 2012


Here is my Mapfile and my log of the OGRINFO on my shapefile.
What I'm trying to do in this Mapfile is to show label with some specific
criteria:
- if the AREA(area in km²) is >= 1 then the scale of the label will be
between 1008 and 5008
- if the AREA (area in km²) is < 1 then the scale of the label will be less
than 1008.

What doesn't work:
- if I use the column'MA_NAD83' to show up the label is like this :
8989899525
  BUT, I would like to use the column 'MA_10_83' because the label is
8989-89-9525 and this doesn't work (and I don't know whyyy).
- It seems that MapServer is not able to draw my layers Superficie and
Numéro de lot because it can not reach the right columns ('SUP' and
'NO_LOT'). It's the same problem like the 'MA_10_83' (see above).
- The expression is not (always?!?!?) able to read the column 'AREA' and I
don't understand why?!?!?...

Thanks for your time & your help.


Mapfile
--------------
MAP
  NAME "Coaticook"
  SIZE 800 650
  STATUS ON

	CONFIG "MS_ERRORFILE" stderr
	DEBUG 5

  UNITS meters
  
  INCLUDE "../../mapping_globals.map"
  
   WEB
    METADATA
      'ows_title'           'M.R.C. Coaticook'
      'ows_srs'             'EPSG:26915 EPSG:900913 EPSG:32188 EPSG:4326'
    END
  END
  
  LEGEND
    LABEL
      TYPE TRUETYPE
      FONT vera_sans
      SIZE 8
      COLOR 0 0 0
     END
  END
  
	LAYER
    NAME 'ma_nad83'
    DATA '../440_MRC_Coaticook/44037_Coaticook/unite_eval.shp'
    STATUS ON
    TYPE ANNOTATION
	
	LABELITEM 'MA_NAD83'
	LABELCACHE ON
	
	CLASS
		NAME 'Matricule'
		EXPRESSION ([AREA] >= 1)
		MAXSCALEDENOM 5008
		MINSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION UC
			FORCE true
			ANTIALIAS true
		END #label
	END #class
	CLASS
		EXPRESSION ([AREA] < 1)
		MAXSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION UC
			FORCE true
			ANTIALIAS true
		END #label
	END #class
END #layer


LAYER
    NAME 'superficie'
    DATA '../440_MRC_Coaticook/44037_Coaticook/unite_eval.shp'
    STATUS ON
    TYPE ANNOTATION

	LABELITEM 'SUP'
	
	CLASS
		NAME 'Superficie' 
		EXPRESSION ([AREA] >= 1)
		MAXSCALEDENOM 5008
		MINSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION CC
			FORCE true
			OFFSET 0 5
			ANTIALIAS true
		END #label
	END #class
	CLASS
		EXPRESSION ([AREA] < 1)
		MAXSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION UC
			FORCE true
			ANTIALIAS true
		END #label
	END #class
	TRANSPARENCY 100
END #superficie

LAYER
    NAME 'No_lot'
    DATA '../440_MRC_Coaticook/44037_Coaticook/unite_eval.shp'
    STATUS ON
    TYPE ANNOTATION

	LABELITEM 'NO_LOT'

	CLASS
		NAME 'Numéro de lot' 
		EXPRESSION ([AREA] >= 1)
		MAXSCALEDENOM 5008
		MINSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION CC
			FORCE true
			OFFSET 0 -17
			ANTIALIAS true
		END #label
	END #class
	CLASS
		EXPRESSION ([AREA] < 1)
		MAXSCALEDENOM 1008
		LABEL
			FONT vera_sans
			TYPE TRUETYPE
			SIZE 8
			COLOR 0 0 0
			POSITION UC
			FORCE true
			ANTIALIAS true
		END #label
	END #class
	TRANSPARENCY 100
END #no_lot
	
END #map



OGRINFO on my shapefile
--------

grinfo unite_eval.shp -so unite_eval
INFO: Open of `unite_eval.shp'
      using driver `ESRI Shapefile' successful.

Layer name: unite_eval
Geometry: Polygon
Feature Count: 3761
Extent: (192047.087702, 4986264.383000) - (212561.941000, 5003229.285008)
Layer SRS WKT:
PROJCS["NAD_1983_MTM_7",
    GEOGCS["GCS_North_American_1983",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",304800.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",-70.5],
    PARAMETER["Scale_Factor",0.9999],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
ID: Real (11.0)
MATRICULE: String (16.0)
X_COORD: Real (18.5)
Y_COORD: Real (18.5)
NO_LOT: String (30.0)
ECHELLE: String (15.0)
MA_NAD83: String (10.0)
SOURCE: String (50.0)
ANGLELOT: Real (10.2)
ANGLE_MANU: String (1.0)
VERIF: String (10.0)
PROB_SUP: String (10.0)
PROB_NOLOT: String (10.0)
LEGVERIF: String (10.0)
MA_NAD27: String (16.0)
PSC_INDEX: Integer (7.0)
SUP: String (16.0)
X_COORD_1: Real (18.5)
Y_COORD_1: Real (18.5)
PSC_INDE_1: Integer (7.0)
AREA: Real (16.3)
PERIMETER: Real (16.3)
ACRES: Real (16.3)
HECTARES: Real (19.11)
X_COORD_12: Real (18.5)
Y_COORD_12: Real (18.5)
PSC_INDE_2: Integer (7.0)
FRONT: Real (16.2)
SUPERF_N: Real (16.1)
U_M_SUP: String (2.0)
U_M_FR: String (2.0)
MA_10_27: String (16.0)
MA_10_83: String (16.0)
PSC_INDE_3: Integer (7.0)
DATE: Date (10.0)
FEUILLET: String (50.0)
C1_NAD83: String (4.0)
C2_NAD83: String (7.0)
PSC_INDE_4: Integer (7.0)


-----
-----------------------------
Marc-André Dion
B.Sc Géomatique appliquée
Université de Sherbrooke
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Problem-with-Class-Expression-tp4668046p4671294.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list