[Gdal-dev] problem with polygonz shapefile and ArcExplorer ...

LALLAURET Fabrice - <SSII> fabrice.lallauret at thalesgroup.com
Thu Nov 30 04:57:06 EST 2006


Hi,
I have a problem with the shapefile driver in the 1.3.2 release of OGR. 
The shapefiles seems good with ArcMap or ogrinfo but can't be display 
with ArcExplorer 9.1 (Linux & windows)
(the console of ArcExplorer display the following message : > Nov 29, 
2006 6:28:41 PM:    com.esri.mo.file.shp.db 
com.esri.mo.file.shp.InvalidShapeException: 1 invalid shape/s were 
detected in ...)
I've tried with ogr 1.3.1 and it works.
The problem seems to be the addition of the "bMeasureIsUsed" in the 
shpopen.c file. When I force it to TRUE, the generated shapefile can be 
succefully display in ArcExplorer.
Why this flag act on SHPT_POLYGONZ type ?

I have attached to create a small shapefile which I can't display on 
ArcExplorer

Regards

-- 
     .--.    Fabrice LALLAURET - PSV Team
    |o_o |   Tel: (33) (01 34) 22 84 33
    |:_/ |   Thales Training & Simulation
   //   \ \  1, rue du General de Gaulle
  (|     | ) Z.I. les beaux soleils
 /'\_   _/`\ Osny. B.P. 226
 \___)=(___/ 95523 Cergy-Pontoise Cedex
 E-mail: fabrice.lallauret at thalesgroup.com
 "Power corrupts. PowerPoint corrupts absolutely."
 My personnal (french) Websites: http://www.xbee.net
 and http://www.french-comics-zone.fr.st


-------------- next part --------------
#include "ogrsf_frmts.h"
#include "cpl_conv.h"
#include "cpl_string.h"

/************************************************************************/
/*                                main()                                */
/************************************************************************/

int main( int nArgc, char ** papszArgv )

{
    const char *pszFormat = "ESRI Shapefile";
    const char *pszOutputName = "test.shp";

    OGRRegisterAll();

    OGRDataSource *poDstDS;
    OGRLayer *poDstLayer = NULL;

    OGRSFDriverRegistrar     *poR = OGRSFDriverRegistrar::GetRegistrar();
    OGRSFDriver              *poDriver = NULL;
    int                      iDriver;

    for( iDriver = 0;
            iDriver < poR->GetDriverCount() && poDriver == NULL;
            iDriver++ )
    {
        if( EQUAL(poR->GetDriver(iDriver)->GetName(),pszFormat) )
        {
            poDriver = poR->GetDriver(iDriver);
        }
    }


    poDstDS = poDriver->CreateDataSource( pszOutputName, NULL );

    OGREnvelope sExtents;
    OGRPolygon oRegion;
    OGRLinearRing oRing;

    /*
       oRing.addPoint( -1.0, -1.0 , 0.0 );
       oRing.addPoint( -1.0, 1.0 , 0.0 );
       oRing.addPoint( 1.0, -1.0 , 0.0 );
       oRing.addPoint( -1.0, -1.0 , 0.0 );
       */

    /*
       oRing.addPoint( 9.080074, 52.269425, 0.000000 );
       oRing.addPoint( 9.080936, 52.268975, 0.000000 );
       oRing.addPoint( 9.081471, 52.269088, 0.000000 );
       oRing.addPoint( 9.080074, 52.269425, 0.000000 );
       */

    oRing.addPoint( 0.0, 0.0 , 0.0 );
    oRing.addPoint( 0.0, 0.1 , 0.0 );
    oRing.addPoint( 0.1, 0.0 , 0.0 );
    oRing.addPoint( 0.0, 0.0 , 0.0 );

    oRegion.addRing( &oRing );

    poDstLayer = poDstDS->CreateLayer( "tileindex" );
    OGRFeature  oTileFeat( poDstLayer->GetLayerDefn() );

    oTileFeat.SetGeometry( &oRegion );

    if( poDstLayer->CreateFeature( &oTileFeat ) != OGRERR_NONE )
    {
        printf( "Failed to create feature on tile index ... terminating." );
        delete poDstDS;
        exit( 1 );
    }

    delete poDstDS;

    return 0;
}



More information about the Gdal-dev mailing list