drawing a point in MapScript
d c
dark.peony at GMAIL.COM
Fri May 5 10:57:39 PDT 2006
Hi,
I'm having a problem with rendering a point with PHP Mapscript.
I'm wondering what I'm doing wrong. I'm trying to simulate the
following Mapfile code (which works well in Mapfile mode):
LAYER
TYPE POINT
STATUS DEFAULT
FEATURE
POINTS
-64.4333333 -64.7833333
END
TEXT "HELLO WORLD"
END
CLASS
COLOR 255 0 0
SYMBOL 'cross'
LABEL
TYPE bitmap
END
END
TOLERANCE 5
PROJECTION
"proj=latlong"
"datum=WGS84"
END
END
/********* PHP CODE ***********/
$map = ms_newMapObj("Ant.map");
$layer = ms_newLayerObj($map);
$layer->name = 'point';
$layer->type = MS_LAYER_POINT;
$layer->status = MS_DEFAULT;
$layer->setProjection("proj=latlong,datum=WGS84");
$pt = ms_newPointObj();
$pt->setXY(-64.4333333,-64.7833333);
$ln = ms_newLineObj();
$ln->add($pt);
$shp = ms_newShapeObj(MS_SHAPE_POINT);
$shp->text = 'HELLO WORLD';
$shp->add($ln);
$layer->addFeature($shp);
$class1 = ms_newClassObj($layer);
$class1->name = 'pointclass';
$class1->label->type = MS_BITMAP;
$class1->label->color->setRGB(255,0,0);
$class1->label->set('position',MS_AUTO);
$class1->status = MS_ON;
$class1->settext = 'HELLO WORLD';
$style = ms_newStyleObj($class1);
$style->symbolname = 'cross';
$style->color->setRGB(255,0,0);
$style->size = 10;
$style->outlinecolor->setRGB(255,255,255);
$image=$map->draw();
$image->saveImage('C:/ms4w/Apache/htdocs/tmp/'.$image_name);
I'm followig (except for the projection bit) the code proposed in
Beginning Mapserver and a tutorial I found on the Net. The code
seems identical.
What am I doing wrong?
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060505/264b0c48/attachment.htm>
More information about the MapServer-users
mailing list