[R-sig-Geo] plotting geographic coordinates on a map
Robert Hijmans
r.hijmans at gmail.com
Fri Jul 15 02:29:34 CEST 2011
> I simply would like to plot these on a map of the US. I've tried all sorts
of approaches, including
>> map('usa', project='albers', par=c(39,34))
>> points(x=data$LONGITUDE, y=data$LATITUTUDE, col='red')
You are plotting longitude/latitude data on an map with Albers projection.
Won't give you what you want.
Either transform the long/lat data to Albers (with the right parameters),
e.g. using spTransform (rgdal package), or do:
library(maps)
map('usa')
points(x=data$LONGITUDE, y=data$LATITUTUDE, col='red')
#You can have a look at the difference in coordinates like this
map('usa')
locator(1) # click on the center of the map
map('usa', project='albers')
locator(1) # click on the center of the map
>> library(sp)
>> coordinates(WNV) <- c("latitude", "longitude")
>> map('world')
>> plot(WNV$latitude, WNV$longitude)
Instead, do:
map('world')
plot(WNV, add=TRUE)
#or
points(WNV)
Hth, Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/plotting-geographic-coordinates-on-a-map-tp6583747p6585473.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list