Google Earth in browser

Events happening in the community are now at Drupal community events on www.drupal.org.
tomhung's picture

I just found this.... Thought you might be interested...

http://code.google.com/apis/earth/

The Google Earth Plug-in and its JavaScript API let you embed Google Earth, a true 3D digital globe, into your web pages. Using the API you can draw markers and lines, drape images over the terrain, add 3D models, or load KML files, allowing you to build sophisticated 3D map applications. If you have an existing Maps API site, you can 3D-enable your page with as little as one line of code.

Comments

add google earth to gmap

tomhung's picture

gmap.module
line:28
from

define('GMAP_API_VERSION', '2.115');

to
define('GMAP_API_VERSION', '2');




line:187
add

      $map['Google']['Earth'] = array(
        'title' => t('Google Earth Plugin'),
        'default' => FALSE,
        'help' => t('Map with Google Earth Plugin (http://code.google.com/apis/earth/) Internal name: G_PHYSICAL_3D_MAP'),
      );




gmap.js
line:205
add

    if (obj.vars.baselayers['Earth']) {
      opts.mapTypes.push(G_SATELLITE_3D_MAP);
      opts.mapTypeNames.push('Earth');
    }

you will now have a option on gmap to enable the "Earth" view. This will require the plugin or activeX control.



I hope this helps..
G

Thanks Tomhung. Anyone manage

OpenSourcer's picture

Thanks Tomhung. Anyone manage to get a kml/kmz loaded onot the Google Earth Layer. Any help will be appreciated. Thanks.

When I do this, the location markers dont trnslate to GE

bizfu's picture

Thanks for this snippet btw!

When I choose to show user locations, the markers briefly show up as expected while the window is loading, and then as soon as the earth is visible the markers turn to little x's. is there a way to set the marker type as in the other map styles in a way that translates int GE?

Additionally when I add a node with a location and then choose to show node locations the same thing happens.

Any advice on how to have the marker style settings carry over would be appreciated, or even just to force a marker style other than the x would be gratly appreciated.

Thanks!
-biz

Two JS errors

EvanDonovan's picture

I'm getting two JS errors when I try this:

1) Error calling method on NPObject (line 185)
2) this.pd is undefined (lines 793 & 804)

Does anyone have any idea how to fix this?

Error only occurs in Firefox

EvanDonovan's picture

I just noticed that the errors I mentioned only occur in Firefox, not in IE. This is a rare time, I guess, when IE is better.

I'm able to get this working

krisbfunk's picture

I'm able to get this working in Chrome and IE, but not Firefox when setting Google Earth as the default map type.

In Firefox 3, the applet lags and does not load if set to default. BUT if the buttons are clicked back and forth a few times (Hybrid, Satellite, etc.), the GE applet re-appears.

updated the api version

krisbfunk's picture

to 2.153 and now have no problems in FF3

from

define('GMAP_API_VERSION', '2.115');

to

define('GMAP_API_VERSION', '2.153');

Sounds good

EvanDonovan's picture

Ok, I'll try that.

Line numbers shifted.

Cyberflyer's picture

I just applied this welcome hack and noticed the the line numbers to do the insertion of the new code have changed.

I am using version = "6.x-1.1-rc1" of GMap as of March 10, 2009.

in gmap.module the line to add the code snippet:

  $map['Google']['Earth'] = array(
    'title' => t('Google Earth Plugin'),
    'default' => FALSE,
    'help' => t('Map with Google Earth Plugin (http://code.google.com/apis/earth/) Internal name: G_PHYSICAL_3D_MAP'),
  );

Would appear to be around 250. I put mine at the end of a Baselayers Case construct:

