All posts by Stefan Geens

Center of Gravity II

An accurate center of gravity calculator for Google Earth is now available here. All the code is Brammeleman‘s, taken from his calculator page here, save for the one final altered latitude correction, which places the center of gravity closer to the poles — at the correct position.

Abbreviated instructions: In Google Earth, collect your placemarks in a folder and save that folder to your hard drive as a KML file (not KMZ). Upload this file into the calculator and open the returned file in Google Earth. Voila.

So what does this center of gravity calculator do, precisely?

Practically speaking, the spot you get back minimizes the total distance people at placemarks will need to travel in order to meet up together. And if you calculate the center of gravity for just two placemarks, the straight line you can draw through all three points will be the shortest distance as the jumbo jet flies between your two placemarks.

newcog.jpgMathematically speaking, the code first finds the center of gravity for given points of equal mass on the surface of a sphere in three dimensional space. (The center of gravity will thus be inside the sphere.) It then finds the point on the sphere closest to the center of gravity by projecting a straight line from the center of the sphere through the center of gravity to the surface of the sphere.

The algorithm assumes Earth is a sphere, even though it is actually a geoid, so errors of tens of meters will persist. Correcting for those is something I am two PhDs short of being able to do.

The original story is three posts down, here. As a result of the correction, my family’s actual center of gravity is now 43km further north, in Bree, near the Dutch border.

Google Earth & Fiat launch Winter Olympics competition

This one I hadn’t seen coming: Google Earth and Fiat are cobranding a competition that highlights the Turin Winter Olympics. You register via a slick site, and are then given a network link to download. This takes you to the Olympic area around Turin in Google Earth, which now boasts upgraded high resolution images.

Your task: Pick one of the dots on the map ÇƒÓ any dot will do (it’s not exactly a skills-based competition.) The four people whose dots prove closest to the hidden treasure by the end of the contest will win a New Fiat Sedici 4×4. As the cars cost $20,000 and the competition takes 3 minutes, this one is a no brainer.

While you’re surfing around Turin, why not take advantage of a KML file marking all Olympic venues, posted to Google Earth Community by Gommunity.

(PS. A preference for truth in advertising compells me to note that this competition is not “the first contest that lets you look down on the world from on high.” Don’t forget Adidas.)

(Via Touristime.it)

[Update 2006-02-02: 00:12 UTC: Heh. From the small print: “The Fiat Sedici can be awarded as a prize to contest winners in the following countries: Italy, France, Great Britain, Austria, Switzerland, Greece and Spain.”]

News round-up: Google Earth’s competition

Scrappad reports that ESRI has released its ArcGIS Explorer as a closed beta, which apparently means that scores of GIS pro bloggers will be playing with it without being allowed to blog it due to NDAs. How frustrating has that got to be? :-) Meanwhile, Geography 2.0 provides a non-NDA-constrained overview of ArcGIS Explorer, and how it will likely be positioned against Google Earth.

For NASA World Wind users comes news of an important plugin, Shockfire’s KMLImporter, which does precisely that. I’m on a Mac so I can’t test it, and I doubt it has the functionality of the network link, but this plugin opens a wealth of static content to World Wind users, including 3D objects and overlays found on numerous Google Earth content sites. I’ll be on the lookout for feedback on the usefulness of the plugin. (Here is the developer’s blog.)

The release of KMLImporter is not so important for Google Earth surfers, but it is important for KML content developers, who might soon want to start checking their work in both Google Earth and World Wind — just like how web developers check their work in IE, FireFox, Safari, etc… Let’s hope the geobrowsers manage to avoid the cross-app rendering quirks that have so plagued web browsers. (Via Le Blogue du CFM de Guadalajara)

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.]