Monday, May 10, 2010

KML, Traffic, and Bicycling layers come to Maps API v3

Since being formalized as an Open Geospatial Consortium standard, KML has become something of a lingua franca for geospatial information. From humble beginnings in Google Earth, KML support can now be found in a wide variety of mapping products and services. Today we’re happy to add Maps API v3 to this list with the introduction of the new KmlLayer class. The KmlLayer class enables KML or GeoRSS files that are hosted on publicly accessible web sites to be rendered in a Maps API v3 application.

The KmlLayer class is just one of several new layer classes we’re adding to Maps API v3 today. A layer class handles a collection of overlays that are added to the map as a single entity. In addition to the KmlLayer class, we are also adding a TrafficLayer class and a BicyclingLayer class.

The TrafficLayer class adds real time color coding of traffic speed on highways and major arterial roads. The BicyclingLayer class adds information about bike trails, lanes and recommended roads for bicyling onto the map:

  • A dark green line indicates a dedicated bike-only trail;
  • A light green line indicates a dedicated bike lane along a road;
  • A dashed green line indicates roads that are designated as preferred for bicycling, but without dedicated lanes

If you generate bicycling routes using the DirectionsService class, and display them on the map using a DirectionsRenderer, the BicyclingLayer is now added to the map with the route.

You can use the map below to try out these new layers and check how your own KML files are rendered by the KmlLayer class:

If you have any questions about these new layers, or the Maps API v3 in general, we recommend that you join the Maps API v3 Google Group. For more information about KML, check out the KML Tutorial.