case 'baselayers':
  $map['Google']['Map'] = array(
    'title' => t('Map: Standard street map.'),
    'default' => TRUE,
    'help' => t('The standard default street map. Internal name: G_NORMAL_MAP'),
  );
  $map['Google']['Satellite'] = array(
    'title' => t('Satellite: Standard satellite map.'),
    'default' => TRUE,
    'help' => t('Satellite view without street overlay. Internal name: G_SATELLITE_MAP'),
  );
  $map['Google']['Hybrid'] = array(
    'title' => t('Hybrid: Hybrid satellite map.'),
    'default' => TRUE,
    'help' => t('Satellite view with street overlay. Internal name: G_HYBRID_MAP'),
  );
  $map['Google']['Physical'] = array(
    'title' => t('Terrain: Physical feature map.'),
    'default' => FALSE,
    'help' => t('Map with physical data (terrain, vegetation.) Internal name: G_PHYSICAL_MAP'),
  );
  $map['Google']['Earth'] = array(
    'title' => t('Google Earth Plugin'),
    'default' => FALSE,
    'help' => t('Map with Google Earth Plugin (http://code.google.com/apis/earth/) Internal name: G_PHYSICAL_3D_MAP'),
  );   //  GE Hack
  break;

In gmap.js the line number to insert the snippet is around 242.

I added the GE layer to the Load Map types construct at the end, like so:

// Load google map types.
if (obj.vars.baselayers.Map) {
  opts.mapTypes.push(G_NORMAL_MAP);
  opts.mapTypeNames.push('Map');
}
if (obj.vars.baselayers.Satellite) {
  opts.mapTypes.push(G_SATELLITE_MAP);
  opts.mapTypeNames.push('Satellite');
}
if (obj.vars.baselayers.Hybrid) {
  opts.mapTypes.push(G_HYBRID_MAP);
  opts.mapTypeNames.push('Hybrid');
}
if (obj.vars.baselayers.Physical) {
  opts.mapTypes.push(G_PHYSICAL_MAP);
  opts.mapTypeNames.push('Physical');
}
if (obj.vars.baselayers['Earth']) {
  opts.mapTypes.push(G_SATELLITE_3D_MAP);
  opts.mapTypeNames.push('Earth');
}  //  GE Hack

Have applied the new code there and am about to commence testing.

Now, has anyone tried

krisbfunk's picture

Now, has anyone tried loading a kmz / dae? According to the Google samples, it can be done with the new API.

loading KMZ/DAE

Cyberflyer's picture

I have a Google Earth pane running in a Content type.

My understanding, to start with is that you can pass a KML file which could include a DAE in the Google Maps macro.

Have not had time to run that test yet, but that would be the simple way to start.

First thing I notice is that the GE Map is not solid in the web page when you scroll-- there is a lag that you don't get with a Google Map. I'd like to see that go away if possible, so that the user perception that the Google Earth view is firmly fixed in the page is maintained.

After getting the KML into the view through the Google Maps Macro and seeing it run, then there needs to be work done to drive the GE UI API through javascript, which is where things get cool.

L

If you happen to load a KML

krisbfunk's picture

If you happen to load a KML successfully, please post a little more about the process. I get an automap0 popup error when attempting to do it using the KML_Overlay plugin method (Gmap addon).

KMZ DAE using gmap & google earth plugin

krisbfunk's picture

just following up; anyone attempt this?

I'll try test it with kml

tracerul's picture

Thanks for share this, it's work great.

Anyone manage the KMl/KMZ

OpenSourcer's picture

Anyone manage the KMl/KMZ insert into the Earth Layer. Please help??

yeah but i'm not using any

seaslug's picture

yeah but i'm not using any specific module.... for it...

but API code for Google Earth to import KML/KMZ files looks something like this...

  var url = 'the_full_http_url_to_your_KML_or_KMZ_file';
  google.earth.fetchKml(ge, url, finished);

  document.getElementById('installed-plugin-version').innerHTML =
    ge.getPluginVersion().toString();

Hope it helps

How To ?

lmenard's picture

Hi,
I'm knew to Drupal and though I read and browse a lot of module page, forum threads and tutorial I can find a "proper" mean to integrate inside Drupal a Google Earth Mashup.
To do so I've only be able to use

<

iframe> inside a page (see it at: http://www.atlas-solaire.fr/GHI-Map)

I would like to know if there is a step by step how to who allow me to do the same without relying on

<

iframe>.
Is there any live example of Drupal 6 Web site with Google Earth Mashups ?

Thanks for your help.

Cheers,

Lionel

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: