xavendano
xavendano

Reputation: 133

Error with Google Maps API deprecated

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

Upvotes: 0

Views: 1271

Answers (2)

xavendano
xavendano

Reputation: 133

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:

Upvotes: 1

EAK TEAM
EAK TEAM

Reputation: 7552

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

Upvotes: 1

Related Questions