0

I have an app that was not used for a long time and a client wants to activate it. The point is that this app used winforms-geplugin-control-library and that component stopped working for more than one year because it references a deprecated Google Earth API.

Is there any component similar that allows the functionality of the original or at least a certain level of .NET (C#) operability?

GEPluginCtrls Earth not found

4
  • I think the answer is no. We use GE only via KML on PCs with GEPro installed. AFAIK there isn't replacement for the old API functionality. Hopefully I'm wrong. What API functions do you need?
    – rheitzman
    Mar 13, 2017 at 17:28
  • I am still in detective mode to determine the functionality of the program, but the issue of the API has consumed me a lot of time. I managed to change the use of the API by Earth for Maps and even make some examples, but now I have a problem with onis.js, apparently an IE related topic or the WebBrowser used.
    – xavendano
    Mar 13, 2017 at 18:41
  • You have realized that you are mixing up Google Earth and Google Maps - correct? Google Earth is installed desktop software. Google Maps is a cloud based system.
    – rheitzman
    Mar 14, 2017 at 16:36
  • Google Earth has a API too...not only a desktop app.
    – xavendano
    Mar 15, 2017 at 17:40

2 Answers 2

1

Please take a look at here :

http://www.c-sharpcorner.com/uploadfile/raj1979/using-google-earth-in-a-windows-forms-application/

Get Started:

Let's get started.

Create a new Windows Application in Visual Studio 2005 or 2008 or later versions using Windows Forms.

Now drag and drop a Web Browser control from Toolbox to Form.

When you install Google Earth on your machine, you will be running GoogleEarth.exe. Find this exe on your machine where you installed Google Earth and add GoogleEarth.exe to your Windows Forms application's bin folder.

Now add a new HTML page to your Windows Forms application and past the fillowing code to your HTML page.

This script key is provided by Google.

<script src="http://www.google.com/jsapi?key=ABQIAAAAOh61kmAMajizdQht-    Zz3MhReSrBDmGipqiQxKIYFIGIHpqaJ1BRq6XLUD-i7BPkx7XreIBQJ1MetxQ"> </script>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
   <title>Sample</title>
   <script src="http://www.google.com/jsapi?key=ABQIAAAAOh61kmAMajizdQht-  Zz3MhReSrBDmGipqiQxKIYFIGIHpqaJ1BRq6XLUD-i7BPkx7XreIBQJ1MetxQ"> </script>
   <script type="text/javascript">
      var ge;
      google.load("earth", "1");

       function init() {
         google.earth.createInstance('map3d', initCB, failureCB);
   }

      function initCB(instance) {
         ge = instance;
         ge.getWindow().setVisibility(true);

ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);

       ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
  ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
      }

      function failureCB(errorCode) {
      }

       google.setOnLoadCallback(init);
   </script>

</head>
<body>
   <div id="map3d" style="height: 400px; width: 600px;">
</div>

</body>
</html>

Now set the Web Browser control's URL to that .htm page location, which you just added to your application in your code behind. You can write this code on Form's Load event handler.

this.webBrowser1.Url = new System.Uri(System.Environment.CurrentDirectory + "\\" + "Files\\MyGoogleEarthFile.htm", System.UriKind.Absolute);

Now build and run the application.

or see here for other implementation :

https://www.codeproject.com/Tips/889136/Csharp-Google-Maps-in-WinForm-with-WebBrowser-and

Google provides a JavaScript API for including maps with the same functions of maps.google.com in an HTML page.

In version v2, you need to register to obtain an API key for using the library, with version v3 it's optional but it's recommended because the API has a limitation, you can only generate 25,000 maps per day, if you need more you need to pay so you need to register and if you register you can:

Obtain statistics of the maps generated per day Pay for additional maps (more than 25,000 per day) Restrict the use of your key to prevent use on unauthorized sites

3
  • Thanks for your help, but i have the same response: "var error = new Error("Module: 'earth' not found!"); error.toString = function() { return this.message; } throw error; " thats is the deprecated API.
    – xavendano
    Mar 13, 2017 at 14:55
  • remove the old winforms-geplugin-control-library and use one of above examples in the answer
    – EAK TEAM
    Mar 13, 2017 at 14:59
  • I made a whole new project using the Maps API 3.21 and everything was fine until an error appeared with onions.js. Apparently this is a compatibility issue with the embedded API and WebBrowser that uses Visual Studio by default.
    – xavendano
    Mar 13, 2017 at 18:44
1

Finally after several tests and following the excellent recommendations of the group a suggestion of another post Google Maps Script error in Onion.js apparently solved the case and certainly Should be a compatibility issue with IE and the Google Maps API in Javascript for the embedded WebView type object.

Putting meta to HTML enabled compatibility:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.