GGeoXML Methods:
When we released GGeoXML
, the class used for overlaying KML/GeoRSS files on API maps, we promised we'd continually improve it and add more features. The engineers added support for Ground Overlays and Network Links soon thereafter, and now they've given developers GGeoXML
functions to make loading and viewing files easier. GGeoXML
now comes with a callback function that's entered once the file has loaded, plus a number of utility functions: hasLoaded()
, loadedCorrectly()
, getDefaultCenter()
, getDefaultSpan()
, getDefaultBounds()
, and gotoDefaultViewport()
.
Here's some quick code showing you how you'd use a couple of these functions to automatically center the map on a loaded KML file:
var geoxml = new GGeoXML("http://kml.lover.googlepages.com/my-vacation-photos.kml", function() { if (geoxml.loadedCorrectly()) { geoxml.gotoDefaultViewport(map); } }); map.addOverlay(geoxml);
Below, I've redone the original example of the GGeoXML
loader to use similar code, so I no longer need to hard-code the viewport for each file. I've also chosen to show a "Loading..." indicator while the GGeoXML
file is being loaded, as some files can take longer than others to load.
GDraggableObject Events:
In this release, we've also given you more control over GDraggableObjects
with 6 new events: mousedown
, mouseup
, click
, drag
, dragstart
, dragend
. Why? Because everybody loves draggable objects, and the more you know about what the user's doing to your draggable object, the better! Below is a simple example that lets you drag the Google Maps logo around while it shows you the current event:
And now for something completely different... We've added an optional parameter to GPolyline
to let you create geodesic polylines (aka "Great Circles"). A geodesic line is the shortest route between two points on the surface of the earth, and often resembles the path that airplanes take to get you to your destination in the most efficient manner. Check out this example using the new geodesic option, created by Finnish Developer Esa.