Question

I am using the Twitter4j API to get all streaming tweets in a given area.

FilterQuery is used to define this query and accepts co-ordinates for a bounding box search area in the following format:

double box[][] = {{lon1, lat1}, {lon2, lat2}};
new FilterQuery(count, idToFollow, stringsToTrack, box);

Given my centre points (latOriginal,longOriginal), and my radius (radius), is there a clever way of calculating these bounding box value co-ordinates?

Thanks

Was it helpful?

Solution

the bounding box is 2R across and 2R high.

var north = google.maps.geometry.spherical.computeOffset(center, radius, 0).lat();
var east  = google.maps.geometry.spherical.computeOffset(center, radius, 90).lng();
var south = google.maps.geometry.spherical.computeOffset(center, radius, 180).lat();
var west  = google.maps.geometry.spherical.computeOffset(center, radius, -90).lng();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top