[R-sig-Geo] distmap
Agustin Lobo
Agustin.Lobo at ija.csic.es
Tue Jun 26 12:59:13 CEST 2007
Still some problems:
> sessionInfo()
R version 2.5.0 (2007-04-23)
i386-pc-mingw32
locale:
LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252
attached base packages:
[1] "stats" "graphics" "grDevices" "utils" "datasets"
"methods" "base"
other attached packages:
maptools foreign spatstat mgcv sp
"0.6-13" "0.8-20" "1.11-7" "1.3-25" "0.9-14"
> limit1 <- read.shape("limit_PNSN2000.shp")
> limit1owin <- as(limit2,"owin")
Error in inherits(x, "factor") : cannot get a slot ("contains") from an
object of type "NULL"
> limit1owin <- as(as(limit2, "SpatialPolygons"), "owin")
Checking 3 polygons...1, 2, [Checking polygon with 2749 edges...]
3.
done.
Checking for cross-intersection between 3 polygons...1, Polygons 1 and 3
cross over
2.
done.
Error in owin(poly = opls) : Polygon data contain overlaps between polygons
> plot(limit2)
I can send you limit2.rda, is that ok?
Agus
Roger Bivand escribió:
> On Mon, 25 Jun 2007, Edzer J. Pebesma wrote:
>
>> Roger Bivand wrote:
>>> On Mon, 25 Jun 2007, Agustin Lobo wrote:
>>>
>>> > I've tried (among other things):
>>> > > limit1 <- read.shape("limit_PNSN2000.shp")
>>> > Shapefile type: Polygon, (5), # of Shapes: 2
>>> > > limit1poly <- Map2poly(limit1)
>>> > > limit1owin <- as(limit1poly,"owin")
>>> > Error in .classEnv(thisClass) : unable to find an environment
>>> containing > class "polylist"
>>> > > > limit2 <- readOGR("limit_PNSN2000.shp",layer="limit_PNSN2000")
>>> > OGR data source with driver: ESRI Shapefile
>>> > Source: "limit_PNSN2000.shp", layer: "limit_PNSN2000"
>>> > with 2 rows and 1 columns
>>>
>>> Then just:
>>>
>>> limit1owin <- as(limit2,"owin")
>>>
>>> ought to work with current maptools, or possibly coerce:
>>>
>>> limit1owin <- as(as(limit2, "SpatialPolygons"), "owin")
>>>
>> the latter form shouldn't be needed thanks to S4 inheritance.
>
> In principle yes, especially with fresh sp and maptools, but I'm not
> sure that my code in earlier versions allowed inheritance properly, and
> we don't know which package versions are being used. Hence the general
> request to state sessionInfo() output in all questions to the list.
>
> Roger
>
>> --
>> Edzer
>>
>
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
More information about the R-sig-Geo
mailing list