I adapted the minor differences and yet the point is not displayed...
2006/5/5, Patricio Cifuentes Ithal <
[EMAIL PROTECTED]>:
Hi all....here a example....php-mapscript.... PHP code
/*ms_ResetErrorList();*/
/*LEYENDA DE CREDITOS**************************************************/
$lay=ms_newLayerObj($map);
$lay->set("name", "CREDITOS");
$lay->set("status",MS_ON);
$lay->set("transparency","100");
$lay->set("transform",MS_TRUE);
$lay->set("type",MS_LAYER_ANNOTATION);
$clas=ms_newClassObj($lay);
$clas->label->set("type",MS_TRUETYPE);
$clas->label->set("font","fritqat-bold");
$clas->label->color->setRGB(0,130,150);
$clas->label->outlinecolor->setRGB(255,255,255);
//$clas->label->backgroundcolor->setRGB(245,245,245);
//$clas->label->backgroundshadowcolor->setRGB(110,110,110);
$clas->label->set("size",7);
$clas->label->set("position",MS_XY);
$clas->label->set("autoangle",MS_FALSE);
$clas->label->set("buffer",0);
$clas->label->set("antialias",MS_TRUE);
$clas->label->set("partials",MS_TRUE);
$clas->label->set("force",MS_TRUE);
$clas->label->set("wrap",1);
//transfor the pixel to geografics pont
$p=pixelToGeo($map,5,$map->height - 5);
$pt=ms_newLineObj();
$pt->addXY($p->x,$p->y);///or replace for coord... geografics ($pt->addXY($p->x,$p->y);)
$shp = ms_newShapeObj(MS_SHAPE_POINT);$shp->set("text", GV_COPY);
$shp->add($pt);
$lay->addFeature($shp);--Patricio Cifuentes Ithal
Ingeniero en InformáticaInformática
SIIGSA
(56-2) 204 60 22----- Original Message -----From: d cSent: Friday, May 05, 2006 1:57 PMSubject: [UMN_MAPSERVER-USERS] drawing a point in MapScriptHi,
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
