[gdal-dev] ERROR: Points of LinearRing do not form a closed linestring

Even Rouault even.rouault at spatialys.com
Tue Sep 2 07:06:32 PDT 2014


Selon Luca Delucchi <lucadeluge at gmail.com>:

> Hi everybody,
>
> I created a script to filter some lidar data, and It worked perfectly
> some weeks ago.
> Now I have to run with different data but I obtain the following error
> when I try to overlaps two geometry.
>
> ERROR 1: IllegalArgumentException: Points of LinearRing do not form a
> closed linestring
>
> The code that I'm using is something similar to this
>
> import osgeo.ogr as ogr
> import osgeo.osr as osr
> # this is the input vector file to read the features for filter the lidar
> point
> inDatasource = ogr.Open('/incoming/james_lidar.json')
> inLayer = inDatasource.GetLayer()
> inFeature = inLayer.GetFeature(0)
> geom = inFeature.geometry()
> geom.ExportToWkt()
> 'POLYGON ((661300 5115700,661300 5117600,662300 5117600,662300 5115700))'
> # this is the polygon of a lidar tile bounding box
> wkt = 'POLYGON((660000 5116000,660000 5118000,661793 5118000,661793
> 5116000,660000 5116000))'
> poly = ogr.CreateGeometryFromWkt(wkt)
> geoms.Overlaps(poly)
> ERROR 1: IllegalArgumentException: Points of LinearRing do not form a
> closed linestring
>
> What I'm doing wrong?

Just as suggested by the error message, your polygon is not closed. You must
repeat the first point as last point to form a valid polygon.

>
> --
> ciao
> Luca
>
> http://gis.cri.fmach.it/delucchi/
> www.lucadelu.org
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list