Re: [R-sig-Geo] create coordinates of columbus data for knearneigh

2009-03-19 Thread Nikhil Jha
Dear R users, Please ignore the following question about replicating coords in columbus example for knearneigh!create coordinates of columbus data for knearneighApparently I messed up when looking for help coordinates. My sincere apologies. Nikhil [[alternative HTML version deleted]] _

[R-sig-Geo] Generate lines in ascii format using X1Y1 and X2Y2

2009-03-19 Thread Tyler Dean Rudolph
I am trying to find the best way to turn some representation of a line based on 2 pairs of xy coordinates into ascii format in order to extract habitat information associated with used versus randomly generated animal movement paths. I have approximately 33,000 observations (trajectories) to proc

[R-sig-Geo] create coordinates of columbus data for knearneigh

2009-03-19 Thread Nikhil Jha
Hi, I would appreciate help with a fairly basic question. I want to use knearneigh in spdep package. My data set has x-y coordinates like the columbus data has. And I am trying to replicate coords in knearneigh example When I try to create coordinates using for example xy<- cbind(X,Y) I do no

Re: [R-sig-Geo] Extract coordinates from SpatialPolygonsDataFrame

2009-03-19 Thread hadley wickham
I have the following code in ggplot2 for turning a SpatialPolygon into a regular data frame of coordinates. You'll need to load ggplot2, and then run fortify(yoursp). fortify.SpatialPolygonsDataFrame <- function(shape, region = NULL) { attr <- as.data.frame(shape) # If not specified, split in

Re: [R-sig-Geo] Extract coordinates from SpatialPolygonsDataFrame

2009-03-19 Thread Torleif Markussen Lunde
a small correction. in the loop; replace if (size != 1) lonlat2 ... with if (size != 2) lonlat2 ... best Torleif On Thursday 19 March 2009 10:37:42 pm Torleif Markussen Lunde wrote: > Hi > > In your case I guess you only need part 1. If there are more than 1 polygon > you would also need part 2

Re: [R-sig-Geo] Extract coordinates from SpatialPolygonsDataFrame

2009-03-19 Thread Torleif Markussen Lunde
Hi In your case I guess you only need part 1. If there are more than 1 polygon you would also need part 2. As far as i know there are no inbuilt functions to extract coordinates from a SpatialPolygon. ## #part 1 nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],

[R-sig-Geo] Extract coordinates from SpatialPolygonsDataFrame

2009-03-19 Thread Tyler Dean Rudolph
Hi there, Nestled deep within the "polygons" slot of my SpatialPolygonsDataFrame object is a list of xy coordinates I would like to extract. Using coordinates() only produces a single xy pair associated with the polygon (1st entry? Centroid?) and I cannot for the life of me manage another way, t

Re: [R-sig-Geo] Merging data frame for SpPolDF

2009-03-19 Thread Torleif Markussen Lunde
Hi It might be we are talking about different things. What I understand is that you have an original shp-file with unique IDs associated with each Polygon. In the shape-file these are named "letras". In addition to this you have a data.frame with variables "letters" which matches the ones in "l

[R-sig-Geo] Generate lines using start and end coordinates

2009-03-19 Thread Tyler Dean Rudolph
Hi all, For every unique "i" in 1:nrow(mydata) I have two sets of spatial "x" and "y" coordinates, one set for the start of the line (c("x", "y")) and another set for the end of the line (c("X2", "Y2")). Essentially I am looking for the simplest and fastest way of creating a series of coordinates

Re: [R-sig-Geo] Merging data frame for SpPolDF

2009-03-19 Thread Agustin Lobo
Thanks. I might be wrong, but I think that your example is different. The problem comes up when the second dataframe does not have values for all cases that are present in the first one. For example > a1 <-data.frame(letras=c("A","B","C","D"),nums=c("1","2","3","4")) > a2 <-data.frame(letras=c("

Re: [R-sig-Geo] Merging data frame for SpPolDF

2009-03-19 Thread Torleif Markussen Lunde
Hi Maybe this can help? Please correct me if this is not what you wanted. require(maptools) nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], proj4string=CRS("+proj=longlat +datum=NAD27")) #Create dummy data. Do some changes to make it look differen

[R-sig-Geo] automap available from CRAN

2009-03-19 Thread Paul Hiemstra
Dear people, Today I uploaded automap to CRAN, automap is an automatic interpolation package building on gstat. It should be available at a mirror near you very soon. Any remarks on the code or the documentation are more than welcome. cheers, Paul -- Drs. Paul Hiemstra Department of Physica

Re: [R-sig-Geo] Error in if (dxsd > tolerance) { : missing valuewhere TRUE/FALSE needed

2009-03-19 Thread Wesley Roberts
Many thanks Edzer, gridded is now working a charm on my data. Regards, Wesley >>> Edzer Pebesma 03/18/09 9:58 PM >>> A quick solution could be to convert it into a SpatialPointsDataFrame object (gridded(x) = FALSE), before doing the selection that broke your script. If it still breaks, you mi

[R-sig-Geo] Merging data frame for SpPolDF

2009-03-19 Thread Agustin Lobo
Hi! I often have to add more information to the data slot of a SpPolDF imported from a shp file. I do it in this way, don't like it too much and would like feed-back on a better way- #Import shp MMAMBmuni <- readOGR("C:/Pruebas/DUNS/MMAMBmuni", layer="MMAMBmuni") #Extract the DF MMAMBmuniDFori <

Re: [R-sig-Geo] Error in multiple && !outer : invalid 'x' type in 'x && y'

2009-03-19 Thread Roger Bivand
On Thu, 19 Mar 2009, Jim Burke wrote: A partial answer. plot() these separately shows they plot at vastly different dimensions in order to fill the plot frame. I will try a merge in R and see what happens. Please *do* run traceback() after error messages like these - it takes a very long tim