简体   繁体   English

反向地址解析在Subgurim GoogleMap中不起作用

[英]Reverse geocode not working in Subgurim GoogleMaps

I am using Subgurim GoogleMaps mapping library in my project. 我在项目中使用Subgurim GoogleMaps映射库。 Geocode function sometimes does not work in server system but the same code works fine in localhost. Geocode功能有时在服务器系统中不起作用,但是相同的代码在localhost中可以正常工作。

I am converting latitude and longitude to human readable address but sometimes Geocode status returns 500. The code is this: 我将纬度和经度转换为人类可读的地址,但有时Geocode状态返回500。代码是这样的:

string sMapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"];
GeoCode objAddress = new GeoCode();
objAddress = GMap.geoCodeRequest(new GLatLng(Convert.ToDouble(status.Rows[0]0]),Convert.ToDouble(status.Rows[0][1])),sMapKey);

StringBuilder sb = new StringBuilder();
if (objAddress.valid)
{
    sb.Append(objAddress.Placemark.address.ToString());
    string address = sb.ToString();
    lblPlace.Text = address;
}

There were some changes in the API lately (that rendered old V2 API calls unusable) but installing the latest version (4.1.0.5 or 4.1.0.6 on NuGet) of the library should solve the problem. 最近在API中进行了一些更改(使旧的V2 API调用不可用),但是安装该库的最新版本(在NuGet上为4.1.0.5或4.1.0.6)应该可以解决此问题。

If the problem occurs only with certain data please tell which are the inputs so it can be reproduced and diagnosed properly. 如果仅在某些数据上出现问题,请告诉您输入的是哪些,以便正确地进行复制和诊断。 The code seems ok. 该代码似乎还可以。

Bear in mind that when using localhost, all the license checking mechanisms are disabled (I don't know exactly the limits but surely are not the same as when using an API key under a named domain). 请记住,使用localhost时,所有许可证检查机制都被禁用(我不知道确切的限制,但肯定与在命名域下使用API​​密钥时不同)。 This means that maybe the problem is in the restrictions of the license. 这意味着问题可能出在许可证的限制中。

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

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