简体   繁体   English

Google Maps API错误已弃用

[英]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. 关键是该应用使用了winforms-geplugin-control-library,并且该组件停止工作了一年多,因为它引用了已弃用的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? 是否有类似的组件允许原始功能或至少一定水平的.NET(C#)可操作性?

GEPluginCtrls 找不到地球

Please take a look at here : 请在这里看看:

http://www.c-sharpcorner.com/uploadfile/raj1979/using-google-earth-in-a-windows-forms-application/ 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. 使用Windows窗体在Visual Studio 2005或2008或更高版本中创建新的Windows应用程序。

Now drag and drop a Web Browser control from Toolbox to Form. 现在,将Web浏览器控件从工具箱拖放到窗体。

When you install Google Earth on your machine, you will be running GoogleEarth.exe. 在计算机上安装Google Earth时,将运行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. 在安装了Google Earth的计算机上找到该exe,并将GoogleEarth.exe添加到Windows Forms应用程序的bin文件夹中。

Now add a new HTML page to your Windows Forms application and past the fillowing code to your HTML page. 现在,将新的HTML页面添加到Windows窗体应用程序中,然后将填充代码添加到HTML页面中。

This script key is provided by Google. 此脚本密钥由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. 现在,将Web浏览器控件的URL设置为该.htm页面位置,您刚刚在后面的代码中将其添加到了应用程序中。 You can write this code on Form's Load event handler. 您可以在Form的Load事件处理程序上编写此代码。

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 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. Google提供了一个JavaScript API,用于在HTML页面中包含具有与maps.google.com相同功能的地图。

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: 在v2版中,您需要注册以获得使用该库的API密钥,在v3版中,它是可选的,但建议使用此API,因为该API有一定的局限性,您每天只能生成25,000张地图,如果您需要更多,则需要付费因此,您需要注册,如果注册,您可以:

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 获取每天生成的地图的统计信息支付额外的地图(每天超过25,000张)限制使用密钥以防止在未经授权的站点上使用

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. 最终,在经过几次测试并遵循小组的出色建议之后, 在Onion.js中提出了另一条关于Google Maps Script错误的建议,显然可以解决此问题,并且肯定应该是IE和Java的Google Maps API与嵌入式WebView类型的兼容性问题。宾语。

Putting meta to HTML enabled compatibility: 将meta与HTML启用的兼容性:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM