<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>