[R-sig-Geo] (no subject)

Zivan Karaman z|v@n@k@r@m@n @end|ng |rom gm@||@com
Sat Jul 4 11:49:23 CEST 2020


Hi Sourav,

Perhaps replacing "+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"
by
sprintf("+proj=aeqd +lat_0=%f
+lon_0=%f + x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs",  cities [i,3][[1]], cities[i,2][[1]])
etc.
could solve your problem.
HTH
Zivan




Le sam. 4 juil. 2020 à 10:07, Sourav Sarkar <sourav.sarkar using ahduni.edu.in> a
écrit :

> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list