Annotation trouble within mapscript

Jean-Denis Giguere jdenisgiguere at FASTMAIL.FM
Wed Mar 2 14:32:07 PST 2005


Hi !

I have trouble with an annotation layer using python mapscript.

This layer is drawn without trouble using mapserv cgi. I have no error
message when I try to draw it with mapscript, but I get no label. The
annotation layer is routesEti. Following the related part of the script
and mapfile.

Any hint would be really appreciated.

Regards,

Jean-Denis

*** Script

#Mapfile
mapfile = "../../mapserv/mapfile/sbk-demo.map"

#La cartographic object
carto = mapscript.mapObj(mapfile)

#Map
carte = carto.prepareImage()

#Layer to draw
aAfficher = []
aAfficher.append("routes")
aAfficher.append("rivieres")
aAfficher.append("batiments")
aAfficher.append("parcs")
aAfficher.append("routesEti")

for nm in aAfficher:
         layer = carto.getLayerByName(nm)
         layer.status = mapscript.MS_ON
         layer.draw(carto, carte)

#Name of map
prefix = "/home/data/www/geodemo/tmp/"
nomCarte = carto.name
nomFichCarte = '%s%s.%s' % (prefix, nomCarte, carto.outputformat.extension)

#Write map
carte.save(nomFichCarte)

#Access file
accesCarte = "/tmp/%s.%s" % (nomCarte, carto.outputformat.extension)

***

*** Mapfile

LAYER
     NAME "routesEti"
     CONNECTIONTYPE postgis
     CONNECTION "dbname=sbk-demo"
     DATA "wkb_geometry from (SELECT nom_rue, gen_rue,
collect(wkb_geometry) as wkb_geometry FROM troncons GROUP BY nom_rue,
gen_rue) as foo using SRID=32187 using unique nom_rue"
     STATUS ON
     TYPE annotation

     METADATA
         "wms_title" "Routes"
     END

     #CLASS
     #  EXPRESSION ( '[vitesse]' = '80')
     #  NAME "Voie rapide"
     #  STYLE
     #  END
     #END
     CLASS
       NAME "Boulevards"
       EXPRESSION ( '[gen_rue]' = 'BOULEVARD')
       #TEXT ([nom_rue])
       TEXT "Boulevard"
       LABEL
         ANGLE auto
         ANTIALIAS true
         POSITION auto
         TYPE truetype
         FONT 'vera-bold'
         SIZE 8
         BUFFER 4
       END
     END
     CLASS
       NAME "Routes"
       TEXT ([nom_rue])
       LABEL
         ANGLE AUTO
         TYPE truetype
         FONT 'vera'
         SIZE 8
         OFFSET -6 -6
         BUFFER 4
       END
     END
   END

***

Jean-Denis Giguère
Étudiant en géomatique
appliquée à l'environnement
Stagiaire à l'Agence de développement
de réseaux locaux de services de santé
et de services sociaux de l'Estrie
Tél. 829-3400 42008
Courriel. jdenisgiguere at fastmail.fm



More information about the MapServer-users mailing list