データサイエンティスト上がりのDX参謀・起業家

データサイエンティスト上がりのDX参謀・起業家のブログ。データ分析や事業について。自身はアーティスト、経営者、事業家。

Extension of RgoogleMap

twitter ID @dichika shows useage of RgooglMap

http://d.hatena.ne.jp/dichika/20110225


I extended this code and want to show.


First, function "ggmap3" is loaded.

https://github.com/dichika/R/blob/master/ggmap3.R


Next, below codes is loaded.

library(XML)
library(RCurl)
library(RgoogleMaps)
library(ReadImages)

address <- data.frame(addr=c("東京都港区六本木6-10-1",
			     "東京都港区赤坂九丁目7番1号",
			     "東京都渋谷区代々木四丁目30番3号",
			     "東京都千代田区霞が関1-1-1" ),
			      stringsAsFactors = FALSE )

map <- ggmap3(locationdata=address, mapname="sample.jpg", num=1)

PlotOnStaticMap(map)

This sample addresses is Japan's.

Result of this code was shown at @dichika's blog.


This picture was drawn by "plot" both xlim and ylim are -300 to 300, this is checked by below code.

PlotOnStaticMap(map)

text(seq(-1000,1000,by=10),seq(-1000,1000,by=10))
points(0, 100, cex = 3, pch = 19, col = "#950000")

Result is this.


Next, I changed address Japan to World.

address2 <- data.frame(addr=c("Japan", "Paris", "australia"), stringsAsFactors = FALSE )
map2     <- ggmap3(locationdata=address2, mapname="sample.jpg", num=1)

PlotOnStaticMap(map2)
text(seq(-1000,1000,by=10),seq(-1000,1000,by=10))
points(0, 100, cex = 3, pch = 19, col = "#950000")



Whatever the map change the scale of plot never change, both xlim and ylim are -300 to 30.

The position of the red dot and line of numbers are not changed.