【发布时间】:2014-06-01 13:48:08
【问题描述】:
我正在尝试使用 R 绘制我的坐标。我已经尝试关注不同的帖子 (R: Plot grouped coordinates on world map;Plotting coordinates of multiple points at google map in R),但我的数据并没有取得多大成功。
我正在尝试用我的 gps 坐标作为彩色点(每个区域都有特定的颜色)来实现世界的平面地图:
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's ylim
lon <- c(40.96,37.50) #define our map's 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")
问题是现在我不知道如何添加我的积分,我希望每个区域都使用一种颜色。
有人可以帮我继续前进吗?
我尝试过的另一个选项是:
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
但是坐标在错误的位置结束,我不知道为什么
希望有人能帮忙
【问题讨论】:
-
收到此错误,因此这些点不会显示在来自 URL 的地图地图中:maps.googleapis.com/maps/api/… Google Maps API 服务条款:developers.google.com/maps/terms“我错过了什么吗?
-
today is working :) 现在唯一的问题是,如果我使用 2 的缩放修改缩放以适应同一图中的所有点,卫星地图就会消失,我只看到一个灰色的图经纬度。 mapgilbert
-
我不知道为什么,因为某些原因你不能使用缩放级别 1 和 2。也许 this question & answers 会给你一个可能的解决方案。
标签: r google-maps maps coordinates ggmap