When I search using radius parameter, It returns inaccurate results. For example, radius=400, it returns distance is greater than 400. I'm wondering if the distance is not the straight line distance? Or it is a bug from foursquare api?
The radius parameter is "only valid for requests with intent=browse, or requests with intent=checkin and categoryId or query. Does not apply to match intent requests." See documentation here. Are you using a different 'intent'?
Related
I'm running into an odd problem using the snap to route feature of the Bing Maps REST API. It works great for most of the GPS coordinates I send it -- they were recorded by me on a recent motorcycle trip, so they're "contiguous" -- but fails silently for others.
As in, the returned status code is 200...but rather than returning SnapToRoadReponse objects it returns Route objects. Which lack any of the snapped-to coordinates I need.
What's particularly interesting is the problem occurs in the middle of processing the entire route. In other words, it works fine for 6 or so invocations (each with around 100 points), fails for a number of invocations, and then works fine for the remaining invocations.
Is there a rate limit on how frequently you can access the snap-to service? I'm using just a basic Bing Maps account but could program around rate limitations easily enough (e.g., by waiting beyond invocations). But I couldn't find reference to such in the documentation I reviewed.
Or maybe Bing Maps just doesn't like the hills east of Santa Rosa and the 101 corridor south from there other the Golden Gate Bridge... :)
Turns out the problem was sending too many points through the request pipeline. The Bing Maps REST API requires/strongly advises not to use GET requests involving more than 100 geographic points. I assumed the Bing Maps REST Toolkit took care of ensuring larger requests were done as POSTS. It does not, however, appear to do that.
Reducing the number of geographic points to no more than 100 per request solved the problem.
The portion of my route which was causing problems involved high speed freeway travel, which caused my code to interpolate additional points for each set of observed data points so as to ensure no two points were more than 2.5 kilometers apart (that's a Bing Maps hard limit). That drove the total number of points for each request along that stretch of the route to over 100 points, causing the problem I encountered.
I would like to calculate a graph similiar to an isochrone using pgsql. Therefore, I already used the algorithm pgr_drivingDistance. You provide a starting point and a distance value and receives an isochrone.
The output using the algorithm is received with code which looks something like:
SELECT * FROM pgr_drivingDistance(
'SELECT id, source, target, cost FROM edge_table',
2, 2, false -- starting point, distance, directed
);
The red star represents the starting point.
Now, I want a graph which works the same way, like starting at one point and get routes in all directions. The difference is, that I don't want to provide a travel distance, but a list with point coordinates, which are lying on the road network. The route in every direction has to stop at the first reached point lying on each route. The distance on every route is different and I don't know which points are the closest ones.
The desired output using the "stopping" points, which are visualized in green, is supposed to look like this.
I tried already:
Using the given algorithm pgr_drivingDistance and raising the distance value every time no point is reached -> problem here: the distance is equal for all directions and not individual for each route.
Using the algorithm pgr_dijkstra for each route -> problem here: because you don't know which point is affected you don't know which end point to choose for the calculation. You also cannot take the closest one in the immediate vicinity because you need the closest one on the specific route.
I know that I have to build an almost complete new algorithm, but maybe someone has an idea how to start or even experience with this kind of problem.
Thank you in advance!
This is a one to many routing problem. You have to compute the route to each end point to find the shortest one. I have not looked at the pgRouting function recently, but I believe there is a one to many, many to one and many to many Dijkstra function(s). You should be able to use the one to many to compute all the routs in one go and then you can sort the routs based on length to find the shortest one.
Is it possible to rank search results based solely on proximity (and other filters) to a specific point and ignore the custom ranking formula (likes)?
For example, I'd like to rank results closest to times square strictly by distance and for the query to not care about the likes attribute.
I suppose the likes attributes is one of you own.
You can do what you need by removing the attribute like from the custom ranking.
If you need 2 way to search, you can do a replica index, with the same data but a different ranking formula: https://www.algolia.com/doc/guides/ranking/sorting/?language=go#multiple-sorting-strategies-for-an-index
I am trying to use Facebook Graph API to retrieve a set of places at a certain coordinate.
Using the API, I executed the following query:
https://graph.facebook.com/search?access_token=APPTOKEN&type=place¢er=3.187501,101.627542&distance=50000&limit=500
Theoretically, this query should return 500 places within 50km of that coordinate. However, it only returned some 15 results that are within the immediate vicinity (say few hundred meters) of that coordinate. I tried changing the distance to 10000, 5000 or even 1000, while tweaking the limit parameter to figures such as 50, 100, 1000 but the total results remain the same.
There are certainly other places nearby, i.e. if I change the query's coordinates to the following location which is less than a kilometer away, it returns a whole new result set:
https://graph.facebook.com/search?access_token=APPTOKEN&type=place¢er=3.192022,101.625647&distance=50000&limit=500
Can someone please advice if my query is problematic, or that Facebook's Graph API is somehow limiting the distance or total results?
Thank you.
The fact that you only get 15 places in that kind of search was a bug on Facebook.
This bug has been solved today so your query should work better now (I actually tried and it does). Anyway here you can see more details about this bug.
What I personally don't know is this: Now your query returns around 450 results, if you limit it to 5km instead of 50km is still more or less the same amount of places.
I tried queries with different distances and coordinates, seems to me that Facebook limits your total amount of results so you never have more than around 450 places.
Even using pagination (with an offset) I can't manage to get more results (and I know there are more than 500 places within 50km around New York...)
So if you find the answer to this I would be interested ;)
I am encountering a similar problem, I have built a tool to return geo-locale results based upon keyword, city/state (or zip code) and radius up to 30 miles. What used to work flawlessly up until early December 2013 started to return only 15 results in late December. My "educated guess" is that FB is limiting results to prevent people like you and me from turning a profit from this information!!!
I have a map with about 80 annotations. I would like to do 3 things.
1) From my current location, I would like to know the actual route distance to that position. Not the linear distance.
2) I want to be able to show a list of all the annotations, but for every annotation (having lon/lat) I would like to know the actual route distance from my position to that position.
3) I would like to know the closest annotation to my possition using route distance. Not linear distance.
I think the answer to all these three points will be the same. But please keep in mind that I don't want to create a route, I just want to know the distance to the annotation.
I hope someone can help me.
Best regards,
Paul Peelen
From what I understand of your post, I believe you seek the Haversine formula. Luckily for you, there are a number of Objective-C implementations, though writing your own is trivial once the formula's in front of you.
I originally deleted this because I didn't notice that you didn't want linear distance at first, but I'm bringing it back in case you decide that an approximation is good enough at that particular point of the user interaction.
I think as pointed out before, your query would be extremely heavy for google maps API if you perform exactly what you are saying. Do you need all that information at once ? Maybe first it would be good enough to query just some of the distances based on some heuristic or in the user needs.
To obtain the distances, you could use a Google Maps GDirections object... as pointed out here ( at the bottom of the page there's "Routes and Steps" section, with an advanced example.
"The GDirections object also supports multi-point directions, which can be constructed using the GDirections.loadFromWaypoints() method. This method takes an array of textual input addresses or textual lat/lon points. Each separate waypoint is computed as a separate route and returned in a separate GRoute object, each of which contains a series of GStep objects."
Using the Google Maps API in the iPhone shouldn't be too difficult, and I think your question doesn't cover that, but if you need some basic example, you could look at this question, and scroll to the answer.
Good Luck!
Calculating route distance to about 80 locations is certain to be computationally intensive on Google's part and I can't imagine that you would be able to make those requests to the Google Maps API, were it possible to do so on a mobile device, without being severely limited by either the phone connection or rate limits on the server.
Unfortunately, calculating route distance rather than geometric distance is a very expensive computation involving a lot of data about the area - data you almost certainly don't have. This means, unfortunately, that this isn't something that Core Location or MapKit can help you with.
What problem are you trying to solve, exactly? There may be other heuristics other than route distance you can use to approximate some sort of distance ranking.