[英]Bing Maps api Problems geocoding addresses with “#”
使用Bing Maps API,可以使用“#”对地址进行地理编码
示例-此地址的地址解析为“ OK”:
1600 Amphitheatre Pkwy APT 23,Mountain View,CA 94043,USA
但是,如果我将Apt替换为美国加利福尼亚州94043,山景城1600 Amphitheatre Pkwy#23,则结果为错误。
这是我的网址:
var strAddress ;
string url = "https://dev.virtualearth.net/REST/v1/Locations?query=" +
strAddress + "&key=" + key;
我尝试使用encodeUriComponent,System.Web.HttpUtility.UrlEncode,Uri.EscapeUriString,
像这样的字符串url =“ https://dev.virtualearth.net/REST/v1/Locations?query= ” + System.Web.HttpUtility.UrlEncode(strAddress)+“&key =” +键;
他们都没有为我工作!
基本上,我们会在插件中进行地理编码,而不是JavaScript。
谁能帮我吗? 提前致谢。
您可以使用encodeURIComponent将#
字符转义到%23
,然后防止它启动URI的哈希组件。 作为一个未经测试的示例:
stringUrl = "https://dev.virtualearth.net/REST/v1/Locations?query=" +
encodeURIComponent( strAddress) + "&key=" +
encodeURIComponent( key);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.