Help with spherical geometry from our first Maps API library

The Maps API v3 aims to minimise the time it takes to load and display the initial map. Indeed the architectural changes needed to reduce this delay on mobile devices were the primary motivation for the break from the Maps API v2. The biggest factor affecting load time is the size of the JavaScript, as both the speed at which this is downloaded, and the speed it is parsed before execution by browsers is directly related to its size.

As the Maps API v3 continues to evolve we are keen to add more features, but as we do so we must be mindful of the impact they have on the size of the API. In response to this constraint we are kicking off 2011 by introducing a new concept to the Maps API v3, called a library.

A library is a set of Maps API features that are only loaded when explicitly requested by the application. By packaging features into a library, we can deliver them to applications that need those features without penalising the loading times of applications that do not. A library has its own child namespace under google.maps, and is a fully supported component of the Maps API.

The first library that we are launching is the geometry library. The geometry library provides a set of utility functions for performing distance, heading, and area calculations in a spherical geometry, such as on the surface of the Earth, and also provides functions for handling encoded polylines. To use these functions in your Maps API application you must request the geometry library when loading the API.
For more information on the geometry library, see the Maps API Documentation and Reference. If you think of additional spherical geometry functions you would like to see added to the geometry library, please log a feature request on the Maps API Issue Tracker. If you have any questions about using the geometry library, the Maps API v3 Forum is a great place to find help.

Leave a Reply