How do I get more locations? - javascript

I am trying to get some locations in New York using FourSquare API using the following API call:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&limit=50
What I don't understand is that if the call imposes a limit of 50 search results (which is the maximum), how can I get more locations? When using Facebook API, the results being returned were random so I could issue multiple calls to get more results but FourSquare seems to be returning the same result set. Is there a good way to get more locations?
EDIT:
Ok. So there was a comment saying that I could be breaking a contractual agreement and I am not sure why this would be the case. I would gladly accept a reasoning for this. My doubt is this: Let us say that hypothetically, the location I am searching for is not in the 50 results returned? In that case, shouldn't there be a pagination mechanism somewhere?

The API docs here can help.
Foursquare searching is very closely linked to the location 'point' (the 'll' param on the query) that you provide. The simple answer is that to find more venues within a given area, you need to simply query again with a different location 'point' within that area.
Two queries, both at points close to one another:
https://api.foursquare.com/v2/venues/search?ll=40.700,-74.000&limit=50
https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50
will get you two different sets of venues (that may overlap, depending on how close the points are).
The default intent for the search method is 'checkin', which will return the 50 most popular locations closest to that point. If instead you want to look at all the venues within an area, you can use the 'browse' intent. This takes either a 'radius' parameter, in which case it returns venues inside a circle around the given point with the given radius, or it takes two coordinates representing the 'sw' and 'ne' corners of a rectangle. So, you could do:
https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50&intent=browse&radius=50
which will give you 50 venues within the 50m circle around that point. A smaller radius will reduce the number of venues returned. So, by varying the radius and the point at which you search (or the size and position of the rectangle described by the 'sw' and 'ne' parameters), you can get more venues returned.
Hope that helps.

The current API limits results to 50. You should try altering your coordinates to be more precise to avoid not finding your venue.
Pagination would be nice but 50 is a lot of venues for a search.

Related

queryFeatures is not returning all intersected features

Intended effect
When user clicks on a polygon feature (a county, region, or neighborhood/municipality) or uses the "Draw" widget, a dashboard card displays the number of intersected point features returned by queryFeatures() (see below).
localitiesLayer.queryFeatures(query).then(function(results) {
var queriedLocalities = results.features;
if (queriedLocalities.length > 0) {
var fossilsFound = queriedLocalities.length;
}
}
Issue
The maximum number of returned intersected features is 2,000 even when more than 2,000 point features have been selected.
In the photo below, there are only "2000 fossil sites in the area!" when there should be over 3,000 features returned.
Troubleshooting
The issue is fixed when instead of querying the localitiesLayer feature layer, a feature layer view is instead queried. This introduces the unsolvable issue of the number of localities returned by queryFeatures changing depending on the level of zoom (as detailed in the API Reference for queryFeatures of FeatureLayerView).
Since it seems I'm stuck using a server-side query, I need to understand why this is happening at such a seemingly arbitrary number.
At first I thought it was related to possible topology issues between features, but why would that affect the polygon generated by the Draw widget? Before writing this question I also ran the integrate tool on all features layers just to make sure that there wasn't any non-coincident polygons.
Question
Why is the upper limit of features returned by the queryFeatures() on the localitiesLayer 2,000 even when more than 2,000 point features intersect with a selected polygon?
Why does querying with a feature layer view fix this issue (though as detailed above is not a valid solution to this problem)?
CodePen of app with bug
Usually feature services has a maximum amount of features to retrieve in one query. This is what is happening here.
You can check the service endpoint of the layer (LAU_Localities_View - 0) to find these value in Max Record Count, here set to 2000.
So you will have to use some other technique in order to have all the values. One simple way is to iterate and query with an extra condition using a field as last index, for example OBJECTID. You will have to order the result by the index field.

here maps - showing places through entire route

I am facing one problem in HERE corridor api. If I search for long route and there are so many restaurants at one place on route, then it gives max of 1000 records at the same place.
So is there any way that I can get maximum of say 10 records at each place, so that I can get places all over the route?
I have tried width of the route with the category filter set as 'restaurant', now the problem with this is when we search for longer distances there are just too many records for restaurants and the response only returns all the restaurants around the source only and not all along the way till the destination.
I understand that this could be a practical limitation given the number of records for a given category, but would like to know if there are any workarounds at all for this problem.
Basically, I want to get places all over the route.
Thank you so much for your help.
Please refer the link below
https://places.cit.api.here.com/places/v1/browse/by-corridor?route=%5B18.9386%2C72.8242%7C15.48%2C73.8061%5D%3Bw%3D10000&cat=petrol-station&size=500&app_id={app_id}&app_code={app_code}
do not forget to add your app id and code, sorry I cannot comment hence posted it here.

UK postcodes with SimpleMaps

I'm using this simple maps plugin on a site that I'm currently building http://simplemap-plugin.com/demo/ It's based on google maps API. I only have Zip (in the UK postcode) input visible so this has to be used as a base for the search. The search functionality works fine if you use a full postcode for example W1U *PZ but if you simply type W1 you end up getting a result for a road in Algeria. Does anyone know if there is away in the gMaps API to only search postcodes and exclude any Roads, so that typing the start of a postcode (the area code) will give the desired result.
Perhaps the simplest way would be to simply limit the results to a specific country, in this case I'm presuming the UK.
https://developers.google.com/maps/documentation/geocoding/#RegionCodes
The problem you're going to have with such a query however is how to decide which result to return, simply querying 'W1' is going to return an series of arbitrary addresses whose postcodes contain 'W1' for example NW1. You may be best specifying a minimum length?

To show the route by clicking between two points on Google map in Blackberry

I am using JavaScript code to show the multiple pin points on Google Maps using Brownfield. I set the first clicked point as the center point, and when the user clicks on any other point (which is not the center point) I want to display a route mapped from the center point to that clicked point.
I would appreciate help of any sort, including ideas besides using JavaScript.
Google has a number of services available to people who program using their Maps. Go to https://developers.google.com/maps/documentation/javascript/reference and check out the directions services. I'm not very familiar with them, but I'm guessing it's similar to their other services. You make a directions request object supplied with point a and point b, and it will send a message to Google asking for the appropriate directions, which will be returned in some sort of result object that you can use to show the way. Update point b each time the user clicks and resend the google request, and it should update the path. Check out the API and it shouldn't be too hard to get it working. As for alternatives to javascript, Google Maps is written all in javascript, so there really is no other way. But I know from experience, most of their supplied code works really well, so I bet you can get it working!
Following link will show the route between two points:
J2ME/Android/BlackBerry - driving directions, route between two locations

How to retrieve all positions of a profile, including past ones

I have tried several things to be able to retrieve all positions of a profile, including past ones and somehow it still does not work.
I only manage to get past positions of my direct connections, then even those 2 or 3 degrees away, I only see present positions via the API even though I can see all positions via the website.
I tried the technique described here : https://developer.linkedin.com/documents/accessing-out-network-profiles also, and even for profiles which are 3 degrees away from me (so not out of network), this method keeps only returning the current positions. I used the specified headers and everything, still only current positions returned.
Could you please give me a working example of how to retrieve ALL positions for a 2 or 3 degrees connection via API, ideally REST and also Javascript ?
Is it even possible given the current API ?
I guess it should, since I can see the information via the website, it should be somehow available via API...
Thanks.
The API documentation for the available Profile Fields list which fields are available given the relationship with the viewer. Right at the top, there is a table that states that for anyone other than 1st degree connections, with regards to position data it will only return "Current positions only":
So it looks like the public API only allows you to retrieve past positions for immediate connections.

Categories