I'm trying to plot my coordinates with R. I already tried following another message ( R: group grouped coordinates on a world map ; Plotting the coordinates of several points on a google map in R ), but I'm not very good at my data.
I am trying to create a flat world map with gps coordinate as colored dots (each area has a specific color):
area lat long Agullhas -38,31 40,96 Polar -57,59 76,51 Tasmanian -39,47 108,93 library(RgoogleMaps) lat <- c(-38.31, -35.50) #define our map ylim lon <- c(40.96,37.50) #define our map xlim center = c(mean(lat), mean(lon)) #tell what point to center on zoom <- 2 #zoom: 1 = furthest out (entire globe), larger numbers = closer in terrmap <- GetMap(center=center, zoom=zoom, maptype= "satallite", destfile = "satallite.png")
the problem is that now I donβt know how to add my glasses, and I will like one color for each region.
Can someone help me move forward?
another option i tried:
library(maps) library(mapdata) library(maptools) map(database= "world", ylim=c(-38.31, -35.5), xlim=c(40.96, 37.5), col="grey80", fill=TRUE, projection="gilbert", orientation= c(90,0,225)) lon <- c(-38.31, -35.5) #fake longitude vector lat <- c(40.96, 37.5) #fake latitude vector coord <- mapproject(lon, lat, proj="gilbert", orientation=c(90, 0, 225)) #convert points to projected lat/long points(coord, pch=20, cex=1.2, col="red") #plot converted points
but the coordinates end in the wrong position and I'm not sure why
Hope someone can help