I'm creating a program using the Bing Maps API where the user inputs a bounding box with lat/long, and the program extracts a number of static images at zoom level 15 to later be mosaicked together.
If each square image is about 4100 meters wide, and the first image starts with its corner at (47.602030, -122.331572), what are the coordinates of the second image 4100 m to the east?
Here is an image to illustrate what I'm doing. The user-entered bounding box is black, the 4100 m long images are blue.
I'm using the
RgoogleMaps package in R to access the Bing Maps API, so here is the R code used to calculate the ground distance of each image.
library(geosphere) # bounding box coordinates (lower left , upper right lat/long) extent1 <- c(47.602030, -122.331572, 47.619620, -122.291746) # size of pixel in meters for zoom level 15 at given latitude groundres <- (cos(extent1 * pi/180) * 2 * pi * 6378137) / (256 * 2^15) # image height/width in meters for zoom level 15 img.size <- 640*groundres # ground distance of bounding box (top corners) extent1.m <- distRhumb(extent1[c(2,3)], extent1[c(4,3)], r=6378137) # optimal number of images ceiling(extent1.m/img.size) # find lat/long of second image?
Edit: In addition to maptastik's answer, I found that package
has a function
destPointRhumb() and similar functions that calculate a second point given an initial point, bearing, and distance.