[Qgis-developer] Problems in clipping lines with polygons

Giovanni Manghi giovanni.manghi at gmail.com
Mon Jan 23 07:41:31 PST 2017


> Il 20/01/2017 13:56, Giovanni Manghi ha scritto:
>>> I am clipping lines with polygons, and I found issues:
>>> * QGIS alg does not cut the line at the change of the polygon
>>> * GDAL alg does not produce an output
>>
>> they both work ok here on 2.14.11
>
> Confirmed also for 2.14. It must have to do with layer validity, as I get:
>
> GDAL command output:
> ERROR 1: TopologyException: Input geom 1 is invalid: Self-intersection
> at or near point 1591718.5859374921 4869828.5859374423 at
> 1591718.5859374921 4869828.5859374423
> ...
>
> So, still the same old issue for gdal; what is strange is the behaviour
> of QGIS.


this is a problem that have been recently discussed quite a lot
(again) in and out the official channels.

See for example:

https://github.com/qgis/QGIS/pull/3865#issuecomment-267016050

https://github.com/qgis/QGIS/pull/3865#issuecomment-267039499

https://github.com/qgis/QGIS/pull/3865#issuecomment-267042049


to resume... native qgis tools (or even ogr based ones for that
matter) do not have yet any mechanism/option to fix geometries
while/before doing a geoprocessing operation (I'm talking in the
context of Processing here). To consider that

a) working with garbage produced by others is frequently not an option
b) fixing the most common geometry issues should be easy (the geometry
checker is good, but does not work in Processing and is quite complex
for the vast majority of users)

the solution is of course available, liblwgeom or
https://git.osgeo.org/gogs/rttopo/librttopo seems the thing to use, in
fact when using st_makevalid (in PostGIS or the liblwgeom plugin for
Processing) the vast majority of geometry issues that make qgis tools
choke are easily and quickly fixed.

would qgis/spatialite been compiled with liblwgeom support (which I
don't think is the case on all major supported platforms) I would have
already added a "fix geometries" option in the ogr based tools (that
among the other things are magnitude faster than the native qgis ones)
adding also the most common operations involving more than 1 input.

-- G --


More information about the Qgis-developer mailing list