Skip to content

gdal vector buffer missing --geometry-type option #13512

@geographika

Description

@geographika

Feature description

Running the following command to buffer lines:

gdal vector buffer --distance=5 "/vsizip/TRONCON_VOIE_PARIS.zip" out.gpkg --overwrite

Returns a warning:

Warning 1: A geometry of type POLYGON is inserted into layer TRONCON_VOIE_PARIS of geometry type LINESTRING, which is not normally allowed by the GeoPackage specification, 
but the driver will however do it. To create a conformant GeoPackage, if using ogr2ogr, the -nlt option can be used to override the layer geometry type. This warning will 
no longer be emitted for this combination of layer and feature geometry type.

The output is created, but it is a line dataset with polygons, and so doesn't display in QGIS.

It would be very useful to be able to set --geometry-type Polygon similar to the -nlt option in ogr2ogr, or in gdal vector explode-collections.

Even better would be that the buffer tool automatically sets the output geometry to polygon when buffering lines.

A workaround is to use a pipeline as below, but this is quite verbose:

gdal vector pipeline `
    ! read "/vsizip/TRONCON_VOIE_PARIS.zip" `
    ! set-geom-type --geometry-type Polygon `
    ! buffer --distance=5 `
    ! write out.gpkg --overwrite

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementgdal_cliAnything related to the new 3.11 "gdal" CLI frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions