Showing posts with label API. Show all posts
Showing posts with label API. Show all posts

Friday, September 26, 2008

An ADS to KML mashup

The idea of ADS to KML came up over morning coffee on the last day of the .astronomy meeting, and by the close of the conference I had most of it hacked together...

Publications for Allan, A. as KML

What am I talking about? A lot of papers on ADS now have links to the SIMBAD database for further information on the objects they discuss. For instance I was recently a co-author on an exo-planet paper which links to the relevant objects in SIMBAD...

The mashup at that point was obvious. Do an ADS query and look for all the papers with links into SIMBAD, then do a series of follow-up queries on SIMBAD and grab all of the objects mentioned in the papers. Then generate a KML file of your publication history, which you can either display directly in Google Sky, or embed into a Google Maps for Sky as I've done above.

Of course not all papers reference objects, and not all papers with objects have SIMBAD links, especially older papers. None the less, having run my script to generate a KML file for several colleagues now it actually gives a fairly good representation of their research interests.

You can grab the perl source code and have a play around with it yourself, you'll need my Astro::ADS module which you can grab from CPAN.

You could imagine several ways to extend my quick hack. If you had a large enough group of astronomers, and therefore a large enough number of papers, you could produce heat maps of the sky instead of using simple push pins. You could cross-correlate your own publications with that of a group or institute where you're thinking of applying for a job, or the publication output of a survey team with the footprint of their survey...

Comments welcome, but yes, I already know it's an interesting but essentially pointless hack. I mean other comments...

Wednesday, May 28, 2008

Google Earth in a Browser

Google Earth, meet the browser...


Unfortunately, for now at least, the browser plug-in is Windows only. While I've been promised that Mac OSX and Linux versions are coming soon, I'm really hoping that OSX support isn't limited to Firefox. For once, I'd like to see a Safari support out of the gate.

Update: Brady Forrest has a good overview over on the O'Reilly Radar, while Dann Catt is poking around the internals over on Geobloggers.

Sunday, December 16, 2007

Turning Google Maps into Tupperware

We've know this was coming for a while, but not when. News of Google Maps for Sky leaked out last week on the Google Maps API forum, quickly followed by the official Google announcement on Friday.


You can create a Sky map in the same way you did your plain old regular map, all you have to do is pass it the correct mapType. So something like this will get you a handle to a Sky Map,
     var map = new GMap2(document.getElementById("map"), 
{ mapTypes : G_SKY_MAP_TYPES });

However if you want to do anything to the map, the coordinate mapping isn't pretty. If you've got your RA and Dec in decimal degrees, you'll need to fudge them like this to push a marker pin into the sky,

     var point = new GLatLng( dec, -ra + 180 );
var marker = new GMarker(point);
map.addOverlay(marker);

This initially had me very confused, not only is it back-to-front, it's not what you have to do to your RA and Dec to plot it in Google Earth. There you have to subtract 180 from your RA value before throwing it into your KML file. Which of course brings me to KML support, there doesn't seem to be any right now...

The lack of KML support is a bit disappointing, it'd be nice to be able to take the KML network link that has the live feed of event messages flowing across the eSTAR network, and throw it directly into Maps. But right now that isn't possible. No worries though, this is an early release in every sense of the word. It's coming, I'm sure I can count on the Googlers.

With that in mind, it'd be daft for me to rewrite the code to throw the live events into Google Maps, because if KML support is coming, and surely it is, I'd just be wasting my effort. So I decided to sit down and PLASTIC-enable Maps instead. A few months ago I did the same for Google Earth, although obviously I had to take a slightly different tack this time around while turning Google Maps for Sky into so called "tupperware".


As before I've written a small PLASTIC application, a facade, which registers with the PLASTIC Hub as normal and listens for ivo://votech.org/sky/pointAtCoords messages. These are PLASTIC messages telling interested applications to "point at" an RA & Dec. When such a message is passed through the Hub, say by CDS Aladin, it is forwarded to the facade application, which then injects this into a boiler plate HTML file. The facade application then exposes this HTML file via an embedded web server. If you point a web browser at this end point you get a map with the marker plotted at the relevant RA & Dec.

Additionally when you send a PLASTIC message into facade application the place mark it generates has a link which, when clicked, will call back to the facade application's embedded webserver and allow you to send a PLASTIC message back to the Hub. This means there is bi-directional control, both in and out, of Google Maps with PLASTIC.

I've uploaded the source code again, but be warned, this is proof-of-concept stuff and when you're dealing with Perl that can get pretty torturous. Especially since I based it on the previous proof-of-concept code I wrote for Google Earth and never got round to fixing up.

There are obvious problems with my implementation, after all it was just a wet Sunday afternoon's work, but most of these are fixable with a little refactoring. However it does work, and uses a lot of the same concepts as my previous effort. This hints strongly that it really is time I got round to writing that general use PLASTIC module for Perl that I've been talking about for a year or more...

Update: More Google Maps for Sky, this time on the iPod touch.

Tuesday, August 14, 2007

When is an API, not an API?

When it isn't released yet? The general opinion is that Apple will open up the iPhone to third-party developers in October by providing a software development kit (SDK) with Leopard. I don't know anyone that isn't expecting this to happen now that the API has been more or less reverse-engineering and the first "professional" third-party applications are seeing the light of day.

Nobody is selling anything yet, but its interesting to see companies like Delicious Monster are willing to release native applications. Sociologically at least, this is a whole different kettle of fish than individuals releasing terminal emulators and other such stuff. Companies, even uber-cool ones are notoriously conservative. They generally take legal advise before doing stuff like this, and they're presumably pretty sure that Apple legal won't be dropping by to say hello in the near future. Which is interesting, no?

Tuesday, July 24, 2007

OSCON: Data-mining from Open APIs

My afternoon tutorial is Data-mining from Open APIs given by Toby Segaran. I'm currently stuck on the end of a row without access to a power socket, so we'll have to see how my battery holds out.


Toby Segaran talking about Data-mining

Having paged through the book I'm a bit unsure I really want to be in this tutorial, Toby has started out with a fairly dry discussion of what data mining actually is, which isn't really that reassuring. I don't think this is going to be the fun fast-paced tutorial on mashups that I was expecting. I think next year I should probably read the tutorial descriptions before picking what I'm going to, rather than waiting till I arrive at the conference.

Apparently he's got an book "Programming Collective Intelligence", which covers a lot of the same ground as this tutorial, due out in August with O'Reilly.

Update: Oh, he's just started to talk about regression trees and the CART algorithim. Moving on from supervised regression trees, he's talking about unsupervised methods.

Update: He's basing his unsupervised data mining example on grouping blogs on hierarchical clusters. He's using Mark Pilgrim's Universal Feed Reader to harvest the data from the Technorati top one hundred blogs,

I've sure you've all seen blogs...

with lots of Python code flipping across the screen he's building up a matrix of word occurrences and determining the distance between two blogs using Euclidean distance between the word counts. I guess that's okay for a simple example but there are other distance metrics; Manhattan, Tanamoto, Pearson Correlation, Chebychev and Spearman.

Update: He's showing how you can use Dendrograms and K-means Clustering to show how the blogs cluster up. I'm a bit frustrated here, this is good stuff, but his code is written in eight point font, black on white, and almost total unreadable.

Update: Okay, we've just broken for fifteen minutes for an unscheduled break...

Update: We just had about three quarters of an hour of network down time. The network crash happened just as I was posting an update, which appears to be toast. I hate it when that happens...

Update: ...okay, he's just finished two hours early. Erm? What on Earth!?

Wednesday, June 13, 2007

I've seen this movie...

You have to hand it to Tim Bray, I think I've seen this movie as well...
...where an interesting new protocol or interface or API comes along, is starting to get adoption, and big incumbent vendors say “That’s too simple for our needs”. Examples of such technologies include Unix, C, SQL, Java, and RSS: the kinds of technologies that end up winning. There are places... where cluelessness regularly triumphs. Internet protocols aren’t one of them. - Tim Bray
Well apart from Java which as I'm sure you know I think is far too complicated, give me a good weakly typed language any day, his point is well made. People like simple. Complicated architectures and APIs are okay in their place, but you have to make sure that this place is here...