IT기술/BigData

서울시 각 구청의 위치를 지도에 표시하기

dobbby 2014. 2. 28. 15:34
반응형

> library(ggplot2)

> library(ggmap)

> setwd("d:/yul/temp")

> loc <- read.csv("서울시구청위치정보.csv",header=T)

> loc

       구청명      LAT      LON

1    강남구청 37.52579 127.0483

2    서초구청 37.49093 127.0329

3    동작구청 37.51871 126.9364

4    구로구청 37.50237 126.8890

5    양천구청 37.52007 126.9549

6  영등포구청 37.54240 126.8402

7    관악구청 37.48467 126.9515

8    용산구청 37.53804 126.9913

9  서대문구청 37.58567 126.9357

10   마포구청 37.57003 126.9019

11   은평구청 37.60675 126.9302

12   종로구청 37.57615 126.9790

13     중구청 37.56798 126.9975

14   성북구청 37.59342 127.0172

15 동대문구청 37.57792 127.0401

16   중랑구청 37.60961 127.0931

17   노원구청 37.65664 127.0559

18   도봉구청 37.67214 127.0462

19   강북구청 37.64278 127.0253

20   광진구청 37.54104 127.0826

21   강동구청 37.53246 127.1237

22   송파구청 37.51803 127.1056

> kor <- get_map("seoul", zoom=11, maptype="roadmap")

Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=seoul&zoom=11&size=%20640x640&scale=%202&maptype=roadmap&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=seoul&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

> kor.map <- ggmap(kor) + geom_point(data=loc, aes(x=LON, y=LAT), size=3, alpha=1)

> kor.map + geom_text(data=loc, aes(x = LON, y = LAT+0.01, label=구청명), size=3)

> ggsave("d:/yul/temp/gu.png", dpi=500)





> kor <- get_map("seoul", zoom=11, maptype="terrain")

Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=seoul&zoom=11&size=%20640x640&scale=%202&maptype=terrain&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=seoul&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

> kor.map <- ggmap(kor) + geom_point(data=loc, aes(x=LON, y=LAT), size=3, alpha=1)

> kor.map + geom_text(data=loc, aes(x = LON, y = LAT+0.01, label=구청명), size=3)





> kor <- get_map("seoul", zoom=11, maptype="satellite")

Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=seoul&zoom=11&size=%20640x640&scale=%202&maptype=satellite&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=seoul&sensor=false

Google Maps API Terms of Service : http://developers.google.com/maps/terms

> kor.map <- ggmap(kor) + geom_point(data=loc, aes(x=LON, y=LAT), size=3, alpha=1)

> kor.map + geom_text(data=loc, aes(x = LON, y = LAT+0.01, label=구청명), size=3)





반응형