OK.  I first downloaded David's application at 
http://people.csail.mit.edu/dfhuynh/projects/election08/election08.html 
to my own server and everything worked fine. I then created two polygon 
KML files on my own (one through Google Earth and the other by 
converting from an ESRI shapefile.)  I ran both of these through Babel 
and downloaded the output as json files.  I used these two new json 
files as data sources in the election08 application. Everything looked 
great.  Polygons showed up where they should.  So, the translation seems 
to work.

I needed to make only a few changes to election08.html to make the data 
sources from Babel work.

1) As David mentioned, add ex:latlngOrder="lnglat" to the polygon map view
2) changed ex:polygon=".border" to ex:polygon=".polygon"
3) edited line 263 in polygon-map-view.js to use ";" as the separator 
between coordinate pairs.  (it was set to "|")


No such luck adding the data sources directly from Babel.  Using the 
same election08.html, I took out the links to the previous json data 
files and added the following immediately 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>

<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";
 
/>


This did not work for the test1.kml files or for the two kml files I 
created.  The error I got was a javascript dialgue box stating "Failed 
to load javascript file:" wiht the following as the file:

http://simile.mit.edu/babel/translator?reader=kml&writer=exhibit-jsonp&url=http%3A%2F%2Fsimile-widgets.googlecode.com%2Fsvn%2Fbabel%2Ftrunk%2Fconverters%2Fkml-converter%2Ftests%2Ftest1.kml&callback=Exhibit.JSONPImporter._callbacks.cb1

When you enter this URL directly in a browser, you get

Babel error: No reader of name kml


- John




David Huynh wrote:
> Hi all,
>
> 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
>
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to