problem with mapscript PointObj method Draw
eric BELENFANT
eric.belenfant at AC-ORLEANS-TOURS.FR
Fri Dec 10 10:32:20 PST 2004
Hello,
I use php Mapscript 4.2 under linux 9.
I try adding a point on the map like this :
// DRAW MAP AND SET GEO EXTENT (IN MAP UNITS) IN SID FOR SUBSEQUENT ZOOM
ACTIONS //
$mapimg = $map->draw();
// ECRIT LES ETABLISSEMENTS AYANT DES FORMATIONS SUR LA CARTE
writeFormations($map,$mapimg,'%','400');//ne marche pas impossible d'écrire
le point avec le symbole
$couche=$map->getLayerByName("commune_symboles");
$monpoint = ms_newPointObj();
$monpoint->setXY(600000,220000);
$monpoint->draw($map,$couche,$mapimg,0,"");
I can't just see this point and the symbol i want to add with.
It gets on my nerves !!
If you could help me it would be nice !
Here is my .map file
MAP
#######################################################################
# EXTENTS
#######################################################################
# FRANCE
#EXTENT 47531.670814 1618389.142847 1197599.772331 2677338.195481
# ACADEMIE ORLEANS TOURS
EXTENT 426931.766796 2149441.377593 659404.715011 2438768.654693
#UNITS meters
SIZE 450 450
#SHAPEPATH "data"
SYMBOLSET "demodata/symbols/symbols35.sym"
FONTSET "/outils/httpd-2.0.52/htdocs/tutorial/fonts/fonts.list"
#
# Start of web interface definition
#
WEB
TEMPLATE "map.phtml"
IMAGEPATH "/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
END # Metadata
LOG /tmp/mapscript.log
END # Web
#
# Start of Reference map definition
#
REFERENCE
EXTENT 426931.766796 2149441.377593 659404.715011 2438768.654693
IMAGE "images/academie.gif"
SIZE 178 133
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
END # Reference
LEGEND
END
#
# Start of ScaleBar definition
#
SCALEBAR
INTERVALS 4
SIZE 200 3
UNITS kilometers
COLOR 250 250 250
OUTLINECOLOR 0 0 0
BACKGROUNDCOLOR 100 100 100
STYLE 0
POSTLABELCACHE true
TRANSPARENT ON
LABEL
COLOR 255 255 255
OUTLINECOLOR 0 0 0
SIZE small
END # Label
END # Reference
# SYMBOLS USED IN PMAPPER
# - 'circle' always necessary (used e.g. for highlight)
# - 'square' used in currecnt map file
# Symbols can also be defined via tag SYMBOLSET (see above)
Symbol
Name 'circle'
Type ELLIPSE
Filled TRUE
Points
1 1
END
END
Symbol
Name 'square'
Type VECTOR
Filled TRUE
Points
0 1
0 0
1 0
1 1
0 1
END
END
#================== START OF LAYER SECTION =====================#
#
# CALQUE DES Départements
#
LAYER
NAME "departement"
TYPE POLYGON
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "data/F_dept.TAB"
METADATA
"DESCRIPTION" "|||Départements"
"RESULT_FIELDS" "CODE_DEPART,NOM,POPSDC,SUPERFICIE_KM2"
"RESULT_HEADERS" "|||Code,Nom,Population,Superficie (km2)"
END
LABELITEM "NOM"
CLASS
NAME "HORS ACADEMIE"
OUTLINECOLOR 100 100 100
COLOR 235 235 235
EXPRESSION ('[CODE_DEPART]' != '18' and '[CODE_DEPART]' != '28' and
'[CODE_DEPART]' != '36' and '[CODE_DEPART]'!='37' and '[CODE_DEPART]'!='41'
and '[CODE_DEPART]'!='45')
TEMPLATE void
LABEL
COLOR 120 120 120
#BACKGROUNDCOLOR 200 200 100
POSITION CC
TYPE truetype
FONT arial
SIZE 7
END
END
CLASS
NAME "ACADEMIE d'Orléans Tours"
OUTLINECOLOR 100 100 100
#COLOR 136 151 173 # A UTILISER POUR GENERER LA CARTE DE REFERENCE
COLOR 249 179 99
EXPRESSION ('[CODE_DEPART]' = '18' or '[CODE_DEPART]' = '28' or
'[CODE_DEPART]' = '36' or '[CODE_DEPART]'='37' or '[CODE_DEPART]'='41' or
'[CODE_DEPART]'='45')
TEMPLATE void
#LABEL
#COLOR 0 0 0
#BACKGROUNDCOLOR 200 200 100
#POSITION CC
#TYPE truetype
#FONT arial
#SIZE 7
#END
END
END
#
# CALQUES DES COMMUNES
#
LAYER
NAME "chefsLieux"
TYPE POLYGON
GROUP "communes"
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "data/communes_eric.TAB"
METADATA
"DESCRIPTION" "|||Communes"
"RESULT_FIELDS" "CODE_INSEE,NOM_COM,PSDC99,SUPERFICIE_KM2"
"RESULT_HEADERS" "|||Code,Nom,Population,Superficie (km2)"
END
LABELITEM "NOM_COM"
CLASS
NAME "Chefs-lieux de département"
#OUTLINECOLOR 0 0 0
COLOR 247 232 168
TEMPLATE void
EXPRESSION ('[NOM_COM]' = 'BOURGES' or '[NOM_COM]' = 'CHARTRES' or
'[NOM_COM]' = 'CHATEAUROUX' or '[NOM_COM]'='TOURS' or '[NOM_COM]'='BLOIS' or
'[NOM_COM]'='ORLEANS')
LABEL
COLOR 0 0 0
#BACKGROUNDCOLOR 200 200 100
POSITION CC
TYPE bitmap
SIZE small
#FORCE TRUE
END
END
END # LAYER
LAYER
NAME "commune"
GROUP "communes"
TYPE POLYGON
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "data/communes_eric.TAB"
MAXSCALE 1000000
LABELMAXSCALE 150000
LABELITEM "NOM_COM"
METADATA
"DESCRIPTION" "|||Communes"
"RESULT_FIELDS" "CODE_INSEE,NOM_COM,PSDC99,SUPERFICIE_KM2"
"RESULT_HEADERS" "|||Code,Nom,Population,Superficie (km2)"
END
CLASS
NAME "Contour des communes"
OUTLINECOLOR 48 106 137
#COLOR 249 222 42
TEMPLATE void
LABEL
COLOR 0 0 127
#BACKGROUNDCOLOR 200 200 100
POSITION CC
TYPE bitmap
SIZE tiny
WRAP " "
FORCE TRUE
END
END
END # LAYER
LAYER
NAME "commune_symboles"
STATUS OFF
CONNECTIONTYPE OGR
CONNECTION "data/communes_eric.TAB"
TYPE POLYGON
CLASS
NAME "Lycées Pro."
TEMPLATE void
COLOR 0 0 120
SYMBOL 'star'
SIZE 5
END
END # LAYER
#
# CALQUES DES ZONES D'EMPLOI
#
LAYER
NAME "zonemploi"
TYPE POLYGON
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "data/zonemploi.TAB"
METADATA
"DESCRIPTION" "|||Zones d'emploi"
"RESULT_FIELDS" "codeemploi,zoneemploi"
"RESULT_HEADERS" "|||Code,Nom"
END
CLASS
SYMBOL 'circle'
NAME "Contour des zones d'emploi"
OUTLINECOLOR 0 0 102
SIZE 2
#COLOR 249 222 42
TEMPLATE void
END
END # LAYER
END #Map
Thanks eric
More information about the MapServer-users
mailing list