Friday, January 30, 2009

Free EarthBrowser 3D website traffic visualizer

Introducing the EarthBrowser Site Tracker. It shows where and when people visit your site from all over the world. Play your traffic back and forth with the timeline slider, zoom in and out and see aggregated website stats that are updated every 10 minutes.

It's free to put on any website, just customize it and copy/paste some text into your HTML and you are up and running, no signup necessary.

Here's a live version:

This is one of many new free tools that I'm going to be releasing that showcase the upcoming EarthBrowser Flash plugin. I'll be putting out another nice embed tool that will be customizable to show any set of orbiting satellites and will zoom from one to the next.

Friday, January 23, 2009

Is anyone else tired of the GIS Inauguration tie-ins?

Microsoft, Google, GeoEye, DigitalGlobe, AEgis, CNN and more have all jumped on the bandwagon. Shameless event tie-in marketing. Let's think of some other tremendously useful things to do with GIS.

What the world needs now are more Santa trackers.

Thursday, January 22, 2009

Simple solution for MOUSE_WHEEL events on Mac

Flash does not support the MOUSE_WHEEL event for Macs. I was hoping it would be supported in version 9, and again in Flash 10 but I'm still waiting. There have been a number of solutions out there, and the best one I've found is Gabriel Bucknall's MacMouseWheel code. It consists of an actionscript class and some javascript code that will work together to have the browser pass the mouse wheel events to your Flash code.

After reading an awesome article by Peter McBride called JavaScript and VBScript Injection in ActionScript 3, I've put together a single as3 class that fixes the MOUSE_WHEEL problem without the need for any external javascript code. It works on Safari, FireFox and Opera and probably Chrome when it becomes available on the Mac.

The trick was to inject the mouse handling javascript code using ExternalInterface. The code finds the DOM node for itself, intercepts and passes the mouse wheel events which are then disributed to the current InteractiveObject under the cursor.

An example of initialization would be:

class awesomeapp extends Sprite {
public function awesomeapp() {
addEventListener(Event.ADDED_TO_STAGE, stage_init);
private function stage_init(e:Event):void {
addEventListener(MouseEvent.MOUSE_WHEEL, wheel_event);

Download the source (MIT license).

Friday, January 16, 2009

A 3D virtual globe for your website

It is nearly impossible to get people to download and install software, I know from experience. Even Google Earth is only installed on a few million computers. Installing software or browser plugins is not allowed in most corporate and government environments. If you want to display geospatial content on your website and not exclude most users, your only choice until now has been flat maps.

With EarthBrowser, you can have a true 3D virtual globe that is self-branded with a custom interface that fits your special data requirements right on your website. There is no installation required since Flash 9 has about 95% penetration. With just a few lines of javascript (or as part of a Flex app) you can make your site really stand out.


The first example of the EarthBrowser Flash plugin is up at with a simple interface that gives a hint at what is in the desktop AIR application and an easy way to download and install it. Download the free trial AIR app and take a look at all the great features. Chip in a few bucks if you like it and want to support my efforts to provide an alternative to the multi-billion dollar behemoths out there.

A small javascript program (about 350 lines) controls what data is visible and various aspects of the globe on that site. It lets you control the clock and camera elevation and toggle night shadows, clouds, doppler radar, earthquakes, snow depth and a set of 7 popular satellites which are all updated in realtime. Click on a satellite and it will zoom to it and smoothly animate the earth underneath in real-time using very accurate orbital elements (I've got permission to re-distribute satellite positional data from the US Space Command).

In my last post I mentioned that the demo app would not work on Internet Explorer due to problems with the JScript engine. Since Javascript is very close to Actionscript, I just made a few changes to the javascript code (adding ":*" after variable and function declarations) to make it compile into the Flash preloader. Now it works in Explorer too. However the special handling of mouse-wheel events isn't as nice so I'll have to hurry up on my VB getter/setter workaround I mentioned earlier.

The EarthBrowser plugin can read KML files and KMZ archives. It can also read Shapefiles and do coordinate projections using a ported version of the open source proj.4 library. There is a full set of GUI components including buttons, text input boxes, sliders, popups and scrolling lists that make creating a fully featured app simple. The desktop version is a pretty complex application but is written in under 4,000 lines of javascript. I'm working on the API documentation and am making a code repository so people can create and share their own components for use on the web or in the desktop version. As an example, adding one of the Free ESRI map layers to the globe takes about 3 lines of code.

I haven't mentioned it yet since I've not blogged in a while, but EarthBrowser did not win at the Adobe MAX show. Scrapblog won, they have a pretty cool app with a very well defined and active niche. It was a great experience and I met some really cool people. By the way, Ben Forta is *way* more impressive in person than his blog picture suggests.

Wednesday, January 14, 2009

EarthBrowser 3.1 written in Javascript

The new version of EarthBrowser which will be released later today has been written in Javascript. Can that be right? Yes and no. The entire control structure of the application has been re-written in less than 4000 lines of Javascript code using the new EarthBrowser plugin. However, all of the fast rendering and calculation code is still written in Flash (Actionscript 3).

Desktop Version
Version 3.1 has had a major facelift, is about twice as fast as the previous version and has some pretty cool new datasets like real-time satellites. This is a free update for all version 3 users of course, just starting up EarthBrowser will allow a seamless update once I put it out.

Online Version
The online version API is still not quite ready for release (I'm only one guy). However, later today when I release, please check out the EarthBrowser home page to see the first public demo of the online plugin. Right now it only works in Safari and Firefox. I've created a really simple 600 line demo application by simply copying some Javascript code from the desktop version and putting it up on the home page.

Writing your own modules
In November I alluded to being able to customize EarthBrowser with Javascript. I am working on creating a code repository with many examples on how to extend and customize EarthBrowser with your own data and user interface elements. The code will be portable and can be developed and tested on the desktop and then, if you like, posted to the web for the same functionality on your website.

I still need to fully document the API. Also I am working on support for Internet Explorer, which is tricky because Explorer does not have getter/setter methods. It uses it's own lame and non-standard JScript engine. However there is a trick I found in the Classical inheritance for Javascript code which uses Visual Basic to provide getter/setter functionality. A clever but lame hack, but it should work until Explorer 8 comes out and becomes mainstream.