Google Earth hack: Weather & map symbols

Somebody was asking whether there is a way of drawing map and weather symbols directly onto Google Earth — icons aren’t any good, as they always face you; these symbols definitely need to be able to point in a specific direction.

You can easily place individual objects onto Google Earth using SketchUp or any number of converters, but if each object is going to be unique, then the time and file size required are going to be substantial. Might there be a better way?

Once again, I suspected the recent integration of SketchUp and Google Earth might hold a solution. After some experimenting, I hit upon this hack:

In SketchUp, I drew an arrow symbol. I extruded it slightly, and then I exported it to Google Earth using the Export menu item.

I took the resultant KMZ file, changed the suffix from .kmz to .zip, and unzipped it. Inside, I looked at the “doc.kml” file in a text editor.

Here it gets interesting. The data for the arrow symbol resides in the “models” folder, where it is referenced via KML in doc.kml; such referencing can be done repeatedly, creating many different instances of the same symbol. Each time, the KML can define the latitude, longitude, orientation and scale of the symbol instance. (Realistically, scaling needs to be set at 1000x or more to move from SketchUp size to Google Earth size.)

This means that you could mark up a map programmatically, rather than manually, for example by using weather data at specific coordinates as display parameters for the symbol. Is the wind coming from the NW? Then set the <heading> tag to 135 degrees. Once you’ve created a set of basic symbols, all you need to do is write KML to reference them.

arrows1.jpg

I’ve made a sample such file, which uses two different symbols multiple times, each time altering the location and direction slightly. It works well, though there are a few caveats:

  • You have to give the symbol a vertical thickness or have it be somewhat off the ground, else your work will disappear underground.
  • As before, the symbols do not curve along with the Earth, so this solution does not scale at the more extreme outward zoom levels.

The sample file I made is static and quite crude, but there is room here for further innovation in visualization techniques — for example, you could make a dynamic network link and return KML as a function of the bounding box, so that symbol size and even the number of symbols displayed could be derived from your zoom level.

Below the fold, sample KML for depiciting two arrows.

<?xml version=’1.0′ encoding=’UTF-8′?>

<kml xmlns=’http://earth.google.com/kml/2.1’>

<Document>

<Placemark>

<name>arrow 1</name>

<description><![CDATA[Created with <a href=”http://sketchup.google.com”>Google SketchUp</a>]]></description>

<DocumentSource>SketchUp</DocumentSource>

<Style id=’default’>

</Style>

<Model>

<altitudeMode>relativeToGround</altitudeMode>

<Location>

<longitude>-57.5</longitude>

<latitude>-51.8</latitude>

<altitude>0.000000000000</altitude>

</Location>

<Orientation>

<heading>-22.5</heading>

<tilt>0</tilt>

<roll>0</roll>

</Orientation>

<Scale>

<x>100.0</x>

<y>100.0</y>

<z>10.0</z>

</Scale>

<Link>

<href>models/arrow.dae</href>

</Link>

</Model>

</Placemark>

<Placemark>

<name>arrow 2</name>

<description><![CDATA[Created with <a href=”http://sketchup.google.com”>Google SketchUp</a>]]></description>

<DocumentSource>SketchUp</DocumentSource>

<Style id=’default’>

</Style>

<Model>

<altitudeMode>relativeToGround</altitudeMode>

<Location>

<longitude>-57.5</longitude>

<latitude>-52.80000000</latitude>

<altitude>0.000000000000</altitude>

</Location>

<Orientation>

<heading>22.5</heading>

<tilt>0</tilt>

<roll>0</roll>

</Orientation>

<Scale>

<x>100.0</x>

<y>100.0</y>

<z>10.0</z>

</Scale>

<Link>

<href>models/arrow.dae</href>

</Link>

</Model>

</Placemark>

</Document>

</kml>

5 thoughts on “Google Earth hack: Weather & map symbols”

  1. also takes a parameter, which is almost as useful for two-dimensional fixing of direction.

  2. And this blog does not parse angle brackets correctly. Let’s try html ents…

    <Icon> also takes a parameter, <heading&gt which is almost as useful for two-dimensional fixing of direction.

  3. I suspect it was a positive or negative that was scanned and digitised. Letters can be burned into film like that.

  4. Greetings,

    This entry is great! I would call it a MOD rather than a hack!

    Thanks for the tip!

    Cheers.

Comments are closed.