[gdal-dev] Behavior of Polygonize function (JAVA bindings to GDAL)

Even Rouault even.rouault at mines-paris.org
Thu Jun 5 12:18:48 PDT 2014


Mateusz,

The Polygonize method assumes that you have created the field in the layer 
definition, before calling it.
See the gdal_polygonize.py script as an example on how it is done in Python.
The related Java API is ogr.Layer.CreateField()

Best regards,

Even

Le mercredi 04 juin 2014 17:35:52, Mateusz Wodzikowski a écrit :
> Hello,
> 
> I just discovered strange behavior of Polygonize function in JAVA bindings
> to GDAL.
> The function do not create the attribute in which the value of raster is
> stored as it is described in http://www.gdal.org/gdal_polygonize.html .
> 
> After performing the function on a raster GeoTIFF file the it seems that
> the value of the raster is not passed to the resulting features.
> The method GetFieldAsDouble("DN") gives: ERROR 1: No such field: 'DN'.
> Additionally the feat.GetFieldCount() gives 0. When I try to print the
> field with ID 0 (GetFieldAsDouble(0)) I get consecutive numbers from 0 to
> the total number of polygons which were 'discovered'.
> 
> I use:
> GDAL 1.11.0
> jdk 1.7u55
> Apache Ant 1.9.4
> swig-3.0.1
> 
> JAVA bindings compiled using VS 9.0 on Win7 64bit machine
> 
> Best regards,
> Mateusz

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list