[Mapserver-users] Adding points to an existing point type shape file

Mike Reilly mikereilly_7 at hotmail.com
Mon Mar 1 01:46:54 EST 2004


Hi:

I wanted to check my logic here.  I think I've figured out how to add points 
to an existing shape file (point data, of course).  Does it make sense to do 
it as follows:

1.  Get the x and y co-ordinates from the user clicking on an <input 
type="image> with an src of the map, translate the co-ordinates clicked on 
by comparing to the map extents (I've checked the numbers my code is coming 
up with and it looks correct).

2.  Add the data for the point to the .dbf file for the layer using php's 
dbase functions (I'm pretty clear on this part and have checked it to see 
that it works well).

3.  Use php mapscript to add the point to the shape file using code 
something along these lines:
$myshapefile = ms_newshapefileObj("F:/program files/apache 
group/apache2/htdocs/kitasoo/tus/tus points", -2);
$mypoint = ms_newPointObj();
$mypoint->x = $newx;
$mypoint->y = $newy;
$newpoint = $myshapefile->addPoint($mypoint);

Does this make sense, or should I use $mypoint->setXY($newx, $newy, 0); to 
set my x and y co-ordinates for it?

Another question about this - I have no idea what the 3rd parameter of setXY 
does (probably because I come from a programming background rather than a 
GIS background).  What is a "measured shape file"?

Thanks for any illumination or hints you can provide.  I'm very encouraged 
to have gotten this far!  The light at the end of the tunnel for this 
project appears to be looming :)

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




More information about the mapserver-users mailing list