I have 4 places - origin, destination and 2 waypoints. I am trying to make Google Directions API call to get the most optimal route through those two waypoints. The problem is that Google API doesn't reorder my waypoints according to the optimal route, but it creates a route including the waypoints in the initial order that I defined in the call.
The wanted route is as following:
Origin
Waypoint 2
Waypoint 1
Destination
Received route output is as following:
Origin
Waypoint 1
Waypoint 2
Destination
Here is the API call I tried:
https://maps.googleapis.com/maps/api/directions/json?origin=46.3526877,16.8123505&destination=46.3091764,16.3420242&waypoints=optimize:true%7Cvia:46.3380636%2C16.6129778%7Cvia:46.3258985%2C16.7827804&alternatives=true&key=GOOGLE_API_KEY
I tried adding "optimizeWaypoints" parameter but I always get an empty "waypoint_order" array (which should contain waypoints in the correct order so that the route will be optimal according to the documentation).
Here is the API call with "optimizeWaypoints" parameter added:
https://maps.googleapis.com/maps/api/directions/json?origin=46.3526877,16.8123505&destination=46.3091764,16.3420242&waypoints=via:46.3380636%2C16.6129778%7Cvia:46.3258985%2C16.7827804&alternatives=true&optimizeWaypoints=true&key=GOOGLE_API_KEY
Can someone please point me in the right direction?
Thanks!
Try setting stopover to true for your waypoints. This is what I had to do to.
Link to Google API
Google maps does not automatically optimize routes for multiple destinations. You got to use Google distance matrix api or something similar. Try this: https://d3o9xul5a19dde.cloudfront.net
There is an API as well, in addition to web interface.
Related
I need to find all zipcodes within a given radius. I've googled a page that does exactly that: https://www.freemaptools.com/find-zip-codes-inside-radius.htm but its author doesnt respond. Any ideas how he did that?
Here's a product ZipCodeAPI that does that.
Use this API to find all US zip codes within a given radius of a zip code. Send a GET request to https://www.zipcodeapi.com/rest/<api_key>/radius./<zip_code>//.
There is a free subscription and a paid subscription available.
I have a requirement to show airports close to a particular lat/long with a specific radius. For that, I used google search nearby APIs below.
My problem is that I want to get only airport info but the problem is the API is fetching helipad too. How I can be more specific? Query URL :
https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=keyVal&location=lat,long&radius=10000&type=airport
Is there any way to filter the results to get airports only from the above ?
I believe that's how this endpoint works. But there is always a way to filter results as per your requirement. I can help more if you provide the how the response JSON looks like.
We tried in many ways without success.
Can only get one main picture.
(There was a question posted before on this topic Amadeus Hotel API Images, however the answer doesn't work.)
You can get more images using the second endpoint of the Hotel Search API and adding the parameter &view=FULL_ALL_IMAGES
For example:
https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=BGMILBGB&adults=2&roomQuantity=1&paymentPolicy=NONE&view=FULL_ALL_IMAGES
Is there an example of reading the object tree and associated dbIds (typically found in the Autodesk viewer) from the Model Derivative API?
First call that endpoint to get the guid of the view:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET
Then call that second endpoint passing in the guid obtained in the first call:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-GET
Take a look at the links for example payload of the responses. Using the Forge SDKs those endpoints are called respectively getMetadata and getModelviewMetadata.
I am building a results filtering page using AJAX requests. I would like to reflect the filters in the URL. For example: for price_from I want to add ?price_from=VAL to the URL.
I have a backend that is capable of rendering the page with URL parameters.
After some googling I would a Backbone.router solution which has a hash fallback for the IE that does not support HTML5 history API.
I have a problem with setting a good philosophy of routes. I have a set of filtering parameters (price_from, price_to, color, ...) and I would like to attach each parameter to one route.
Is that possible to chain the routes to match for example: ?price_from=0&price_to=1&color=red? (the item order can change)
It means: call all the routes at the same time and keep the ie backwards compatibility?
Your best bet would be to have a query portion of the URL rather than using GET parameters to denote the search criteria. For example:
Push state: /search/query/price_from=0&price_to=1&color=red
Hash based: #search/query/price_from=0&price_to=1&color=red
Your backend would of course need to change a bit to be able to parse the new URL structure.