Cruisers & Sailing Forums (
-   OpenCPN (
-   -   Google Earth Plugin (

r.fairman 27-02-2011 09:00

Google Earth Plugin
I have for the last few weeks been researching a OpenCPN Google Earth Plugin. Earth plugins are already available for Oziexplorer and Fugawi and are offered a free addon as as experiment only. The Fugawi plugin opens the GE render window in Fugawi window with GE still running as a process. GPS positions are duplicated in the GE window as well as the chart window. and any change of view in the the Fugawi window is duplicated in the GE window. Routes do not display inthe GE window but can be imported by exporing from Fugawi and importing into GE. A GE window can be captured and georeferenced for display in the chart window as can a chart from the Fugawi window to the GE window.

GE has a had a COM API for some years but it is no longer supported by Google but still works with GE 6. Google seems to be moving awy from the desktop to the Google Earth Plugin for web browers which is fine for online use but as it has no cache is useless for navigation away from an internest connection.

Luicci at GoogleEarthAilines has developed an ActiveX conttrol that will display the GE desktop render window in a form in VB and Delphi and i have used in in a C++ form. I believe the ActiveX code is GNU licensed

As a first stab at a GE plugin for OpenCPN we need
A button the open GE in a window overlaying the OpenCPN screen.
OpenCPN needs to output the gps position as a KML file networked linked to the GE window
OpenCPN need to output routes wayponts eTC to an KML file to be read by GE and diaplyed in the GE window
Open CPN needs to output any change in screen view such as zoom etc as a kml file to GE so the change the GE view

OpenCPN need to be able to screen capture the current chart view and overlay it as an image in GE and adjust its transparency
Opencpn needs to be able to screen capture the current GE view, georeference it and diplay it in the chart view

Both the last two points are possible using GE2Kap

As for legals, Goole say they are happy for the Google Earth Plugin to be used in a web page under certain conditions. As for using the Com Api and embedding the Google render window in an application Google has already supplied the tools to do this so..

I am no software engineer. My background is in software documentation so I hope someone will take this forward and i can document as text and online help

refs GoogleEarthAirlines - web plugin for GoogleEarth

VB and C++ GE Plugin

Delphi GE Plugin

I am away for 2 weeks from 1st march with limited email access only


Richard Fairman

sinbad7 27-02-2011 09:41

Re: Google Earth Plugin
1 Attachment(s)

Perhaps you did'nt see the thread I started earlier titled: OpenCPN / Google Earth Combination

I have Fugawi Marine ENC with the GE plugin and hope someone with programing experience and the time will also make a plugin for OpenCPN one day.

In the meantime,use my suggestion,which easily brings up any GE display from geo locs picked out from OpenCPN's CM93 maps by just placing a waypoint and copying it's geo locs to KLM Writer. You end up with a split screen with GE in one and OpenCPN in the other. Not automatic,but easy to jump between the two screens and adjust zoom factors etc.


sinbad7 27-02-2011 10:35

Re: Google Earth Plugin
1 Attachment(s)
Here is another combination from Sopers Hole, Tortola where the CM93 chart is North up and GE through the KML inteface is showing the view to the East with a 45 degree viewing angle.


prof_mariner 27-02-2011 17:47

Re: Google Earth Plugin
This capability interests me as well. Would it be possible to put a KML link as an overlay in OpenCPN?

manimaul 08-03-2011 20:56

Re: Google Earth Plugin
I've considered making this into a OpenCPN plugin. But for now it is not since I have other development projects I'm currently working on ...
Matrix Mariner GPS


nohal 09-03-2011 06:21

Re: Google Earth Plugin
1 Attachment(s)
Hi GE lovers,
wanted to try whether COM still sucks as hard as it did last time I had to work with it.
It does :banghead:
But on a positive note, I have a working GE 5.2 in an OpenCPN plugin window following the cursor on the map using the legacy COM API (Google Earth COM API Documentation), which is if I understood the discussions correctly the way to make GE cache the data locally.

What has to be done to make this toy worth trying for anybody:
- Make it follow the boat and not the cursor (have to have a look how to get it from the NMEA stream or extend the plugin API to send an event when the boat moves, like it does for cursor)
- Make it adjust the ge view to the zoom of the chart (GE doesn't know anything like scale, just the height of the camera over the focus point, I still don't know if I can get the scale from OpenCPN)
- Use AUI so that the window can be docked (done in dashboard, hope easy to copy)

Have to say it was the most annoying thing I was researching in the past year at least...

As I already put the effort to make it possible, I will try to finish the above points, but if there's anybody who wants to take it over, I will gladly get rid of this "pet" ;)

Source not yet available, will post it on github as soon as it's not as broken as it is now.


bdbcat 09-03-2011 11:29

Re: Google Earth Plugin

Nice work so far.

Good news:
The OCPN 2.4 PlugIn API has been extended to support Pluggable chart types. This came about as a part of the BSB4 PlugIn. So, the ViewPort and scale information that you need in the GE PlugIn is now (or soon) available at the API.
There are also interfaces to ask the PlugIn to render a "chart" at a specific scale and geolocation on the screen. Sounds like just what you need.

So, don't invent any new API just yet. The 2.4 API will appear very soon now.

This actually becomes a good test of the 2.4 API. Is it rich enough to build a PlugIn for arbitrary "chart" images? If not, now is a good time to extend it as necessary.

For instance, maybe we need split screen or transparency options. All ideas considered.

Thanks so far

nohal 09-03-2011 12:13

Re: Google Earth Plugin
welcome back, hope you enjoyed the vacation :)
I was expecting something like that while reading the BSB4 post and am busy trying to understand the AUI stuff anyway, so no problem waiting a couple of days for the extended API.



nohal 10-03-2011 12:13

Re: Google Earth Plugin
1 Attachment(s)
We have some nice progress here...
Dave, the API extensions in the upcoming 2.4 beta are exactly what was needed :thumb:
There are still quite a few glitches I have to figure out, but the GE plugin is able to start and follow the chart view if the user is not very evil at it...


idpnd 10-03-2011 12:23

Re: Google Earth Plugin
Google are still "working on" GE API support under linux..

nohal 10-03-2011 12:43

Re: Google Earth Plugin
I really don't believe that they will ever do it as even on windows the COM API is now obsolete and Google pushes the new JavaScript browser API as a way to go.
While it's not a bad idea and it meets their ChromeOS plans to conquer the world, it is useless for us as we need the data available offline and there's no cache in the browser plug-in.
If there will ever be anything that works under Linux, it will be the new version.


idpnd 10-03-2011 12:53

Re: Google Earth Plugin
Thanks for the info Pavel! I suppose the matrix mariner gps splitter will have to do for us linux types :)

nohal 11-03-2011 09:00

Re: Google Earth Plugin
2 Attachment(s)
following the first OpenCPN 2.4 beta release, the Google Earth plugin, version 0.1 is ready for testing as well.

It does NOT and will not work with OpenCPN 2.3.1 as it relies on the API extensions introduced in version 2.4

Before you use it:
  • Make sure you are using Microsoft Windows. Sorry, there is no chance to get this running on any normal operating system :(
  • Download OpenCPN, version 2.4.0310 beta from Download OpenCPN | Official OpenCPN Homepage and install it
  • As far as Google Earth is concerned, I'm currently running it with the version identifying itself as (beta), but older ones should probably work as well.
  • To make the view sizing work reasonably, run Google Earth and turn of the toolbar and the sidebar in the View menu or Ctrl + Alt + T and Ctrl + Alt + B respectively
  • Download the attached file gecomapi_pi.doc, change the extension to .dll and place it into the plugin directory in your OpenCPN installation. If there is anyone who has any word in how this forum is running, I second Dave's note in the BSB4 thread - the file extension restrictions help very little to increase security but a lot to drive people crazy :whistling:
  • Run OpenCPN, go to Toolbox and enable the GE plugin on the Plugins tab
  • After a short while the plugin icon will appear on your toolbar - be a bit patient as GE has to be started and it takes time.
  • Torture it according to your liking
  • Don't forget to report back the results
Plugin preferences:
The plugin can work in three modes of operation
Follow chart viewport - in this mode the plugin tries to display the same stuff you can see on the chart. The calculation used is very basic though - the height of the camera above ground is computed as half the width of the chart viewport, assuming that one minute longitude = 1852 meters. (Thank you Mr. Pythagoras) No it is not exact and no, it is not easy to make it much better because there is no Mr. Mercator in GE...

Follow boat - Should follow the boat (untested as I'm sitting at the table and no events coming from the core)

Follow cursor - Follows your cursor on the chart

For the later two modes you can set GE view manually using the 3 sliders in the lower part of the settings dialog

The build works for me locally, but it does not mean it has to work for you. If it does not, let me know.

If you experience any problems (especially crashes of the whole OpenCPN), please try to check whether they happen also without the plugin so that we can distinguish the source of the problems better.

For those interested, the source is available at
By the way, it is the smallest and simplest plugin we currently have, so if you want a kickstart on plugin development, this is the smallest amount of code to study.

Good luck


sinbad7 11-03-2011 13:09

Re: Google Earth Plugin
1 Attachment(s)

Works great on my Vista system but I have a couple of suggestions:

1.Do not start the GE as a default when loading up OpenCPN,or let OpenCPN start first.

2.Could you start the GE screen as 50% as a default,filling ALL the screen.
(There is a blank area at the bottom presently.)
Any further personal adjustment choices could then be done later.

3. Any possibility to also display all AIS and own ship in the GE screen?
For that matter,duplicate all routes,sea marks,etc. etc.

Great beginning,GRATULATIONS!


sinbad7 11-03-2011 15:35

Re: Google Earth Plugin

Wish list # 4. Could you make the mouse wheel zoom active also in GE?

I would prefer,as a default, that the GE Plug-in was disabled upon closing OpenCPN.

Great job....


All times are GMT -7. The time now is 03:50.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.