Is it possible to get places by latitude/longitude and radius using the Graph API (or by开发者_JAVA技巧 address/zip)? I don't see it anywhere in the documentation
The following format for the search URL will return a list of places near a location:
https://graph.facebook.com/search?type=place¢er=<lat>,<lon>&distance=1000&access_token=<token>
I'm not sure on the units of the "distance" parameter.
I don't know much about the facebook API, but if you can pull the lat/long of two places, you can calculate their distance quite easily. Here it is in JavaScript, but it's portable to about any language:
var R = 6371; // km .. use 3963 for miles
var dLat = (lat2-lat1).toRad();
var dLon = (lon2-lon1).toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c; // km
Hopefully this helps you with your endeavor.
精彩评论