It's conference season, and the geo team is coming out in full force. Here are some of the upcoming conferences that we'll be speaking at - if you attend any of these, be sure to say hi and let us know how you're using our APIs!
For more events near you, check out our Developer Events Calendar.
Hi, I'm Xiaoxi (Frank) Wu. I'm a software engineer working for Beyondsoft in Beijing China, where I'm currently working on Maps API applications. While I was learning the Google Maps API, I got a lot of help from the forum and the open-source library, so I've decided to give back to the community with some of my own code.
The first library that I'm releasing is MarkerClusterer. Once, a friend of mine encountered a problem with his application. Using the API, he developed a map and added thousands of markers on the map, and saw that it made his map un-usably slow. This was because every marker is a combination of several DOM elements, and it's a lot of work for a browser to create many thousands of DOM elements. I decided that clustering would be a good solution for his problem, and came up with MarkerClusterer. MarkerClusterer collects markers into different clusters and displays the number of markers in each cluster with a label, creating new clusters as the map zoom level changes. The clustering algorithm is simple; for each new marker it sees, it either puts it inside a pre-existing cluster, or it creates a new cluster if the marker doesn't lie within the bounds of any current cluster. Because the clusters have a fixed size in each zoom level there are almost the same number of clusters in viewport in average - so MarkerClusterer has a good max and average run time. The screenshot below shows the effect of using MarkerClusterer on an array of 1000 markers (and the live demo shows you the speed difference):
It's easy to use - just add your markers to an array, pass that and your map into the MarkerClusterer, and it'll take care of the rest. Check out the simple example and code snippet below:
var markers = []; for (var i = 0; i < 100; ++i) { var latlng = new GLatLng(data.photos[i].latitude, data.photos[i].longitude); var marker = new GMarker(latlng); markers.push(marker); } var markerCluster = new MarkerClusterer(map, markers);
You can also set some options for the MarkerClusterer like the cluster icons and the size of the clusters. You can see those used in this advanced example. If you want to learn more, check out the class reference or the how-to.
For other clustering options for your markers, check out the Maptimize hosted service or read this article that compares other 3rd-party clustering extensions.
Thanks to Google Alerts and Twitter search, I'm always finding articles and blog posts written by developers about using our various Maps APIs. On the assumption that not all developers are constantly monitoring the internet for occurences of "google maps api", I've made it easy for you to benefit from these articles as well by linking to them from the documentation.
On the articles page for the JavaScript API, you'll find externally hosted articles on topics like Using JQuery with the Maps API, Density Mapping with the HeatMapAPI, and Handling Large Amounts of Markers.
On the articles page for the Flash API, you'll find articles on topics like Thematic Mapping, Creating Custom Maps, and Using the API with Multi-Touch Technology.
Check out the articles pages for the full list, and let us know if you have an article that should be on the lists.
Due to the popularity of the demo galleries for our JavaScript and Flash APIs, we've added a demo gallery to the Mapplets API documentation as well. The demo gallery shows Mapplets created by both Google engineers and 3rd party developers, and provides links so that you can easily view the XML or use the Mapplet in Google Maps. You can learn from the demos how to do things like display KML files, store user preferences, localize your gadget to many languages, render custom tile layers on top of the base map, and more. Many of the demos come straight out of Sterling Udell's fantastic book, "Beginning Google Maps Mashups with Mapplets, KML, and GeoRSS: From Novice to Professional".
Browse through the demo gallery, and post in our new dedicated Mapplets API forum if you have questions (or a demo to contribute!).
If you're reading this blog, there's a good chance that you've seen or made some awesome geographic data visualizations in KML. Which means you know all too well that it can be hard to grasp the full story behind a visualization, especially a 3D visualization, without being guided through it. If you're like me, you might even have created KML files with giant Placemarks labeled "Start Here" and "Now go Here" and "Great View -- click on me!" If you're like me, you also felt dirty after doing that. It feels kind of like writing Perl -- you do it sometimes, but you don't really like to talk about it.
With the launch of Google Earth 5.0, we tackled this problem by introducing the ability to record and play your own tours through the world. Tours are a bit like interactive videos inside of Google Earth. Like a video, you can guide people on narrated journeys around the world and through your data, and you can rewind and fast forward. But when you pause a tour, unlike video, you can wander around in 3D. We included a shiny user interface for creating simple tours from inside of Google Earth 5.0, but underneath the hood tours are encoded as a powerful set of extensions to the KML language, that are much more expressive than the current recording functionality in Google Earth 5.0. In brief, these KML elements specify the timeline of the tour... a sequence of actions that tells Google Earth how to move the user through the world. They also allow you to modify and interact with your data presentation. In developing this language, we wanted to give developers precise control over all aspects of a tour. Not only can you control the movement of the camera, but you can play sound files, pop open info balloons, toggle the visibility of features, manipulate the time slider, and even animate the position and styling of content.
Below is a snippet of an example KML file containing a placemark and a tour. In the tour, the camera first flies to a good viewing location for the placemark and opens the placemark's info balloon for a few seconds. Then it closes the balloon, and proceeds to animate the size of the placemark icon and the color of the label using the <gx:AnimatedUpdate> action. It's an easy-to-read example for KML developers, but don't expect it to win an Oscar any time soon. On the other hand, it does show off the structure of a basic tour pretty well...
... see full file for the entire example ... <!-- Our tour. The Playlist inside contains the sequence of actions that compose the tour. --> <gx:Tour> <name>Example Tour</name> <gx:Playlist> <!-- Fly to the view of the placemark in 5.2 seconds. --> <gx:FlyTo> <gx:flyToMode>bounce</gx:flyToMode> <gx:duration>5.2</gx:duration> <LookAt> <longitude>-78.19074499027175</longitude> <latitude>35.31730443852049</latitude> <altitude>0</altitude> <range>10704.41142132794</range> <tilt>58.57687432675979</tilt> <heading>-76.75532143327891</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt> </gx:FlyTo> <!-- Open the balloon of the placemark. --> <gx:AnimatedUpdate> <gx:duration>0.0</gx:duration> <Update> <targetHref/> <!-- Left empty to refer to the current file --> <Change> <Placemark targetid="pm1"> <gx:balloonVisibility>1</gx:balloonVisibility> </Placemark> </Change> </Update> </gx:AnimatedUpdate> ... and so on ...
Additionally, we recently released tour support in the Google Earth Plugin version 5.0. With this, it's now easy to integrate cinematic Google Earth presentations directly into your web content, complete with sound! See the plugin tour API example for details. Or check out the new tour gallery and touring gadget for more examples and techniques for putting tours into web pages.
Tours can be as long and as complicated as you want, so just let creativity be your guide in telling your story. Whether you're following GPS traces, modeling the ocean currents, mapping city population over time, or simply showing the good restaurants in your neighborhood, if you're serious about sharing your geo-data with the world, consider making some tours to accompany your KML file. You already have great visualizations lying around, so now show them off in style with a tour!
Last month, the Google Earth team made a splash in the news (pun intended) with the release of Google Earth 5.0. The update included the ability to dive underwater to explore the world's oceans, record and play back narrated tours, view historical imagery, and explore Mars in 3D. Today, our team is happy to announce the 5.0 version of the Google Earth Plugin!
If you've already installed the plugin, you should see the new version automatically within the next day or two. If not, you can download the plugin for Windows or Mac OS X by visiting any Earth API web site, such as Monster Milktruck and clicking 'Get The Google Earth Plugin now'.
We've added many of Google Earth 5.0's new capabilities to the plugin and API, as well as a few other frequently requested features. Here is a list of major new features in the plugin and API:
ALTITUDE_CLAMP_TO_SEA_FLOOR
ALTITUDE_RELATIVE_TO_SEA_FLOOR
KmlTour
GETourPlayer
KmlPhotoOverlay
GEPhotoOverlayViewer
LAYER_BUILDINGS_LOW_RESOLUTION
Along with these major new features, we've implemented the following feature requests from the public issue tracker: 10, 27, 42, 49, 99 and fixed these publicly reported defects: 75, 118, 131, 148. Check the Earth API release notes for more details.
The full list of a new samples for this release can be found at the Earth API demo gallery.
On our agenda for the not-too-distant future is:
Lastly, if you're yearning for more Earth API goodness, make sure to catch my Google Earth API session at Google I/O on May 27th and 28th. Discounted early bird registration ends May 1st, so register now before time runs out!.
Give us feedback in our Product Forums.