Center of gravity calculator in Google Earth

Readers of Kottke.org will remember a discussion a week back about where in the world the highest concentration of Starbucks coffee shops might be. One blogger was inspired to calculate the exact center of gravity of all Starbucks in New York, and mapped it. It was a hard slog, and it got him some press.

That was then. this is now.

Blogger “Brammeleman” writes in Dutch (so I’ll translate loosely) that his family is discussing where to have the next family reunion. It must be a nerdy family, as everyone immediately agreed it should be at the family’s center of gravity. The only question remaining is, what determines the weighting of each individual family member?

While the rest of the family argues it out (age? generation? marital status?), our blogger has gone off and produced a center of gravity calculator for Google Earth. In the true political tradition of the Dutch, the calculator assigns everyone an equal weighting.

Here’s how it works: In Google Earth, make a new folder (Command-Shift N). Then, make a new placemark at the location of each family member and add it to the folder. Finally, save the folder to your desktop as a KML file. Now import it into our pseudonymous blogger’s web app, and you instantly get a KML file back with a placemark added at the center of gravity.

coggeens.jpg(I tried it. My immediate family is all over the place — London, Switzerland and me here in Stockholm, yet the center of gravity for us is in tiny Belgium, near Li√Æge. As we’re Belgian, that’s rather spooky.)

The script makes one major simplifying assumption — that the Earth is flat. The PHP script won’t get tripped up by the dateline, but be sure not to live too spread out, or around a pole.

[Geeky postscript: That’s a fun programming question: “Given a set of arbitrary points on the surface of a sphere referenced by latitude and longitude, write a program to determine the point on the sphere closest to the three-dimensional center of gravity of the points, in terms of latitude and longitude.” Brammeleman’s script is practically there. Just his final latitude calculation is off for most sets of widely spread points. Instead of:

$lat = rad2deg(asin($meanz));

it needs to read:

$meanx = $sumx / $placemark_count;

$meany = $sumy / $placemark_count;

$lat = rad2deg(atan($meanz/(sqrt($meanx^2+$meany^2))));

…I believe, hoping for no divisions by zero. But I’m often wrong:-)]

Of cyclones and Seattle wifi

Two items with a Pacific theme this morning:

It’s always hurricane season somewhere. In the South Pacific, cyclone season opens with Jim, bearing down on this New Caledonian blogger, who’s following it and related webcams in Google Earth with this hurricane tracker, an oldie but good one.

On the other side of the Pacific, Seattle Wireless, a community wifi network, now has a Google Earth network link (KML) to accompany its Google Maps mashup.

Rants and Ramblas

Trevor, an Irish polymath residing in Barcelona (and fellow traveler, blogwise) unEarths, so to speak, a little campaign to switch Google Earth’s toponymy in Catalonia from Castillian to Catalan. He engages the main conspirator in this thread on Google Earth Community’s bulletin board, and it makes for an esoteric but fascinating little debate about the aspirations of the world’s smaller languages.

Getting into Google Earth, it would appear, is as desirable and difficult as getting into one of Barcelona’s better nightclubs. And I can definitely vouch for Barcelona’s nightclubs.

Batch geocode

Phillip Holmstrad has a free web app up that batch-geocodes multiple US addresses, and will even turn them into a KML file for you. (I don’t know if the KML functionality is a recent addition, but I’ve only just noticed it via this Google Earth Community posting.)

I can’t wait for the day that my address book supplies a live network link to Google Earth like that. Nor can I wait for the day that the technology exists to geocode addresses globally seamlessly. (Well, okay, I can wait, but I do so impatiently.)

[Update 19:16 UTC: Yes, Phillip confirms the KML-generating functionality is brand-spanking new, as is the ability to save the geocoded result as a URL to a map using Yahoo’s API. This map, in turn, also has a KML generation button, so in effect, you have a way of saving the KML content file online, for use anywhere.]

KML Writer: Unleash your inner Trump

OETowers.gifI’ve just had way too much fun playing with KML Writer, a poor man’s Google Earth authoring tool. Just draw a polygon by clicking away in the Google Maps interface, add the amount of extrusion in meters, and export the result as a KML file that opens right away in Google Earth. You can even combine different polygons into one KML file. And it’s free.

One obvious use is making instant skyscrapers that really give free rein to your inner Trump. Here is my vision for Tompkins Square Park in the East Village, New York, circa 2016: Ogle Earth Towers (KML), a 300-meter high medium-income housing project to alleviate the housing shortage there. There’s always Central Park for those who need parks, though imagine the size of the things you could build in Central Park!

KML Writer is by Simple Spatial Solutions, a Canadian outfit.

Weekend brainstorms

Time spent with Google Earth seems to have led to some interesting bainstorming among certain bloggers…

Londoner Dan Hill of City of Sound wishes for the ability to browse through time and to listen to sounds in Google Earth. As for the former, a time browser is coming — KML has (undocumented) time tags and a time browser has already been demonstrated in public by Google Earth CTO Michael Jones. As for the latter… I don’t know of any existing layer that links up to soundscape files, but this is something that’s trivial to make these days. Anyone have a library of such files, georeferenced? It’d be a cool project, certainly if connected to some kind of georeferenced QuickTime VR library for the complete immersive experience.

Alan Glennon moots a camera or camera setup that would not only record coordinates, but also its tilt and heading, importable into Google Earth via the <LookAt> tag. (Hey, why we’re at it, why not give Google Earth a zoom slider, just like a camera lens… No, not really.) He calls it “geovantaging”. Quite serendipitously, last Friday saw the release of GETrackr, which lets you geotag photos with exactly this kind of information, albeit manually, in Google Earth, in the absence of such cameras existing.

(An aside: Imagine for a moment that such cameras become ubiquitous. You could then use them en masse to “paint” the sides of Google Earth’s currently matte gray 3D virtual buildings with their real surfaces. Digitally Distributed Environments has a demo up of this technique, using Microsoft Local’s bird’s eye view painted onto a 3D example. The one tricky bit: the camera lens’s angle of view (wide angle to tele-lens) would have to be the same as Google Earth’s or else automatically adjusted via software when used.)

Alasdair Allan at The Daily Ack takes Alan’s ideas and wonders, what else could the camera do while taking the picture? He proposes some automatic data mining about the location you’re at, and perhaps live uploading to the net, viewable in Google Earth.

Meanwhile, Italian Cristian Contini has a picture up of when dinosaurs roamed the Google Earth.

[Update 21:11 UTC: Forgot to add a link to a post I had in mind for the brainstorming theme: Webby nominated World Changing blog asked its readers what else they’d like to see portrayed in Google Earth, and they got a load of suggestions back.]