[R-sig-Geo] Handling invalid geometries from the ‘mapdata’ package
Roger Bivand
Roger.Bivand at nhh.no
Mon Mar 28 16:26:42 CEST 2011
On Mon, 28 Mar 2011, Roger Bivand wrote:
> On Mon, 28 Mar 2011, Karl Ove Hufthammer wrote:
>
>> Roger Bivand wrote:
>>
>>>> pls1 <- lapply(pls, checkPolygonsHoles)
>>> Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, "rgeos_equals") :
>>> TopologyException: side location conflict at 78.9364 33.4081
>>>
>>> then I can reproduce it, and will examine whether it can be handled - the
>>> checkPolygonsHoles() function also uses GEOS, but probably should warn
>>> after failing try(gEquals(...)).
>>>
>>> Was this your error?
>>
>> Yes.
>>
>> I also eventually managed to get a segfault when trying various stuff like
>> this, but it may have been unrelated. (At least, I can’t reproduce it.)
>
> Thanks. Updating to maptools 0_8-5 and rgeos 0_1-3 (sources on CRAN now)
> should provide better protection against non-conformant data causing a
> seg-fault in GEOS - GEOS really likes its polygons *very* tidy.
The attached plot shows this issue, which is in the area between northern
India, Kashmir, and China, so perhaps reality is more complicated than
GEOS prefers? I've only plotted the border given in the data set for
China, which includes the odd reversed straight line. If I include other
borders, I see a line starting at right angles to the northern end of this
line and heading WSW, which may be another demarcation line. Apart from
this case, the rest of worldHires got through OK - the maptools code on
SVN now reports:
> pls1 <- lapply(pls, checkPolygonsHoles)
Warning message:
In checkPolygonsGEOS(x, properly = properly) :
Polygons object China, Polygon 1: Error in RGEOSBinPredFunc(spgeom1,
spgeom2, byid, "rgeos_equals") :
TopologyException: side location conflict at 78.9364 33.4081
instead of failing.
Roger
>
> Roger
>
>>
>> --
>> Karl Ove Hufthammer
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ch.png
Type: image/png
Size: 6821 bytes
Desc: ch.png
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110328/1afb148a/attachment.png>
More information about the R-sig-Geo
mailing list