Hello, all!
<br><br>I need to copy features to the empty shp file.
<br><br>The code is really simple:
<br><br>    const char *pszDriverName = &quot;ESRI Shapefile&quot;;
<br>    OGRSFDriver *poDriver;
<br><br>    OGRRegisterAll();
<br><br>    poDriver = OGRSFDriverRegistrar::GetRegistrar()-&gt;GetDriverByName(
<br>                pszDriverName );
<br>    if( poDriver == NULL )
<br>    {
<br>        printf( &quot;%s driver not available.\n&quot;, pszDriverName );
<br>        exit( 1 );
<br>    }
<br><br>    OGRDataSource       *poDS;
<br>    poDS = OGRSFDriverRegistrar::Open( &quot;C:\\ArcProjects\\Untamo\\Test\\test.shp&quot;, TRUE );
<br>    if( poDS == NULL )
<br>    {
<br>        printf( &quot;Open failed.\n&quot; );
<br>        exit( 1 );
<br>    }
<br><br>        OGRLayer  *poLayer;
<br>    poLayer = poDS-&gt;GetLayerByName( &quot;test&quot; );
<br><br><br>        OGRDataSource       *poDS1;
<br>    poDS1 = OGRSFDriverRegistrar::Open( &quot;C:\\ArcProjects\\Untamo\\Test\\arbukle0ot.shp&quot;, FALSE );
<br>    if( poDS1 == NULL )
<br>    {
<br>        printf( &quot;Open failed.\n&quot; );
<br>        exit( 1 );
<br>    }
<br><br>        OGRLayer  *featuresLayer;
<br>    featuresLayer = poDS1-&gt;GetLayerByName( &quot;arbukle0ot&quot; );
<br><br>    OGRFeature *poFeature;
<br>    featuresLayer-&gt;ResetReading();
<br>    while( (poFeature = featuresLayer-&gt;GetNextFeature()) != NULL )
<br>    {
<br><br>        OGRFeature *newFeature;
<br><br>        newFeature = OGRFeature::CreateFeature( poLayer-&gt;GetLayerDefn() );
<br>        newFeature-&gt;SetField( &quot;ID&quot;, 1);
<br>                newFeature-&gt;SetGeometry(poFeature-&gt;GetGeometryRef()); 
<br><br>        if( poLayer-&gt;CreateFeature(newFeature ) != OGRERR_NONE )
<br>        {
<br>           printf( &quot;Failed to create feature in shapefile.\n&quot; );
<br>           exit( 1 );
<br>        }
<br>         
<br>                 OGRFeature::DestroyFeature( newFeature );
<br>         OGRFeature::DestroyFeature( poFeature );
<br>    }
<br>    
<br>        OGRDataSource::DestroyDataSource( poDS );
<br>        OGRDataSource::DestroyDataSource( poDS1 );
<br>}
<br><br>arbukle0ot.shp contains features,
<br>test is empty shp file, that is created with ArcCatalog.
<br><br>Now if you run this code, features will be copied, however the 
extent of the shp file will be strange, as the MinX and MinY will be 0 
and 0. (however it should not be, the extent of each feature differs 
from zero)
<br><br>The most interesting thing, that if you will take this test.shp,
 draw some features in ArcMap, check extent (it will be the right one), 
than delete this features to make shp file again empty, and run the 
code, the extent of the output file be the correct!
<br><br>I wonder, what is a problem?<br><br>emmiolla<br>