[R-sig-Geo] (no subject)

Sourav Sarkar @our@v@@@rk@r @end|ng |rom @hdun|@edu@|n
Sat Jul 4 10:07:16 CEST 2020


Hi All,
I have a sf dataframe (cities) of point locations of about a hundred cities
in India with latitudes in the second column and longitudes in the third
column. I am trying to create a geodesic buffer around each of these points
by projecting them to azimuthal equidistant projection centred at the
respective point and then using the st_buffer function.

The error is occuring when I try to centre the equidistant projection to my
preferred latitude and longitude since lat_0 and lon_0 accept only numbers
which I do not want to put manually. From searches over the internet, it
seems to me that probably something related to paste or \"" needs to be
applied but since I am not an expert I am unable to get the correct code.

My code looks something like this:
a <-st_transform(cities[i,], "+proj=aeqd +lat_0=cities [i,3][[1]]
+lon_0=cities[i,2][[1]] + x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs")
buffer_aeqd =st_transform(cities[1,], "+proj=aeqd +lat_0= cities[1,3][[1]]
+lon_0= cities[1,2][[1]] + x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs")
buffer_aeqd=st_buffer(buffer_aeqd, 50000)
buffer_aeqd=st_transform(buffer_aeqd, 4326)

for (i in 2:nrow(cities)){
a =  st_transform(cities[i,], "+proj=aeqd +lat_0=cities [i,3][[1]]
+lon_0=cities[i,2][[1]] + x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs")
a=st_buffer(a, 200000)
a=st_transform(a, 4326)
buffer_aeqd=rbind(buffer_aeqd, a)
}
remove(a)

It will be very nice if you can give me some leads. Thank You very much in
advance.

Yours sincerely,
-- 
Sourav Sarkar,
Assistant Professor,
School of Arts and Sciences,
Ahmedabad University

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list