Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 6/12/13 10:26 PM, "L S" <losedaghat at gmail.com> wrote:
>Hi,
>
>I am new to doing spatial analysis. I am interested in trying many things
>in R, but one of the first things I would like to do is plot all of my
>lat,
>lon points in a csv file within a window defined by a shapefile.
>
>I have read in the shape file by doing the following:
>border <-readShapePoly("shapefiles/maryland.shp")
>plot(border, border="red", las=1) # plot confirms correct shape
>border <-as(border, "owin")
>
>However, once I try to do:
>data_ppp <-ppp(data$Latitude, data$Longitude, window=border)
>
>I get the error that:
>In ppp(data$Latitude, data$Longitude, window = border) :
> 523461 points were rejected as lying outside the specified window
>
>I realized that the coordinates are completely different. The coordinates
>in my data file (i.e. my csv file) are traditional GPS coordinates (e.g.
>39.17
>or 76.37). The shapefile however has x,y values such as 1416813.54262877
>or 561125.546602725. I am not familiar with what type of coordinate system
>those values use.
>
>How can I change the coordinates in my csv file to match the same system
>as
>my shapefile or the other way around--i.e. to get my shapefile to have
>similar coordinates as my csv file?
>
>Any help would be appreciated.
>
>Thank you.
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.