Hi,<div>I try to edit in this way, but it can not work,although it can save geometry,but it cannot save feature.</div><div>My purpose is  alter the previous file,and copy a DataSource to create a new file.<br><div><br></div>

<div><br></div><div><div><span style="white-space:pre-wrap">        </span>OGRRegisterAll();  </div><div><span style="white-space:pre-wrap">        </span>OGRDataSource *poDS = OGRSFDriverRegistrar::Open( srcname.c_str(), FALSE );</div>

<div><span style="white-space:pre-wrap">        </span>int layercount=poDS-&gt;GetLayerCount();</div><div><br></div><div><span style="white-space:pre-wrap">        </span>for(int num=0;num&lt;layercount;num++)</div>
<div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">        </span>    OGRLayer* poLayer = poDS-&gt;GetLayer(num);</div><div><span style="white-space:pre-wrap">        </span>    OGRFeature * pFeature;</div>

<div><span style="white-space:pre-wrap">        </span>    poLayer-&gt;ResetReading();</div><div><br></div><div>        while ((pFeature=poLayer-&gt;GetNextFeature())!=NULL)</div><div><span style="white-space:pre-wrap">        </span>{</div>

<div><span style="white-space:pre-wrap">        </span>   OGRGeometry* pGeometry = pFeature-&gt;GetGeometryRef();</div><div><span style="white-space:pre-wrap">        </span>   OGRwkbGeometryType geoType = pGeometry-&gt;getGeometryType();</div>

<div><span style="white-space:pre-wrap">        </span>   if (pGeometry != NULL &amp;&amp;wkbPoint==geoType)</div><div><span style="white-space:pre-wrap">        </span>   {</div><div>               //change the coordinate value</div>

<div><span style="white-space:pre-wrap">                </span> OGRPoint *poPoint = (OGRPoint *) pGeometry;</div><div><span style="white-space:pre-wrap">                </span> double pointx=poPoint-&gt;getX()-X;</div>
<div><span style="white-space:pre-wrap">                </span> double pointy=poPoint-&gt;getY()-Y;</div><div><span style="white-space:pre-wrap">                </span> poPoint-&gt;setX((pointx*cos(e)-pointy*sin(e))+X);</div>
<div><span style="white-space:pre-wrap">                </span> poPoint-&gt;setY((pointx*sin(e)+pointy*cos(e))+Y);</div><div><span style="white-space:pre-wrap">        </span>   }</div><div><span style="white-space:pre-wrap">        </span>   else if(pGeometry != NULL &amp;&amp;wkbLineString==geoType)</div>

<div><span style="white-space:pre-wrap">        </span>   {</div><div><span style="white-space:pre-wrap">                </span> OGRLineString* pLineGeo = (OGRLineString*)pGeometry;</div><div><span style="white-space:pre-wrap">                </span> int linestringsize=pLineGeo-&gt;getNumPoints();</div>

<div><span style="white-space:pre-wrap">                </span> for(int i=0;i&lt;linestringsize;i++)</div><div><span style="white-space:pre-wrap">                </span> {</div><div><span style="white-space:pre-wrap">                </span>     double pointx=((pLineGeo-&gt;getX(i)-X)*cos(e*PI/180.0)-(pLineGeo-&gt;getY(i)-Y)*sin(e*PI/180.0))+X;</div>

<div><span style="white-space:pre-wrap">        </span>             double pointy=((pLineGeo-&gt;getX(i)-X)*sin(e*PI/180.0)+(pLineGeo-&gt;getY(i)-Y)*cos(e*PI/180.0))+Y;</div><div><span style="white-space:pre-wrap">        </span>            pLineGeo-&gt;setPoint(i,pointx,pointy);</div>

<div><span style="white-space:pre-wrap">                </span>  }</div><div><span style="white-space:pre-wrap">        </span>   }</div><div><span style="white-space:pre-wrap">        </span>    else if( pGeometry != NULL &amp;&amp;wkbPolygon==geoType)</div>

<div><span style="white-space:pre-wrap">        </span>   {</div><div><span style="white-space:pre-wrap">                </span>   OGRPolygon *pPolygon=(OGRPolygon*)pGeometry;</div><div><span style="white-space:pre-wrap">                </span>   OGRLinearRing *ogrlring=pPolygon-&gt;getExteriorRing();</div>

<div><span style="white-space:pre-wrap">                </span>   int lenth=ogrlring-&gt;getNumPoints();</div><div><span style="white-space:pre-wrap">                </span>   for(int i=0;i&lt;lenth;i++)</div><div>
<span style="white-space:pre-wrap">                </span>  {</div><div><span style="white-space:pre-wrap">                        </span> double pointx=((ogrlring-&gt;getX(i)-X)*cos(e*PI/180.0)-(ogrlring-&gt;getY(i)-Y)*sin(e*PI/180.0))+X;</div>
<div><span style="white-space:pre-wrap">        </span>               double pointy=((ogrlring-&gt;getX(i)-X)*sin(e*PI/180.0)+(ogrlring-&gt;getY(i)-Y)*cos(e*PI/180.0))+Y;</div><div><span style="white-space:pre-wrap">                        </span> ogrlring-&gt;setPoint(i,pointx,pointy);</div>

<div><span style="white-space:pre-wrap">                </span>  }</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">        </span>   }</div>
<div><span style="white-space:pre-wrap">        </span>   else</div><div><span style="white-space:pre-wrap">        </span>   {</div><div><span style="white-space:pre-wrap">        </span>   }</div>
<div><span style="white-space:pre-wrap">                </span> poLayer-&gt;SetFeature(pFeature);   //it can not save feature</div><div><br></div><div><span style="white-space:pre-wrap">        </span> }</div>
<div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>OGRSFDriver* poDriver = OGRSFDriverRegistrar::GetRegistrar()-&gt;GetDriverByName(&quot;ESRI Shapefile&quot;);</div>
<div><span style="white-space:pre-wrap">        </span>OGRDataSource* desDS = poDriver-&gt;CopyDataSource(poDS,desname.c_str(),0);</div><div><span style="white-space:pre-wrap">        </span>OGRDataSource::DestroyDataSource( desDS );</div>

<div><span style="white-space:pre-wrap">        </span>OGRDataSource::DestroyDataSource( poDS );</div><div>       OGRCleanupAll();</div></div><div><br></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Can you help me?</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Thank you!</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Cheers,</span>
</div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Huahu</span></div>
</div>