Google Directions Api returning 0 routes

When you use via: prefix (no stopover), it adds some additional restrictions. Particularly the U-turn maneuver is not allowed, the route must go straight forward through waypoint. If this is impossible the Directions service will return ZERO_RESULTS. To check this hypothesis I created exactly the same request, but with stopover (without via: prefix). You can … Read more

How to decode the Google Directions API polylines field into lat long points in Objective-C for iPhone?

I hope it’s not against the rules to link to my own blog post if it’s relevant to the question, but I’ve solved this problem in the past. Stand-alone answer from linked post: @implementation MKPolyline (MKPolyline_EncodedString) + (MKPolyline *)polylineWithEncodedString:(NSString *)encodedString { const char *bytes = [encodedString UTF8String]; NSUInteger length = [encodedString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; NSUInteger idx = … Read more

Google Maps API Version difference

I’ve taken your request URL and pasted it in my app, which is using the newer version, and it works great. The problem may be how you parse the data, or decode the received JSON string. String url = “http://maps.googleapis.com/maps/api/directions/json?origin=19.5217608,-99.2615823&destination=19.531224,-99.248262&sensor=false”; HttpPost httppost = new HttpPost(url); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream is … Read more

Exceed 23 waypoint per request limit on Google Directions API (Business/Work level)

function initMap() { var service = new google.maps.DirectionsService; var map = new google.maps.Map(document.getElementById(‘map’)); // list of points var stations = [ {lat: 48.9812840, lng: 21.2171920, name: ‘Station 1’}, {lat: 48.9832841, lng: 21.2176398, name: ‘Station 2’}, {lat: 48.9856443, lng: 21.2209088, name: ‘Station 3’}, {lat: 48.9861461, lng: 21.2261563, name: ‘Station 4’}, {lat: 48.9874682, lng: 21.2294855, name: ‘Station … Read more