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