[maplab-users] Re: [Mapserver-users] Need Urgent Help on PHP/MapScript >> ms_newPointObj()

Vinko Vrsalovic el at vinko.cl
Mon Jul 19 15:04:33 EDT 2004

On Mon, Jul 19, 2004 at 08:52:02AM -0700, Ishrar Hussain wrote:
> Please give me an example code showing how to use
> PointObj class, i.e. ms_newPointObj(), to dynamically
> draw a point over an already created instance of
> MapObj, which have been instantiated with a static
> .map file.
> Using Maplab, I have created my web mapping
> application, which successfully published my shape
> files in 4 layers. The map is now static. And over
> this map, I need to draw with PHP/MapScript a new
> layer that will hold one dynamic point, whose
> coordinates I will be retrieving from a database using
> PHP. (I am editing the drawmap.php file in the wrapper
> folder for this.)
> Note that, I don't want to have this new layer
> definition in my map file, which will make the layer
> static. I also cannot use any database connection in
> the mapfile (postgis or postgre or mygis). Thus,
> PHP/MapScript's PointObj is my only choice.
> So, if possible, let me know whether PointObj can be
> used to dynamically draw a point like this over a
> MapObj, which is already instantiated with a map file
> having 4 layer definitions.
> Any detailed example code showing how to use PointObj
> will do.

$lyr = ms_newLayerObj($map);

//I tried with point (MS_LAYER_POINT and a PointObj) some months ago 
//and it didn't work, so now I use this ugly hack. 
//Don't know if it's still needed.

$shp = ms_newShapeObj(MS_SHAPE_LINE);
$pt = ms_newLineObj();

//set all the other layer attributes, add classes, styles, labels
//as needed.


Vinko Vrsalovic <el[|- at -|]vinko.cl>

More information about the Maplab-users mailing list