Saturday, December 8, 2007

[Gd] Using the Chart API in KML for Quick Data Visualization

| More

Official Google Maps API Blog: Using the Chart API in KML for Quick Data Visualization

Google just released the the Google Chart API. We don't often boast about other non-Geo APIs in this blog, but this one is amazing, easy to use, and, best of all, has great potential for use in Geo apps.

Using the chart API is simple. By passing various parameters in the URL to the chart server, you can control how the chart looks in the image that is returned. Your custom chart image can be placed in Maps API info windows, KML balloons, etc. Let's look at how that second scenario works.

Let's suppose that you wanted to show pizza deliveries at particular locations based on significant points in a romantic relationship. You know how it goes — someone likes pizza, they order it. When they get involved with someone, sometimes they order at a that person's house, so deliveries go down. Around the holidays, they eat less pizza because they're going to parties, but when they break up with someone, they eat a lot of pizza because they're lonely and depressed at home. Very sad. Anyway, I've created a sample using KML, and I placed it in a park in New York so no one thinks I'm watching their actual pizza consumption.

 <?xml version="1.0" encoding="utf-8"?> <kml xmlns="">   <Placemark>     <name />     <visibility>1</visibility>     <Snippet>Relationship versus Pizza</Snippet>     <description><![CDATA[<img src=" chs=200x150&chd;=t:10,15,25,13,3,35& chxt=x,x&chxl;=0:|Jul|Aug|Sept|Oct|Nov|Dec|1:|Start|||Thanksgiving||Breakup& chtt=Pizza%20Deliveries|by%20Relationship%20Progress"/>]]></description>     <Point>       <coordinates>-74.01490535558324,40.70396174218289,0</coordinates>     </Point>   </Placemark> </kml>

See, pretty simple. I'll leave it up to you exploring the Chart API documentation to get more info on creating the chart, but I wanted to show something else you could do with KML 2.2. This will only work in Google Earth, but it's pretty cool. You use the new <ExtendedData> and <Data> elements to create a Balloon template, putting the entity replacements (those codes that look like: $[something]) in the URL. That way, you can put only the data relevant to a particular point in a particular balloon, and you don't have to recreate the whole URL for each <Placemark>. And if you change the chart, but not the data, all you have to change is one <BalloonStyle>.

 <?xml version="1.0" encoding="utf-8"?> <kml xmlns="">   <Document>     <name></name>     <open>1</open>     <Style id="pizza">       <BalloonStyle>         <text><![CDATA[<img src=";=200x150&chd;=t:$[PizzaDeliveries1],$[PizzaDeliveries2],$[PizzaDeliveries3],$[PizzaDeliveries4],$[PizzaDeliveries5],$[PizzaDeliveries6]&chxt;=x,x,y&chxl;=0:|$[PizzaDeliveries1/displayName]|$[PizzaDeliveries2/displayName]|$[PizzaDeliveries3/displayName]|$[PizzaDeliveries4/displayName]|$[PizzaDeliveries5/displayName]|$[PizzaDeliveries6/displayName]|1:|$[RelationshipDataPoint1]|$[RelationshipDataPoint2]|$[RelationshipDataPoint3]|$[RelationshipDataPoint4]|$[RelationshipDataPoint5]|$[RelationshipDataPoint6]&chtt;=Pizza%20Deliveries|by%20Relationship%20Progress"/>]]></text>       </BalloonStyle>     </Style>     <Placemark>       <name>Pizza Deliveries</name>       <styleUrl>#pizza</styleUrl>       <...       <ExtendedData>         <Data name="PizzaDeliveries1">           <displayName>Jul</displayName>           <value>10</value>         </Data>         ...       </ExtendedData> ... 
You can find the full sample here: here. For more info about creating templates, check out Adding Custom Data.


Friday, December 7, 2007

[Gd] v2.94: Terrain and a New MapTypeControl to show it off!

| More

Official Google Maps API Blog: v2.94: Terrain and a New MapTypeControl to show it off!

As announced on the Google Lat Long Blog last week, Google Maps has added a new Terrain map type that displays physical features and, quite frankly, is just dang pretty to look at. If you haven't tried it out yet, search for Mount Everest, the Grand Canyon, Glacier Bay National Park, or any other place that's suffered (enjoyed?) the natural forces of erosion and tectonic activity. We didn't enable the Terrain map type by default in the API as we didn't want to "surprise" developers and suddenly pop a new button on your maps, but we have made it very easy to add this type. Just insert code like this after initializing GMap2 to get a Terrain button on your map: map.addMapType(G_PHYSICAL_MAP);

