[mapserver-users] php/mapscript. error in getlayerbyname

Andrea Giacomelli andreag at crs4.it
Tue Feb 5 11:46:23 EST 2002


I am porting (finally!) my old apps to 3.5, and I am gradually ironing
out some of the issues in the transition from 3.4

I have a .map file which is processed properly by php/mapscript (if I
just request a $map->draw() it is ok.

However I get a problem with getLayerByName: this is ok with some of the
layers, but returns an error with some of the others.

=========================
Warning: MapServer Error in : in c:\data\htdocs/mia/if/htdocs/t.php on
line 7

Fatal error: getLayerByName failed for : s1 in
c:\data\htdocs/mia/if/htdocs/t.php on line 7
======================

Maybe I am missing something in the .map file translation ?

TIA and regards,

-- 

Andrea Giacomelli
-------------- next part --------------
# configurazione mappa per prototipo if webgis - dicembre 2001 - a. giacomelli
NAME DEMO
STATUS ON
SIZE 370 370
SYMBOLSET ../etc/symbols.sym
#EXTENT 1400000 4300000 1580000 4580000
EXTENT 1360000 4300000 1650000 4580000
UNITS METERS
SHAPEPATH "c:\users\andreag\if\data" # IFWEB ? la directory corrispondente a IF_DATA nella relazione
IMAGECOLOR 224 255 255
FONTSET ../etc/fonts.txt

#LABELOVERLAP FALSE

#
# Start of web interface definition
#
WEB
#
# On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the root 
# of the drive where the .MAP file resides.
#
  IMAGEPATH "c:\data\htdocs\tmp\"
  IMAGEURL "c:\data\htdocs\tmp\"
  LOG "gmap.log"
END

#
# Start of reference map
#
REFERENCE
   IMAGE images/reference.gif
   EXTENT 1360000 4300000 1650000 4580000
   STATUS ON
  COLOR -1 -1 -1
#  COLOR 224 255 255
  OUTLINECOLOR 255 0 0
  SIZE 120 120      
END
#
# Start of legend
#
LEGEND
  KEYSIZE 18 12
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS ON
END

#
# Start of scalebar
#
SCALEBAR
#  IMAGECOLOR 255 0 0
#  IMAGECOLOR -1 -1 -1
  LABEL
    COLOR 0 0 0 
    SIZE SMALL
  END
  SIZE 150 5
#  COLOR 255 255 255
#  COLOR -1 -1 -1
#  IMAGECOLOR -1 -1 -1
  BACKGROUNDCOLOR 255 255 255
  OUTLINECOLOR 0 0 255
  UNITS kilometers
  INTERVALS 5
#ifw  STATUS EMBED
  TRANSPARENT TRUE
  STYLE 0
END

#
# Start of layer definitions
#

LAYER
  NAME "la"
###v5      DESCRIPTION "Limammdec"
  TYPE POLYGON
  STATUS ON
  DATA comuni
  CLASS
    NAME "Limamm class_name"
    COLOR 200 245 220
    OUTLINECOLOR 150 200 20
  END
END # layer

LAYER
#  SYMBOLSCALE 2000000
  NAME "lo"
###v5  DESCRIPTION "Localita'"
  TYPE POINT
  STATUS ON
  DATA loc
  LABELITEM "Comune"
  LABELMAXSCALE 500000
  CLASS
#    EXPRESSION "[LABIDX] < 100"
    SYMBOL 7
    SIZE 3
    NAME "Localita'"
   COLOR 0 0 0
   LABEL
     TYPE TRUETYPE
     OFFSET 20 20
     COLOR  0 0 200
     BUFFER 4
     FONT arial
     MINSIZE 8
     MAXSIZE 20
     FORCE TRUE
   END
  END
  TOLERANCEUNITS meters
  TOLERANCE 1000
  HEADER "Istat Comune"
###v5  QUERYITEM "Istat"
###v5  QUERY
###v5   EXPRESSION /./
###v5   TEMPLATE "Istat"
  END
END # Layer


LAYER
  SYMBOLSCALE 200000
  NAME "s1"
###v5  DESCRIPTION "dati_1"
  TYPE POINT
  STATUS ON
  DATA loc # Nota: come sopra per s0
  CLASS
    MINSIZE 2
    MAXSIZE 30
    SYMBOL 3
    SIZE 10
    NAME "s11"
   COLOR 255 0 0
   LABEL
     FORCE TRUE
     OFFSET 10 10
     COLOR 0 10 0
     TYPE TRUETYPE
     FONT arial
     MINSIZE 8
     MAXSIZE 20
   END
  END
  TOLERANCE 5
END # LAYER


LAYER
  SYMBOLSCALE 200000
  NAME "s0"
###v5  DESCRIPTION "dati_centrali"
  TYPE POINT
  STATUS ON
  DATA loc # N.B. Il layer viene creato vuoto, e poi "popolato" tramite query al database
  CLASS
#    MINSIZE 2
#    MAXSIZE 20
    SYMBOL 4
    SIZE 20
    NAME "s00"
   COLOR 255 0 255
   LABEL
     FORCE TRUE
     OFFSET -10 -10
     COLOR 255 0 255
     TYPE TRUETYPE
     FONT arial
     MINSIZE 8
     MAXSIZE 20
   END
  END
  TOLERANCE 5
END #layer




END # end map file


More information about the mapserver-users mailing list