[gdal-dev] Polygonize output inverted

Richard r.l.morley82 at gmail.com
Sun Apr 5 05:47:27 PDT 2020



Hi there,

I’m having an issue trying to use the GDAL Polygonize feature in QGIS.

My aim is to clip out or mask the background of some hyperspectral data of some diseased Cocoa leaves for my research masters project. My background up until this project with GIS has been fairly rudimentary GUI use of ArcGIS and QGIS.

My attempted workflow involves using a k-means classifier to classify the HSI raster files, then convert to vector to edit out background and use result to clip out or mask the background of my HSI data. However, when I run GDAL Polygonize the output is inverted above the input raster.

I’ve tried adding a coordinate projection to the input raster data prior to converting, but this didn’t work.

The input file info is:

CRS
EPSG:4326 - WGS 84 - Geographic
Extent
0.0000000000000000,-696.0000000000000000 : 520.0000000000000000,0.0000000000000000
Unit
degrees
Width
520
Height
696
Data type
Byte - Eight bit unsigned integer
GDAL Driver
GTiff

And the output is:


Storage

ESRI Shapefile

Comment

Encoding

macintosh

Geometry

Polygon (MultiPolygon)

CRS

EPSG:4326 - WGS 84 - Geographic

Extent

0.0000000000000000,0.0000000000000000 : 520.0000000000000000,696.0000000000000000

Unit

degrees

Feature count

761

The log from processing reads:


2020-04-05T13:21:51     INFO    gdal_polygonize.py /Users/user/Documents/qgis_test/kmns/c1a_kmns.tif /Users/user/Documents/qgis_test/c1a_vctr.shp -b 1 -f "ESRI Shapefile" c1a_vctr Class
2020-04-05T13:21:51     INFO    GDAL execution console output
             0...10...20...30...40...50...60...70...80...90...Creating output /Users/user/Documents/qgis_test/c1a_vctr.shp of format ESRI Shapefile.

             100 - done.

I’ve read a few forum posts on some similar issues, but solutions seem aimed at raster projections. It’s clear the extents are inversed, but I can’t figure out how to change them.

Any input would be gratefully received,

Richard


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200405/b3ff790d/attachment.html>


More information about the gdal-dev mailing list