Skip to main content

Posts

Showing posts from May, 2008

Map legends on-the-fly with GD

Map legends are important in thematic mapping, but KML/Google Earth has no build-in legend support (except the list view of map elements). I think the best workaround is to add a legend using the KML ScreenOverlay element . Unfortunately, this element only supports image overlays and not HTML layers. This makes it harder to create a dynamic legend that changes with your data. Still, there are options: GD is an open source graphics library for dynamic creation of images. Using this library you can build a legend by adding colour scales and text to an image canvas. GD is written in C with bindings available for various languages. The legend and map title shown in this screenshot are created using PHP-GD image functions , stored in a KMZ archive as PNG images, and added as screen overlays. You can download the KMZ file here .

Better KML rendering with Google Maps API for Flash?

Yesterday, Google launched their new Google Maps API for Flash . A Flash version will hopefully have better vector rendering capabilities than the JavaScript based API. Most of the current map APIs quite cleverly use use the build-in vector support in Firefox and Internet Explorer (and others). Firefox supports Scalable Vector Graphics (SVG), while Microsoft use the obsolete Vector Markup Language (VML). The Google Maps API and OpenLayers API automatically check your browser and draws the vectors with the appropriate technology. But the SVG/VML/ DOM technology has some serious performance issues - if you add many complex polygons the browser will run terribly slow . While we wait for HTML 5 (and browsers to support it), Flash APIs might be a better solution. I recommend Prince McLean's articles about the Flash Wars . UPDATE 8 JUNE 2008: Guilhem has made a nice tutorial of how choropleth maps can be created with Google Maps Flash API . He uses the World borders dataset availa...

Animated Colladas in Google Earth

My second animation tip: KML embedded COLLADA objects can be animated by using the time primitives similar to what I did for prism maps . See video: The advantage is smaller file size compared to prism maps, since only one COLLADA model is used. Still you have to link in this model for all countries in all years (around 4000 times in this animation). A better way would be to be change the size parameters dynamically, but this is so far not possible with KML. Download KMZ archives here and here : Population statistics from UNdata .

Animated prism map in Google Earth

By using the time primitives in KML, you can create animated thematic maps showing how a variable change over time. The prism maps above visualise the world population in four different years (1950, 1975, 2000 and 2050). This and this blog posts show how a prism map can be made with KML. Here, I've added country polygons for several years, each extruded and colourised according the the population value. All polygons for one year are wrapped in a Folder with a TimeSpan element. Whenever time is specified in a KML file, a time slider appears in upper-right corner of Google Earth (I've not seen this functionality implemented in other geobrowsers). By dragging this slider, you'll see the human population explosion visualised: You can download the KMZ file here and try yourself. The file is big (1 MB) because the complex country polygons have to be repeated for each year in the animation. It's not possible to change altitude values dynamically with KML. It'll be...

Prism maps in Google Earth and UUorld

In an earlier post , I showed how KML can be used to create 3D choropleth maps or prism maps . A prism map is a statistical surface map viewed in perspective (1). It's the recommended way of visualising numerical data using choropleth mapping (2). See these examples showing internet users in the world: This choropleth map shows the number of internet users per 100 population in 2005 (see this post for more information about the map). Even though it's possible to see that one shade is lighter or darker than another, it's impossible to see that the shade for one country is twice as dark as another. It's better to use this type of choropleth maps with nominal or ordinal data , and not numerical data ( interval or ratio measurements). This image shows the same data visualised in Google Earth (the problem with holes in extruded polygons is described here ). The height (and colour) is proportional to the percentage of internet users. This prism map portray ratios correct...