Archive for the ‘PHP’ Category

RSS & GeoRSS to KML

Monday, April 30th, 2007

Spured on by comments on Stefan’s Ogle Earth blog, have created this little page as a wrapper to the excellent service provided by geonames.org to automatically convert a RSS feed to KML. It also does RSS->GeoRSS and GeoRSS->KML.

http://www.nearby.org.uk/rss-to-kml.php

Hopefully should make it a bit easier to load a (Geo)RSS feed into Google Earth in the style of a RSS feed – it auto updates.

… really need more to talk about, been kinda quiet of late…

Geograph SuperLayer for Google Earth

Monday, March 12th, 2007

If you have Google Earth version 4 and broadband then you might be interested in clicking this link:

· Geograph SuperLayer · Geograph Superlayer - click to load into Google Earth

By opening the above link you should be able to view the whole Geograph image collection directly in Google Earth. This has been possible in a number of ways for a while, but this does so in a much more compelling way (i.e. a single small download!).

This exploits the new Region functionality of GE4 to only fetch and load detail as you zoom in, in this way the view starts depicting a course overview of the current coverage, zooming in reveals more detail until pictures themselves become visible. (the ‘Super’ is adopted from Google’s term of SuperOverlays – overlays that load via nested regions)

In particular this is all pre-compiled and compressed, so should be fairly quick to download and is friendly as possible on bandwidth. Overall the layer consists of 102,965 files at 450MB compressed so there is a lot of data available, however you will download a lot less than this, probably on the region of a couple hundred files totalling about 2MB in a typical session.

As a small refinement, when a icon represents a single photo (a camera icon) if a view direction is stored the icon will have the top point in the appropriate direction. Also once the thumbnail is visible you can double click the thumb and the View will rotate to orientate the photo correctly!

Also this is only the first version, hot off the presses, so it not perfect yet, in particular would like to use Geograph specific icons (any Graphic Designers reading???), for example to give more feedback to the user on squares with many images, and view direction – also GE sometimes gets confused at the amount of detail available – plan to experiment to see if something can do about that.

… Hopefully users of GE3 should degrade nicely to use the View-based refresh method of viewing the dataset.

Oh and yes this is the little kml project I mentioned, see also other ways of loading geograph data into Google Earth or Google Maps via KML files.

KML writing PHP Class

Tuesday, March 6th, 2007

For a little project working on for Geograph (btw Second Birthday today!), that will end up producing quite complex (and repetitive) KML, I decided to take the plunge and create my own abstraction class.

There are already a few of these about, but I wanted something with just enough abstraction so don’t need xml in the php code, but without too much complexity, or a whole new syntax to learn. So the final output is basically a generic XML creation system, but tailored to KML generation, with a number of convenience methods for common bits of KML, (like outputting the right headers). This don’t do any schema enforcement, and assumes a good working knowledge of kml.

Anyway as the code is already GPL, thought would mention it here in case it useful to someone else.

Get the base class here (from the Geograph SVN repository)

There is also another file here, which extends basic the functionality, this is more specific to Geograph, but could still be useful.

And a few demo’s/tests used during development:

Demo1 – (view running demo – by default displays the KML, option to open in GE)
Demo2 – (view running demo)

And for a real world use of the code (been in active use for a week now)

Eagle eyed viewers might notice it claims kml2.0 but then goes on to allow use of 2.1 features. Yes I know this is ‘bad’ but is with reason. I have found to my expense that using 2.1 as the version actually has a few undesirable effects, eg making the Document visible in My Places tree, can’t mix and match styleUrl and style (to have common style but with a unique icon), and a few other subtle things. Whereas GE seems to allow the new features in a 2.0 kml file, I guess this is the GE equivalent to quirks and strict mode. (disclaimer: it’s a while since I tested this, so might be old news, I really should run some real world tests to confirm this is still the case)