I started to add support for KML -> Exhibit JSON conversion in Babel.
This is very very basic for now. To try it, go to
http://service.simile-widgets.org/babel/
Select "KML" in the first column of radio buttons, "Exhibit JSON" in the
second, "data is on some web sites" in the third, and paste in this test URL
http://simile-widgets.googlecode.com/svn/babel/trunk/converters/kml-converter/tests/test1.kml
Here's what you're supposed to see
http://service.simile-widgets.org/babel/translator?reader=kml&writer=exhibit-json&mimetype=text/plain&url=http%3A%2F%2Fsimile-widgets.googlecode.com%2Fsvn%2Fbabel%2Ftrunk%2Fconverters%2Fkml-converter%2Ftests%2Ftest1.kml
To enable this in Exhibit (before it gets added to Exhibit officially),
add this code after including exhibit-api.js
<script>
Exhibit.BabelBasedImporter.mimetypeToReader["application/vnd.google-earth.kml+xml"]
= "kml";
Exhibit.importers["application/vnd.google-earth.kml+xml"] =
Exhibit.BabelBasedImporter;
</script>
Then, a KML data link would look like this
<link rel="exhibit/data" type="application/vnd.google-earth.kml+xml"
href="http://simile-widgets.googlecode.com/svn/babel/trunk/converters/kml-converter/tests/test1.kml"
/>
I haven't tested this Exhibit integration myself. I know of one small
catch, which is that the KML converter generates pairs of lng,lat,
whereas the Exhibit map view expects lat,lng. You can make the Exhibit's
original map view takes lng,lat with this hack
Exhibit.MapView._accessorSpecs[1].alternatives[0].bindings[0].bindingNames
= [ "lng", "lat" ];
If you're using the polygon map view used by
http://people.csail.mit.edu/dfhuynh/projects/election08/election08.html
then you'd just need this in the view div
ex:latlngOrder="lnglat"
Some more thoughts are needed if different data sources use different
lat/lng orders.
Please let me know how this works out for you.
David
I think adding kml support to Babel is a great idea! Nice!
I think expanded GIS data views will be very helpful in exhibits, and I'm
working on polygons for my timeline/googleMaps mashup as well.
You may already be familiar with this project. These folks have a number
of useful things at: http://code.google.com/p/primary-maps-2008/
Without installing any sort of big GIS tool, I found this python script
particularly handy:
http://code.google.com/p/primary-maps-2008/source/browse/trunk/shpUtils.py
which suggested to me that it might be possible to induce Babel to handle
ESRI shapefiles as well.
Unfortunately, shapefiles for medieval manorial boundaries are not exactly
thick on the ground. ;-)
Jon
http://api.simile-widgets.org/exhibit/2.2.0/exhibit-api.js
That should use the new babel service, which supports KML.
David
>
> Jon,
>
> Thanks for the link! I didn't know about it before. But looking at it, I
> couldn't find any useful U.S. county boundary file...
Yes, we have no bananas. I just found the python code there useful for a
quick and dirty way of extracting lat/lon vertices from ESRI shapefiles,
and thought others might find it useful as well. I take your point about
the size of a US counties dataset and I haven't found the kind of coarse
grained data you seek.
Thank you John for this http://www.gdal.org/ogr/index.html
I'll be looking into this. If I'm going to be doing much in the way of
creating multiple map overlays, I'll probably need something more than a
python script and google map's API (Though I've made good progress with
just these)
Thanks all,
Jon
I'd need to consolidate all of the map functionalities back into the map
extension... I'll try to get to it one of these days.
David