[R-sig-Geo] Guam island map

Robert J. Hijmans r.hijmans at gmail.com
Tue Apr 27 18:38:49 CEST 2010


Here is one approach (out of many)

library(raster)
guam = getData('GADM', country='GUM', level=0)
library(maps)
data(world.cities)
cit = subset(world.cities, country.etc == 'Guam')

plot(guam, col='grey', lwd=2)
points(cit$lon, cit$lat, col='red', pch=19)


Robert

On Tue, Apr 27, 2010 at 9:17 AM, Bin Li <bli at lsu.edu> wrote:
> I am trying to draw a map of Guam island in R. Basically, I'd like to draw the coastlines of the island and point some cities on it. I tried maps package but output a line (see the code below).
>
> library(maps)
> data(world.cities)
> try<-which((world.cities[,5]>144.6)&(world.cities[,5]<144.94))
> world.cities[try,]
> map("world", "USA:Guam")
>
>
> Any feedback is welcome. Thanks.
>
> Bin
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list