In addition to the new map type, another subtle change was made to the Google Maps interface: the Hybrid button was removed, and was replaced with a drop-down menu under the Satellite button with a Show Labels checkbox. This new UI reflects the fact that the hybrid layer really just consists of satellite tiles combined with a transparent tile layer of information from the standard map tiles. We've released this new UI functionality to developers within the GHierarchicalMapTypeControl. The new control defines functions to add relationships to the control so you can specify how these drop-down lists will appear. For information on how to set up these relationships, see Modifying the Makeup of Standard Controls in the API documentation.

For those who want to mimic the current maps UI, just replace your GMapTypeControl object with a GHierarchicalMapTypeControl object — the existing G_SATELLITE_MAP/G_HYBRID_MAP relationship is specified by default. For those who want to use this control for their custom maps, however, you can clear the defaults and specify whatever relationships make sense for you.

As an example, I used the awesome Google Maps Creator java application from UCL-CASA to turn freely available ESRI SHP files into tile layers. After getting the custom map API code generated automatically by the application for all my layers, I combined them into one map and added in the new map type control. The result is a map with a drop-down that lets you switch between the four tile layers (various data for San Francisco county). Try it out below — and hopefully you'll be inspired to use the control for your own custom maps! As always, please post questions in the forum.

Link to Custom Map + HierarchicalMapTypeControl Example


[Gd] Open Source in Zurich with vigor and Vim

| More

Google Code Blog: Open Source in Zurich with vigor and Vim

Looking for a cool place to hack with like-minded colleagues? Going to be in or around Zurich on December 13th? If so, please join us for our inaugural Open Source Jam held at Google Switzerland. We'll provide the hacking lounge, Wi-Fi, pizza, beer and the creator of the Vim text editor, Bram Moolenaar. You supply your laptop, good ideas and community spirit.

You can find full details and information on how to register in our Open Source Jam Zurich Google Group. If you haven't already done so, please join the group and let us know your thoughts. And if you happen to attend the event, post a comment and let us know how it went.


Thursday, December 6, 2007

[Gd] In just seven days

| More

Google Code Blog: In just seven days

We announced the Google Highly Open Participation Contest a little over a week ago, and the response has been phenomenal. We already have over 350 student contributors, and the participating organizations have let us know that they're overwhelmed by all the great contributions they've received from their contestants. We're delighted to bring you this video status update, with an extra treat: Guido van Rossum, the creator of Python, stopped in to tell us a little bit more about the Python Software Foundation's participation in the contest.

We always love to hear from you, so feel free to contribute some task ideas and join the contest discussion list.


[Gd] Embed charts in webpages with one of our simplest APIs yet

| More

Google Code Blog: Embed charts in webpages with one of our simplest APIs yet

Today we're launching the Google Chart API, a really simple tool for creating charts and graphs that are perfect for websites.

Let's get straight in with an example. This URL:|World

Creates this image:

That's it - no state, no calls, just send your data in an http request and get a png image graph back. Embed the request in an img tag and you're done. We currently support line charts, bar charts, pie charts, scatter plots, and sparklines.

We actually built this originally to use internally - we use it on Video and Finance for example. It seemed like it would be a good thing to open up to other users too. You can find out all about it at on the Google Chart API homepage and there's a Google Chart API group for questions and support.

The Google Chart API started out as a 20% time project here in Zurich, and we're really happy to be launching it to the world today. Let the charting begin!


Wednesday, December 5, 2007

[Gd] Google Developer Podcast Episode Twelve: Android with Dianne Hackborn and Jason Parks

| More

Google Code Blog: Google Developer Podcast Episode Twelve: Android with Dianne Hackborn and Jason Parks

As soon as Android and the Open Handset Alliance was out in the wild, we were chomping at the bit to talk with some of the people behind the platform to discuss the developer-related information.

We were lucky enough to get some time from Dianne Hackborn and Jason Parks, who have been doing this work for a long time. They used to be at Be, and PalmSource, and you will hear how that experience has come through to Android. In fact, you will see how the Android team has engineers from many other platforms (Linux, Danger, and Windows Mobile).

Dick Wall himself is an advocate on Android, and you can hear how excited he is to talk about this!

What will you learn on this podcast?
  • Some history behind the project
  • The high level architecture of Android. For example, how Linux processes handle the VM and manage security (the VM doesn't handle it)
  • Details on the Dalvik VM and how it is optimized for small devices
  • The architecture: From Intents to Views to Permissions and more
  • How XML is slow, but the tools convert the XML to a nicer format for you
  • The tooling and steps for building an application on Android
  • How so many objects have a URL, and how the environment is like a mini-SOA (Services across processes instead of across the network)
  • Thoughts on how you program for small devices, and things to watch out for if you move from the desktop
  • The control, or lack of control that you have over the application lifecycle
  • "Everything you do drains the battery"
  • The thread story: they exist, you don't have to deal with them if you don't want too, and the UI
  • Using XMPP for messaging

You can download the episode directly, or subscribe to the show (click here for iTunes one-click subscribe).

Want to learn more about Android? Read the book or watch the movie depending on how you are feeling!