Showing posts with label KML. Show all posts
Showing posts with label KML. Show all posts

Wednesday, 12 September 2007

Google Earth Quicktime Object Movie

This little experiment captures a tiny corner of Google Earth in a Quicktime object movie. I chose London's Battersea power station as the subject, though with hindsight that was probably not the most glamorous of places I could have picked. Nevertheless it is instantly recognisable (to the British and Pink Floyd fans at any rate ;) and there's a very good model of it in the 3D Warehouse.

It will need a few seconds to load, then, provided you have Quicktime installed, you will be able to change the view point by dragging on the image:

The object movie was created with Pano2QTVR, a utility that allows both QTVR panoramas and object movies to be constructed.

An extension to Pano2QTVR allows the object movie to be output in flash format:

The source images for the object movie have to be laboriously captured one at a time with Ctrl+Alt+S (or the mac equivalent) from Google Earth. View positioning is accomplished via the use of this kml file. This will allow easy positioning over most of a hemisphere in 24 azimuth steps at each of 7 elevations. It stops a couple of degrees short of ground level to avoid plunging the viewpoint underground. Note that the values of YOUR_LONGITUDE, YOUR_LATITUDE and YOUR_RANGE will need to altered to your chosen location before the file is any use!

If anyone knows a way to automate the image capture process, please drop me a line.

Saturday, 1 September 2007

Annotating PhotoOverlays and Worlds Within Worlds

Google Earth PhotoOverlays can potentially contain a huge amount of detail. I would like to see some method of applying annotations to points or areas of the PhotoOverlay, along the lines of the 'Add Note' facility at flickr.

On a broader theme, if the 'surface' of a PhotoOverlay could be treated in the same way as the surface of the GE globe, you could apply any of the GE annotation methods such as Placemarks, Paths and Polygons - maybe even other PhotoOverlays. Actually, this could apply equally well to ScreenOverlay and GroundOverlay elements, as well as surfaces of 3D models - in fact anything to which a coordinate system can be applied.

Imagine the possibilities. Worlds within Worlds!

Abbey Road Live Webcam Overlays

Here's a short comparison of three methods of aligning an image with the Google Earth scenery.

A while ago I attempted to create an overlay of the Abbey Road Studios live feed of the camera they have pointed at that famous zebra crossing. I plastered the image on a GroundOverlay and set the camera position to give a reasonable rendition of the crossing area, though of course most of the image appears distorted.

Next I tried a ScreenOverlay. Careful viewpoint positioning gives a fairly good result.

More recently, prompted and inspired by the work of Valery Hronusov over at GIS Planet I did a PhotoOverlay version.

I've collected all three together here for comparison:

View Abbey Road GroundOverlay in Google Earth

View Abbey Road ScreenOverlay in Google Earth

View Abbey Road PhotoOverlay in Google Earth

