I'm using Twitter4J to retrieve a user's place from his/her profile. I have a set of geo-coordinates forming a polygon bounds (normally 4 or more coordinates) using this call:
// Status tweet
Place place = tweet.getPlace();
GeoLocation[][] box = place.getBoundingBoxCoordinates();
Is there a way to compute the center (or near-center, or at least a point contained) of this region / polygon / boundary? Is there a Java API for this?
Is there a Java equivalent of this JavaScript code taken from this post:
var bounds = new google.maps.LatLngBounds();
bounds.extend(results[0].geometry.location);
var center = bounds.getCenter();
A simple way is:
centerLatitude = ( min(latitude) + max(latitude) ) / 2
centerLongitude = ( min(longitude) + max(longitude) ) / 2