[R-sig-Geo] Overlaying SpatialLines by SpatialPolygons

Colin Rundel rundel at gmail.com
Tue Jun 7 19:53:04 CEST 2011


This message is occuring because the geos library (that rgeos is based on) needs to know which holes belong to which polygons which is something that sp objects don't indicate natively. rgeos includes a simple algorithm that attempts to identify which holes belong to which polygons but there are plenty of edge cases that it wont work for. If the shapefile is something that you can share, post it somewhere and provide a link and we can take a look at the polygons to see what is going wrong.

-Colin


On Jun 7, 2011, at 10:00 AM, Mathieu Rajerison wrote:

> Thanks for the answer!
> 
> I think I surely have to use gIntersection then gLength for this purpose
> 
> I've tried gIntersection like this:
> routes2 = gIntersection(routes, bdc)
> 
> But I get the following message:
> Erreur dans createPolygonsComment(p) :
>  rgeos_PolyCreateComment: orphaned hole, cannot find containing polygon for
> hole at index 1
> 
> Do you have an idea why I get this message and how to correct it?
> 
> 
> 
> 2011/6/7 Roman Luštrik <roman.lustrik at gmail.com>
> 
>> Package rgeos has all sorts of functions that might come handy.
>> 
>> Cheers,
>> Roman
>> 
>> 
>> 
>> On Tue, Jun 7, 2011 at 6:13 PM, Mathieu Rajerison <
>> mathieu.rajerison at gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> 
>>> I have a SpatialLines object representing roads and a SpatialPolygons
>>> object
>>> containing cities.
>>> 
>>> I'd like to know how to overlay a SpatialLines object by aSpatialPolygons
>>> object.
>>> 
>>> I'd like to know the total distance of roads that cover each of my cities.
>>> 
>>> Is it possible?
>>> 
>>> 
>>> Thanks,
>>> 
>>> Mathieu
>>> 
>>>       [[alternative HTML version deleted]]
>>> 
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> 
>> 
>> 
>> 
>> --
>> In God we trust, all others bring data.
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list