[gdal-dev] ogr2ogr.java s57 conversion

Even Rouault even.rouault at mines-paris.org
Wed Jun 22 13:24:59 EDT 2011


Le mercredi 22 juin 2011 19:18:51, Robert Naugle a écrit :
> Hi Even, welcome back.
> 
> A fair suggestion, but -skipfailures is the first argument in my argument
> list. Even so, the test for skipfailures comes AFTER the call
> to CreateFeature(...) which is where I get a *java.lang.RuntimeException:
> OGR Error: Unsupported geometry type. *This obviously stops all conversion
> in it's tracks.

Ah ok, this makes sense. This has been fixed in the trunk version by disabling 
exceptions. See http://trac.osgeo.org/gdal/changeset/21555 for the line to 
add.

> *
> *
> I could be wrong about what is causing the CreateFeature to fail, all I
> know is that it happens as soon as the layer is asked to create a feature
> of a new geometry type.
> 
> On Wed, Jun 22, 2011 at 1:04 PM, Even Rouault
> 
> <even.rouault at mines-paris.org>wrote:
> > Le mercredi 22 juin 2011 18:48:34, Robert Naugle a écrit :
> > > Oliver,
> > > 
> > > Thanks much for your help, and with the link. I thought I would share
> > > my progress:
> > > 
> > > The first thing I tried was moving the csv files (s57attributes.csv and
> > > s57objectclasses.csv) into the working directory. Success! (sort of...)
> > > ogr2ogr.java found all the layers in the s57 chart file. However, the
> > > layers appeared to be empty :(
> > > 
> > > Now I know that your suggestion was to set the environment variables
> > 
> > within
> > 
> > > the java environment, and that would probably help, but due to the use
> > > of JNI in the implementation of ogr2ogr in java, and the desire for a
> > 
> > working
> > 
> > > JavaWebStart application later on, that path is beyond my capabilities.
> > > So...
> > > 
> > > I did a little digging to see why the layers were empty. Layer
> > 
> > translation
> > 
> > > was failing when creating fields for the attributes in the s57 chart.
> > > Specifically, the LNAM_REFS and FFPT_RIND fields. I modified
> > > ogr2ogr.java to just skip these fields and started to find objects in
> > > the layers!
> > > 
> > > Now I am dealing with 'OGR Error: Unsupported geometry type', when
> > 
> > loading
> > 
> > > more than one geometry type into a shapefile, which I know is against
> > > the rules, but it seems like the cpp ogr2ogr did a better job of
> > > handling
> > 
> > these
> > 
> > > sorts of errors. I believe this can be helped with some argument
> > > manipulation...
> > 
> > You just need to add "-skipfailures" as a command line argument, as you'd
> > do
> > with the C++ version of ogr2ogr. The LNAM_REFS and FFPT_RIND fields are
> > of type
> > StringList and IntegerList, which is not supported by shapefiles. And yes
> > a shapefile only supports one geometry type per shapefile. -skipfailures
> > should
> > skip geometries that are not of the right type.


More information about the gdal-dev mailing list