Clearly the PhotoOverlay gives the best fit (and I'm sure I could have done better with a bit more time), but despite having the positioning controls built into GE it is still quite a tricky business getting things aligned. When you adjust lat and long, the altitude relative to sea level remains constant, which means that the altitude above ground level changes as you move about. This happens regardless of the altitude reference type selected in the box. I'd like to see altitude relative to the ground stay constant, if that is the reference I am using.

Just to round things off, I couldn't resist placing a PhotoOverlay of the album cover too.

View album cover PhotoOverlay in Google Earth

St Mawes Castle Spherical PhotoOverlay

The source pano image is 8192 x 4096 pixels, decomposed into an ImagePyramid for display in a Google Earth PhotoOverlay using the Photoshop script. That means you can zoom in and enjoy the detail of the stone (except in the overexposed areas of course).

View in Google Earth

Unfortunately the implementation of spherical viewing isn't all it should be in 4.2beta, and the pano flips upside down when you stray too far from the initial heading. There also seems to be a bug which causes GE to crash if you launch a second instance of the same PhotoOverlay whilst still in viewing mode. Hopefully these issues will be cleared up before long.

Friday, 31 August 2007

Gliding at Upavon: Two PhotoOverlays

A shot of Upavon and my left knee from the cockpit of a DG1000 glider operated by the Wyvern Gliding Club.

I've compared two methods of embedding this image in a PhotoOverlay. The first kml file simply references the original photo. The second version references an ImagePyramid created from the photo.

The resolution of the image in the first method never equals that of the original photo, and appears blurred as you zoom in. The ImagePyramid version maintains high resolution as you'd expect. The odd thing is that you can zoom in on the plain, blurry image as far as you like, but the ImagePyramid version limits the amount of zoom you can achieve.

upavonglidingphotooverlay1.kmz

upavonglidingphotooverlay2.kmz

ImagePyramid Tiles from GMapImageCutter

For those without access to Photoshop, jpeg tiles for KML PhotoOverlays can be generated using the Google Maps Image Image Cutter by the UCL Centre for Advanced Spatial Analysis (CASA).

Pad your source image out so that it occupies the bottom left of a square image with a side length in pixels of a power of 2 (maximum size 8192x8192 pixels). Load it into Google Maps Image Cutter and set the 'Max Zoom Level' according to the image size as follows:

Size [px]Max Zoom Level
8192 x 81926
4096 x 40965
2048 x 20484
1024 x 10243

Create your tiles, which will be placed in a new folder.

All that is left to do is to run makepyr.bat from the same folder. It will create copies of the Image Cutter tiles, with names that are compatible with the KML2.2 ImagePyramid element. Ignore any file not found error messages.

One drawback with this approach is that it is likely to generate some unnecessary tiles at higher zoom levels from the image padding areas. These are pretty easy to spot (e.g. they are identical, uniform in colour and probably the smallest file size) and manually delete.

Photoshop Scripts for ImagePyramid Tiles

The KML2.2 PhotoOverlay supports ImagePyramid tiling, where large images are split into sets of 256x256 pixel tiles. Each set is at a different zoom level, with zoom level 0 containing a single tile with a small version of the whole image. Each increment of zoom level quadruples the number of tiles, until the highest level covers the entire image at full resolution. A better explanation is given in the Google Earth KML documentation.

As you can imagine, creating all those tiles can be something of a chore. For this reason I've tried my hand at writing Photoshop CS2 scripts to automate the task. Download MakeJPGImagePyramid.jsx and MakePNGImagePyramid.jsx and store them in your C:\Program Files\Adobe\Adobe Photoshop CS2\Presets\Scripts folder (or the equivalent Mac folder of course). Load your image, then run the png or jpg version of the script. Tiles will be placed in the same folder as the source image, with the source image file name postfixed with "_[level]_[row]_[col]".

The .png version will preserve any transparent areas of the image as transparent areas of the tiles.

These are the first Photoshop scripts I've attempted, so please forgive any silliness in their construction - I welcome any suggestions for their improvement!

The next stage is to do a script that saves in png when the tile has any non-opaque pixels and jpg otherwise. I'm not sure how to do this yet (check a histogram of the tile alpha channel perhaps, or select opaque pixels and check selection dimensions?), but I'll post it up when it's done.

Thursday, 30 August 2007

GE PhotoOverlays with Panoramic Spheres

For the last few days I've been experimenting in Google Earth 4.2beta with the KML2.2 PhotoOverlay element. I'll post some of the initial examples in the next few days, but I'll start with this evening's results.

A while ago Smithee over at Digital Urban came up with an excellent method of displaying 360x180 degree panoramic spheres in GE. I wondered what would happen if I tried to combine his panoramic spheres with the new PhotoOverlay element.

First download his Google Earth Trafalgar Square panorama and view it in GE. Then download this viewer photooverlay file, which has been set up with the same coordinates to place you at the centre of the sphere.

The results are a little disappointing, mainly because the implementation of spherical images in GE seems to be buggy. The image often moves jerkily and flips upside down when you stray too far from the neutral position. However, it does add an extra method of navigating the sphere and the ability to zoom in with the mouse wheel. I still much prefer viewing the spheres with a SpaceNavigator, but for those that don't have one this method gives an extra option.

viewerphotooverlay.kmz