[R-sig-Geo] Exporting kernel UD homerange to an ESRI shapefile
Corrie Curtice
cc157 at duke.edu
Mon Nov 23 18:19:25 CET 2009
Hello,
Sorry, I must be missing something obvious. I have location data for
several turtles in three different areas. I'm interested in the home
range of the population at each area, so I've broken the data out
already by beach name (not by turtle). I'm using the adehabitat
package and running:
xy<-bajaTurtles[,c("x","y")]
id<-bajaTurtles$Beach
bajahr<-kernelUD(xy,id)
I get a nice picture of the home range with contours. I've done this
for each beach I want to create my maps in ArcMap (I'm not that good
with maps in R yet), so I'd like to export each homerange as an ESRI
shapefile, keeping the contour information so I can color ramp it
appropriately and do some analysis in ArcMap. This is what I think
I'm supposed to do, from reading
https://wiki.faunalia.it/dokuwiki/doku.php?id=public:animove_howto:
kverBaja<-getverticeshr(bajahr)
spolBaja <- kver2spol(kverBaja)
The above object has 2 slots with coordinates, but only one slot has
an "ID" field, which is the name of the beach. Clearly at this point
I'm missing information, since I would expect each contour to be a
polygon. It doesn't look like getverticieshr takes a list of levels,
just one. Do I need to repeat this and glue them together for all the
levels? Is there a different function to use? Also, somewhat
unrelated but curious: I don't quite understand why both slots do not
have ID fields?
So now just to see what I have I exported it like this:
# I made up the first field, not sure what else I might want to put in
this dataframe
dfBaja <- data.frame(Beach="Baja",row.names=("Agua Blanca, Baja
California Sur"))
spdfBaja <- SpatialPolygonsDataFrame(spolBaja, dfBaja, match.ID = TRUE)
writeOGR(spdfBaja,paste(td,"R-Output/Shapefiles",sep=""),"bajaUD",
"ESRI Shapefile")
But once I get that into ArcMap it's just a single polygon.
So I have 2 questions:
1. How do I get all the levels for the home range into a shapefile?
2. I'd like to get my projection information into the SpatialPolygon
object, but it's created in the kver2spol function... is there a way
to set the CRS still?
Thanks for any help or pointers.
Corrie
---
Corrie Curtice
Research Associate
Marine Geospatial Ecology Lab
Nicholas School of the Environment, Duke University
http://mgel.env.duke.edu
em: corrie.curtice at duke.edu
ph: 252-504-7538
cell: 978-857-8266
More information about the R-sig-Geo
mailing list