google earth exhibit?

18 views
Skip to first unread message

Matt Gilbert

unread,
Jul 14, 2009, 10:36:24 PM7/14/09
to SIMILE Widgets
On the Gogle Earth API site it says "If you have an existing Maps API
site, you can 3D-enable your page with as little as one line of
code." (http://code.google.com/apis/earth/)

Has anyone tried this on a Google Maps Exhibit? Seems possible.

John Callahan

unread,
Jul 15, 2009, 10:51:10 PM7/15/09
to simile-...@googlegroups.com
Hi Matt,

Yes, this is rather easy to do, at least just to get your map
Earth-enabled. And it looks pretty cool. I haven't tried anything
sophisticated yet with the GE plugin. One of these days....


There are several ways to do it but I've only tried one. First, add a
mapConstructor function to your map view

ex:mapConstructor="newMapConstructor"

Then, add the javascript function newMapConstructor() somewhere on your
page. Since you are now constructing your own google map from scratch,
you need to add a few lines that Exhibit normally does for you. Here's
something that works well

function newMapConstructor(mapDiv){
map = new GMap2(mapDiv);
map.setCenter(new GLatLng(39.2,-75.4), 8);
map.addControl(new GLargeMapControl());
map.addControl(new GHierarchicalMapTypeControl());
map.addMapType(G_SATELLITE_3D_MAP);
return map;
}

The "G_SATELLITE_3D_MAP" control enables the Google Earth plugin (which
must be installed on the client to work.)

You can also add any of the map controls listed in
http://code.google.com/apis/maps/documentation/reference.html#GControlImpl


Hope this helps.

- John

John Callahan

unread,
Jul 15, 2009, 11:02:21 PM7/15/09
to simile-...@googlegroups.com
David,

What do you think about adding the Google Earth plugin button as a map view settings?   Yes, I know it's another setting but I don't think that's necessarily bad.

Seems like a simple edit in Exhibit.MapView.prototype._constructGMap (in map-view.js) is all that's needed (outside of the adding the additional setting spec), adding something like the following at the end of that function.

if (settings.earthPlugin) {
      map.addMapType(G_SATELLITE_3D_MAP);
}

- John

Matt Gilbert

unread,
Jul 17, 2009, 12:17:41 PM7/17/09
to SIMILE Widgets
Thanks! That totally worked!

I'm hoping to do some more advanced stuff, generating polygons
(hopefully server-side) in a KML. I wonder if you or anyone else could
help point to a place where I can intercept and manipulate the data
that Exhibit is making. (is it/can it be in KML form?) If you're
curious, what I'm working on is a more dynamic and faceted in-browser
version of this:
http://www.mattgilbert.net/article/49/treescrapers-map

Thanks!
Matt


On Jul 15, 10:51 pm, John Callahan <john.calla...@UDel.Edu> wrote:
> Hi Matt,
>
> Yes, this is rather easy to do, at least just to get your map
> Earth-enabled.  And it looks pretty cool.  I haven't tried anything
> sophisticated yet with the GE plugin.  One of these days....
>
> There are several ways to do it but I've only tried one.   First, add a
> mapConstructor function to your map view
>
> ex:mapConstructor="newMapConstructor"
>
> Then, add the javascript function newMapConstructor() somewhere on your
> page.  Since you are now constructing your own google map from scratch,
> you need to add a few lines that Exhibit normally does for you.  Here's
> something that works well
>
> function newMapConstructor(mapDiv){
>   map = new GMap2(mapDiv);
>   map.setCenter(new GLatLng(39.2,-75.4), 8);
>   map.addControl(new GLargeMapControl());
>   map.addControl(new GHierarchicalMapTypeControl());
>   map.addMapType(G_SATELLITE_3D_MAP);
>   return map;
>
> }
>
> The "G_SATELLITE_3D_MAP" control enables the Google Earth plugin (which
> must be installed on the client to work.)
>
> You can also add any of the map controls listed inhttp://code.google.com/apis/maps/documentation/reference.html#GContro...
Reply all
Reply to author
Forward
Message has been deleted
0 new messages