GDAL Polygonize – Creating Polygons Using gdal_polygonize / QGIS Polygonize

gdalpolygonizeqgis

The original data is a pdf converted to tiff then georeferenced.
Then i did the sum of the 3 colors band to simplify the calculus
enter image description here

When i launch the polygonise (raster to vector), this is very slow because each pixel seams to be converted in a polygon:

enter image description here

My goal is to have only one polygon and speed the process. I could do a filter but not efficient.

Maybe sould i pre process the raster?

Size is 5398, 17717
Coordinate System is:
PROJCRS["Belge 1972 / Belgian Lambert 72",
    BASEGEOGCRS["Belge 1972",
        DATUM["Reseau National Belge 1972",
            ELLIPSOID["International 1924",6378388,297,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4313]],
    CONVERSION["Belgian Lambert 72",
        METHOD["Lambert Conic Conformal (2SP)",
            ID["EPSG",9802]],
        PARAMETER["Latitude of false origin",90,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8821]],
        PARAMETER["Longitude of false origin",4.36748666666667,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8822]],
        PARAMETER["Latitude of 1st standard parallel",51.1666672333333,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8823]],
        PARAMETER["Latitude of 2nd standard parallel",49.8333339,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8824]],
        PARAMETER["Easting at false origin",150000.013,
            LENGTHUNIT["metre",1],
            ID["EPSG",8826]],
        PARAMETER["Northing at false origin",5400088.438,
            LENGTHUNIT["metre",1],
            ID["EPSG",8827]]],
    CS[Cartesian,2],
        AXIS["easting (X)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing (Y)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["unknown"],
        AREA["Belgium - onshore"],
        BBOX[49.5,2.5,51.51,6.4]],
    ID["EPSG",31370]]
Data axis to CRS axis mapping: 1,2
Origin = (147315.341140000004089,177082.039359999995213)
Pixel Size = (0.042263440163025,-0.042387580290117)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  147315.341,  177082.039) (  4d19'45.55"E, 50d54'16.60"N)
Lower Left  (  147315.341,  176331.059) (  4d19'45.57"E, 50d53'52.30"N)
Upper Right (  147543.479,  177082.039) (  4d19'57.23"E, 50d54'16.61"N)
Lower Right (  147543.479,  176331.059) (  4d19'57.25"E, 50d53'52.30"N)
Center      (  147429.410,  176706.549) (  4d19'51.40"E, 50d54' 4.45"N)
Band 1 Block=5398x1 Type=Float32, ColorInterp=Gray
  NoData Value=-3.4028234663852886e+38

Best Answer

Polygonizing raster are always slow but maybe this can speed it up:

  1. Reclassify your raster using Raster calculator to 1 or 0. For example if your black values are 50-100 and your white 100-200:

(raster@1>50)(raster@1<100)*1 + (raster@1>100)(raster@1<200)*0

  1. Then polygonize this.
Related Question