spatial - Problems is projecting LON/LAT data in R -


i have dataframe contains pm10 concentration in air on seoul(capital city) in korea. please, take look. want plot semivariogram data set. lat/lon data here, in degree have project data. have projected data in way:

library(rgdal)  seoul3112 <- read.csv("seoul3112.csv", row.name=1) seoul3112 <- na.omit(seoul3112)  coordinates(seoul3112) <- ~lon+lat proj4string(seoul3112) <- "+proj=longlat +datum=wgs84"  seoul3112 

after projecting got seoul311 below

        coordinates pm10 1    (126.976, 37.56464)   42 2    (127.005, 37.57203)   37 3   (127.0051, 37.54031)   46 4   (127.0957, 37.54464)   47 5   (127.0411, 37.54311)   46 

q1: found after projecting, value of lon/lat show same value previous data frame. question whats actual function of proj4string(seoul311) = "+proj=longlat +datum=wgs84" command. here, lon/lat(degree) transferred km/m or that?

i tried write code using rgdal package below:

proj4string(seoul3112) <- "+proj=longlat +datum=wgs84"  seoul3112 <- sptransform(seoul3112,                           crs("+proj=utm +north +zone=52 +datum=wgs84")) seoul3112 

after projecting got seoul3112 below

       coordinates     id       time pm10 12      (321241, 4159438) 111121 2012030112   68 173   (323824.6, 4160203) 111123 2012030112   64 334   (323754.6, 4156684) 111131 2012030112   67 495   (331771.9, 4156998) 111141 2012030112   65 656   (326946.2, 4156927) 111142 2012030112   69 

q2. here can see lon/lat value transformed large value! whats meaning of these value? m/km or that? in above code north means what? northern hemisphere?

q3. mentioned earlier, want plot semivarigram on seoul in korea (utm zone 52). so, projection rule should use? should consider utm zone? when should consider utm zone?

i have many confusion projecting data. please answer 3 question in details?

(fyi: it's bad form 3 questions in single post)

q1: didn't "project" in first block of operations. created "spatial" object plain data frame , "stated" coordinate reference system (crs) in. did accurately had lat/lon values. str(seoul3112) see structure of spatialpointsdataframe ended creating.

q2: did "project" coordinates universal transverse mercator (utm) crs. utm grid coordinates expressed distance in meters east, referred "easting", , distance in meters north, referred "northing".

q3: should check suggested "official" government projection recommendations, can away azimuth equidistant south korea (and it's supported in mapproject it's easy work in ggplot):

library(ggplot2) library(ggthemes) library(mapdata)  seoul3112 <- read.csv("seoul3112.csv", row.name=1) seoul3112 <- na.omit(seoul3112)  sk <- map_data("worldhires", "south korea")  gg <- ggplot() gg <- gg + geom_map(data=sk, map=sk,                     aes(x=long, y=lat, map_id=region),                     color="black", fill="white", size=0.25) gg <- gg + geom_point(data=seoul3112, aes(x=lon, y=lat)) gg <- gg + coord_map("azequidistant") gg <- gg + theme_map() gg 

enter image description here

as can see, depending on projection (mapproject supports 41) ggplot can take alleviate need project points first.

but, computing semivariogram, if want work in meters, can do:

coordinates(seoul3112) <- ~lon+lat proj4string(seoul3112) <- "+proj=longlat +datum=wgs84" seoul3112_utm <- sptransform(seoul3112,                               crs("+proj=utm +north +zone=52 +datum=wgs84"))  proj_3112 <- as.data.frame(coordinates(seoul3112_utm)) proj_3112 <- cbind.data.frame(proj_3112, seoul3112_utm@data) 

and compute distances (i'm assuming here):

dists <- dist(proj_3112[,1:2]) 

and finish model. nlme, geor , few other r packages can semivariogram model development , calculation (and plotting).


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -