Posted:
Today we released a set of improvements to transit directions in the Google Maps APIs. If you use transit directions in your app, you can now show fare info and give your users the same mode and routing options as the Google Maps Android app.


blog01.pngblog02.png

Specifically, the changes are as follows:
  • Transit is now available in the Google Maps Distance Matrix API and the Distance Matrix service in the Google Maps JavaScript API v3. Previously it was only available in the Google Maps Directions API and the Directions service.
  • Transit directions will now return fare information where available, same as the Google Maps Android app. In the Distance Matrix API, this enables developers to find routes that minimize either the travel time or the fare.
  • Transit directions now accept transit options, same as the Google Maps Android app. Options include mode preferences (transit_mode=train|tram|subway|bus) as well as routing preferences (transit_routing_preference=less_walking or fewer_transfers).
  • Developers can now set departure_time=now in Directions API queries instead of specifying a timestamp. The departure_time parameter is now optional and will default to departure_time=now if not specified.

These changes are also available in the Directions service and Distance Matrix service in the Google Maps JavaScript API v3.

Posted by Elena Kelareva, Product Manager, Google Maps APIs

Posted:

The Google Maps API provides a rich set of web services that allow developers to integrate them into connected applications. We've been making developers lives easier by making these services available in the JavaScript Maps API as tested code that simplifies interfacing with mapping services for quite a while now.

Recognizing that developers use different languages for their applications, we've developed client libraries to make integration of Maps API services easier, and we're happy to announce availability of libraries for both Java and Python. The bottom line is fewer lines of code are needed to integrate the Maps APIs, and let's face it, less code means less work which means faster time to market!

The libraries support these Maps API services:

Here's an example of how you'd use the Geocoding API with the Java client library:

// Replace the API key below with a valid API key.
GeoApiContext context = new GeoApiContext().setApiKey("AIza...");
GeocodingResult[] results =  GeocodingApi.geocode(context,
    "1600 Amphitheatre Parkway Mountain View, CA 94043").await();
System.out.println(results[0].formattedAddress);

By taking advantage of these client libraries, developers will save time integrating these services. Developing robust code that handle all the details of interfacing to these services can be left to our client libraries whilst the developer can concentrate on value added features in their applications.

Depending on which language you're using, some of the best features of the libraries include:

  • Simple interface
    • enables you to get started quickly and easily
  • Authenticated requests
    • handles the nitty-gritty of authentication keys and enterprise signing
  • Retry on failure
    • transparently deals with intermittent connection to server errors
  • Rate limiting
    • throttles the number of requests to the Maps API for quota management
  • Native objects
    • the interfaces are in your host language so no bridging code needed
  • Asynchronous or synchronous
    • you choose what style of interface to use, as we support both
  • Open source
    • easy to check out, understand, and contribute to if you like

If you're a Java developer, head on over to our github repository to get the code and browse the examples. If you develop in Python you'll find the Python specific code and samples here.

We've built these libraries to save you time and make it even easier to put Maps API services into your next world-changing app, let us know if you like them!

Posted by Alex Danilo, Developer Advocate