What is the parameter "distance" when using search fql? - facebook-graph-api

What does "distance" refer to? Amount of miles? Radius? I can't find any documentation on it. What's the maximum limit FB will allow us to grab?
$nearby = $facebook->api('/search?type=place&center='.$_GET['lat'].','.$_GET['lon'].'&distance=1000&limit=200');

Distance refers to the radius with respect to the latitude and longitude of the location in meters. As mentioned by Chris, the maximum is 50,000 m.

Related

Have distance from A to B, C, D - How to get latitude and longitude?

I am not a geographer or the like, so please excuse if I should know better. But my question is: Is it possible to get the latitude and longitude of certain places from distance data?
More precisely, I have the great-circle distance in kilometers from various places to Berlin. Can I somehow decompose this distance data into latitude and longitude?
(FYI I am an economic historian and I work with the software package Stata.)
Yep, but the answer depends on how accurate you want to be.
Quick and easy, but not exact: just assume the earth is a sphere, treat the lat/lon as spherical coordinates (using a fixed 6373km radius), perform the translation using normal 3D euclidean geometry techniques, and convert back to lat/lon at the end. A good summary of the calculations necessary is here, but in summary:
Oh dear, no Latex on this site! Screenshots from the math subsite is best I could do sorry.
If you already have arc length, then rearrange the equation to solve for your unknown. You'll also need to know the angle of your arc to solve for two unknowns, lat and long.
If you need to be exact, you'll need to take into account the non-spherical Earth. That means the length in meters of a degree latitude depends on the latitude.
As described here:
Work with those equations and perhaps ask another more specific question if you get stuck. This current site is best if you have a programming question and the https://math.stackexchange.com site is best if you have a maths question.

Calculate driving distance between two geolocation points

Mind if I ask if any of you know how to calculate the actual driving distance between two points when latitude and longitude for both starting and destination points as input? Ps: with help of google API.

Finding the Distance Between Two Lines that represent GPS routes (MATLAB, Java, C++, or Python)

I have been researching and trying to figure this one out to no avail. I have found many ways not to solve this...
The gist of the problem: I am looking for a method to calculate the deviance from an original path traveled by way of GPS coordinates. I have multiple csv files that contain latitude, longitude, and UTC time. I have created KML files from this information for a visual viewing of the deviance and now would like to put a value on this deviation. I ahve chosen a route as a reference and would like to measure the other routes against the reference route. There are multiple routes each having it's own reference route, each of which has many runs. No two runs are the same, and some of the routes deviate more than the next. I cannot use time, only lat and lon since the runs were completed over many weeks of data collection.
What I have tried thus far:
Haversine and Equirectangular formulas (looping through and measuring point to point).
Outcome: The coordinates only line up for a short period of time and the difference in the number of points varies greatly.
Area under each curve: was going to find the difference of the two routes by this method.
Outcome: Really unsure how to proceed, nor find equations suitable for this calculation.
There were a couple more feeble attempts, but have been working on this for a few weeks now, with not much to show for and still unsure on how to proceed.
Any help or ideas would be greatly appreciated.
Possible solution 1: Instead of calculating the "sideways" deviation between the two routes, just compare the respective arc lengths (Matlab: arclength).
Possible solution 2: To compare two routes, each going from the same start A to the same end point B: Draw a straight line between A and B, place a number of equidistant points along AB, and then average the perpendicular distance from these points on AB to the paths you want to compare. The absolute difference between the cumulative deviations from the straight-line reference is your deviation.
Possible solution 3: Calculate the arc length of each route. Place a number of equidistant points along each route. Average the distance between these points.
Both solution 2 and 3 will depend on the number of points you place, but with a higher number of points, the average deviation will converge. Note that these solutions are both related to calculating the area under each curve.

Given a set of points, find smallest subset of points from which circles of n diameter can be drawn to encompass all points

I've got a list of places with associated lat/lon data (sites). I'm trying to find the fewest bases from which to visit the sites (minimizing travel occurrences). Any ideas? I've mostly been working with Python (2.7.3), but any suggestions/examples are welcome.
This can be viewed as the set cover problem.
Using Wikipedia's terminology, your universe will be the cities. If there are m cities, there will be m sets. k-th set will correspond to the k-th city and will include all cities within the required travel radius from k, including k itself. The task is to find the smallest number of sets that cover the universe (put another way, the smallest number of cities from which you can reach every city in your universe).
The bad news is that the problem is NP-hard. There are, however, heuristics.

Population-weighted center of a state

I have a list of states, major cities in each state, their populations, and lat/long coordinates for each. Using this, I need to calculate the latitude and longitude that corresponds to the center of a state, weighted by where the population lives.
For example, if a state has two cities, A (population 100) and B (population 200), I want the coordinates of the point that lies 2/3rds of the way between A and B.
I'm using the SAS dataset that comes installed called maps.uscity. It also has some variables called "Projected Logitude/Latitude from Radians", which I think might allow me just to take a simple average of the numbers, but I'm not sure how to get them back into unprojected coordinates.
More generally, if anyone can suggest of a straightforward approach to calculate this it would be much appreciated.
The Census Bureau has actually done these calculations, and posted the results here: http://www.census.gov/geo/www/cenpop/statecenters.txt
Details on the calculation are in this pdf: http://www.census.gov/geo/www/cenpop/calculate2k.pdf
To answer the question that was asked, it sounds like you might be looking for a weighted mean. Just use PROC MEANS and take a weighted average of each coordinate:
/* data from http://www.world-gazetteer.com/ */
data AL;
input city $10 pop lat lon;
datalines;
Birmingham 242452 33.53 86.80
Huntsville 159912 34.71 86.63
Mobile 199186 30.68 88.09
Montgomery 201726 32.35 86.28
;
proc means data=AL;
weight pop;
var lat lon;
run;
Itzy's answer is correct. The US Census's lat/lng centroids are based on population. In constrast, the USGS GNIS data's lat/lng averages are based on administrative boundaries.
The files referenced by Itzy are the 2000 US Census data. The Census bureau is in the processing of rolling our the 2010 data. The following link is a segway to all of this data.
http://www.census.gov/geo/www/tiger/
I can answer a lot of geospatial questions. I am part of a public domain geospatial team at OpenGeoCode.Org
I believe you can do this using the same method used for calculating the center of gravity of an airplane:
Establish a reference point southwest of any part of the state. Actually it doesn't matter where the reference point is, but putting it SW will keep all numbers positive in the usual x-y send we tend to think of things.
Logically extend N-S and E-W lines from this point.
Also extend such lines from the cities.
For each city get the distance from its lines to the reference lines. These are the moment arms.
Multiply each of the distance values by the population of the city. Effectively you're getting the moment for each city.
Add all of the moments.
Add all of the populations.
Divide the total of the moments by the total of the populations and you have the center of gravity with respect for the reference point of the populations involved.