<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1528" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff size=2>OK
this is a part of the php code I used to add point to shp, notice to use it you
have to first give an attribute value (fill a html input) which you will
save in a dbf. file, than click on a map to add this point (I was using
previously created blank shp. file)</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff size=2>ad
here is the code:</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff size=2>else
if ($HTTP_FORM_VARS["CMD"] == "INPUT_POINT")</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> {<BR> $nClickGeoX = GMapPix2Geo($nClickPixX, 0,
$dfWidthPix, <BR>
$dfMinX, $dfMaxX, 0);<BR> $nClickGeoY = GMapPix2Geo($nClickPixY, 0,
$dfHeightPix, <BR>
$dfMinY, $dfMaxY, 1);<BR> <BR> $oPoint =
ms_newPointObj();<BR> $oPoint->setXY($nClickGeoX,
$nClickGeoY);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> $oshpfile = ms_newShapefileObj('C:\Program Files\Apache
Group\Apache2\htdocs\data\siedlce\ptk', -2);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> $dbname = "C:/Program Files/Apache
Group/Apache2/htdocs/data/siedlce/ptk.dbf";<BR> </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> $db = dbase_open (
$dbname,2);<BR> <BR> $nf =
dbase_numfields($db);<BR> $rn = dbase_numrecords
($db);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> if (ereg("([0-9]+)", $HTTP_FORM_VARS["atrybuty"],
$vatr))<BR> {<BR> $def =
array($vatr[1]);<BR> }<BR> else<BR> {<BR>
$def = array($rn+1);<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> $oshpfile->addPoint($oPoint);<BR> dbase_add_record($db,
$def);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> dbase_close ($db);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2> $oshpfile->free();<BR> $oPoint->free();</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006></SPAN><SPAN class=963272809-27012006><FONT
face=Arial color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff size=2>usig
this i never had any problem with overwriting allready added points, no such
thing happened</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff size=2>hope
this helps</FONT></SPAN></DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=963272809-27012006><FONT face=Arial color=#0000ff
size=2>regards</FONT></SPAN></DIV>
<P><FONT face="Arial CE" size=2>Artur Skalski</FONT> </P>
<P><B><FONT face="Arial CE" color=#000080 size=2>ACXIOM
Polska</FONT></B><BR><FONT face="Arial CE" color=#000080
size=2>Telephone: (+48 22) 606 11
27 Budynek
Saturn<BR>Facsimile: (+48 22) 606 11
28 Domaniewska 41<BR>Mobile:
(+48) 503 070
036 02-672 Warszawa</FONT><FONT
face="Arial CE" color=#000080><BR></FONT><FONT face="Arial CE" color=#000080
size=2>E-mail:
artur.skalski@acxiom.com</FONT> </P>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Xiaonan Zhang
[mailto:xnzhang11@gmail.com]<BR><B>Sent:</B> Thursday, January 26, 2006 12:59
PM<BR><B>To:</B> Skalski Artur - askals<BR><B>Cc:</B>
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS] How
to edit attribute of a selected shape?<BR><BR></FONT></DIV>
<DIV>hi, Skalski,</DIV>
<DIV> </DIV>
<DIV>Thanks for the reply. However could you please give more information on
this. Maybe an example.</DIV>
<DIV> </DIV>
<DIV>The code was working partly ok, the new point can be added,
however as I said, it will overwrite the old one. It's attribute was
inherited from the old one. I now want to change it's attribute and when I
use $poLayer->getResult(0); there seems not point was picked up.
</DIV>
<DIV> </DIV>
<DIV>regards,</DIV>
<DIV> </DIV>
<DIV>Jonathan</DIV>
<DIV><BR><BR> </DIV>
<DIV><SPAN class=gmail_quote>On 26/01/06, <B class=gmail_sendername>Skalski
Artur - askals</B> <<A
href="mailto:Artur.Skalski@acxiom.com">Artur.Skalski@acxiom.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>To change an attribute of
added point You have to also update a dbase file (I don't see that in your
code) wihich stores all atributes of shapes in shp.file, otherwise you
get nothing. And if you try to open such a file in ArcViwe it will promt
taht tha file was damaged which is because dbf. file record number doesn't
mach shp. file record number. </FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>dbase.dll which is used to
create and update dbf. file comes with standard distribution off all lates
php binaries</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>ragards</FONT></SPAN></DIV>
<P><FONT face="Arial CE" size=2>Artur Skalski</FONT> </P>
<P><B><FONT face="Arial CE" color=#000080 size=2>ACXIOM
Polska</FONT></B><BR><FONT face="Arial CE" color=#000080
size=2>Telephone: (+48 22) 606 11
27 Budynek
Saturn<BR>Facsimile: (+48 22) 606 11
28 Domaniewska 41 <BR>Mobile:
(+48) 503 070
036 02-672 Warszawa</FONT><FONT
face="Arial CE" color=#000080><BR></FONT><FONT face="Arial CE" color=#000080
size=2>E-mail: <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:artur.skalski@acxiom.com"
target=_blank>artur.skalski@acxiom.com</A></FONT> </P>
<DIV><SPAN class=e id=q_10905fdad5449d08_1>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV dir=ltr align=left><FONT face=Tahoma size=2>-----Original
Message-----<BR><B>From:</B> UMN MapServer Users List [mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU" target=_blank>
MAPSERVER-USERS@LISTS.UMN.EDU</A>]<B>On Behalf Of </B>Xiaonan
Zhang<BR><B>Sent:</B> Wednesday, January 25, 2006 6:02 PM<BR><B>To:</B> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU"
target=_blank>MAPSERVER-USERS@LISTS.UMN.EDU</A><BR><B>Subject:</B>
[UMN_MAPSERVER-USERS] How to edit attribute of a selected
shape?<BR><BR></FONT></DIV>
<DIV>Dear all,</DIV>
<DIV> </DIV>
<DIV>I am tring to create a function which can add comment point onto
layer however I got a few problems here:</DIV>
<DIV>1. the newly added one always overwrite the existing point so there
is always only one point in that layer.</DIV>
<DIV>2. I can not regain the added point.</DIV>
<DIV>3. how to change the attribute of the added point, say there is one
attribue called "Comment".</DIV>
<DIV> </DIV>
<DIV>thanks. </DIV>
<DIV> </DIV>
<DIV>My code is:</DIV>
<DIV> </DIV>
<DIV>//Create a new comment
point<BR>
$ClickGeo =
ms_newPointObj();<BR>
$ClickGeo->setXY($nClickGeoX,
$nClickGeoY);<BR>
<BR>
//printf("ClickGeoX %f<BR>\n",$nClickGeoX);
<BR> //printf("ClickGeoY
%f<BR>\n",$nClickGeoY);<BR> <BR> //Add
it to the comments
layer<BR> $shape
=
ms_newShapeObj(MS_SHAPE_POINT);<BR> $line
= ms_newLineObj();
<BR> $line->add($oClickGeo);<BR> $shape
->add($line);<BR> <BR> <BR> $poLayer
= $gpoMap->getlayerbyname(comments); //get the layer
"comments"<BR> $poLayer->open();<BR> //printf("Layer
Name: %f<BR>\n",
$poLayer->name);<BR> <BR> <BR> $poLayer->
addfeature($shape); //add the new comment point
<BR> <BR> <BR> //Save
the changes
<BR>
$cmmShapefile = "../htdocs/data/comments";
<BR> $objShapefile
= ms_newShapeFileObj( $cmmShapefile, MS_SHP_POINT );
<BR> $objShapefile->addshape($shape);<BR> $objShapefile->free;<BR>
$poLayer->close();
<BR> <BR> //Task2:
Use layer->querybypoint to regain the newly added point and then change
it's comment attribut
<BR> <BR> //Task2.1:get
the new added comment
point<BR>
$poLayer->querybypoint($oClickGeo, MS_SINGLE, 2);
<BR>
$numResults =
$poLayer->getNumResults();<BR>
printf("Find point: %f<BR>\n",
$numResults);
<BR>
$oRes = $poLayer->getResult(0);
<BR>
printf("tileindex: %f<BR>\n",
$oRes->tileindex);<BR>
printf("SHAPEINDEX: %f<BR>\n",
$oRes->shapeindex);
<BR>
$oShape = $poLayer->getShape(-1,0);
//(-1,-1)<BR>
print_r($oShape->values); //print the keys of
the values
array<BR>
$comment = $oShape->Values["Comment"];
<BR>
printf("The comment attribute is ---:
%f<BR>\n",$comment ); //display comment
attribute<BR> <BR>
</DIV></BLOCKQUOTE></SPAN></DIV><PRE>***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.
If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.
Thank You.
****************************************************************************
</PRE></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>