0

I want to eliminate polygons wich consist of less than 3550 px in this PNG . I tried using gdal_sieve but there seems to be an error.

gdal_sieve -st 3550 E8.png -of PNG E8sieve3550_4.png
ERROR 6: GDALDriver::Create() ... no create method implemented for this format.

Traceback (most recent call last):
  File "C:\PROGRA~1\QGISBR~1\bin\gdal_sieve.py", line 165, in <module>
    dst_ds.SetGeoTransform( src_ds.GetGeoTransform() )
AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'

I also tried "PNG" instead of PNG and changed the order of the parameters..

Edit: I tried what user30184 suggested: leave out the -of PNG part so that the output is a .tiff picture. But the result is a bit strange.

Here ist the output of gdalinfo E8.png (which I used as the source image):

Driver: PNG/Portable Network Graphics
Files: E8.png
Size is 8250, 4090
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 4090.0)
Upper Right ( 8250.0,    0.0)
Lower Right ( 8250.0, 4090.0)
Center      ( 4125.0, 2045.0)
Band 1 Block=8250x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=8250x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=8250x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=8250x1 Type=Byte, ColorInterp=Alpha

After eliminating the small polygons I would like to use "convert E8.png -type palette -colors 256 E8-palette-256colors.png" and than gdal_polygonize..

  • 1
    Gdal_sieve.py is taking only first band into account as documented The source raster file used to identify target pixels. Only the first band is used. Because of that the result may really be unexpected. – user30184 Dec 26 '14 at 22:24
  • Ok.. so what I did was convert E8.png -type palette -colors 256 E8-palette-256colors.png to retrieve a PNG with a single band and a colour table and THAN I tried it again with gdal_sieve and this is the result. Any suggestions? – Selphiron Dec 27 '14 at 11:47
1

The error message ERROR 6: GDALDriver::Create() ... no create method implemented for this format tells what goes wrong but it is pretty hard for a GDAL end user to interpret the message because it is not documented in http://www.gdal.org/gdal_sieve.html.

Gdal_sieve.py must be used with a raster output format that supports Create() method. That is documented somehow in the general manual page for GDAL utilities http://www.gdal.org/gdal_utilities.html

--formats

List all raster formats supported by this GDAL build (read-only and read-write) and exit. The format support is indicated as follows: 'ro' is read-only driver; 'rw' is read or write (ie. supports CreateCopy); 'rw+' is read, write and update (ie. supports Create). A 'v' is appended for formats supporting virtual IO (/vsimem, /vsigzip, /vsizip, etc). A 's' is appended for formats supporting subdatasets. Note: The valid formats for the output of gdalwarp are formats that support the Create() method (marked as rw+), not just the CreateCopy() method.

If you check the capabilities of PNG driver you'll see it does not support Create(). Use for example GeoTIFF as interim format and convert it later to png if that is really what you want.

PNG (rwv): Portable Network Graphics

GTiff (rw+vs): GeoTIFF

  • Thanks for the info. Please look at the Question I edited it. – Selphiron Dec 26 '14 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.