【问题标题】:C# - Geocode pharmacy by name and locationC# - 按名称和位置对药房进行地理编码
【发布时间】:2017-05-23 16:16:34
【问题描述】:

如何通过名称和位置找到药房的坐标?

我正在尝试像这样使用 Google 地理编码 API 进行搜索:

var pharmacyName = "Farmácia Ereirense";
var address = "Cartaxo, Santarém";

var url = "http://maps.googleapis.com/maps/api/geocode/xml?address=" + pharmacyName + ", " + address + "&sensor=false";

但我在 GeoResponse Status 上只得到了ZERO_RESULTS,如果我用谷歌搜索“Farmácia Ereirense, Cartaxo, Santarém”,它找到了正确的位置...

我已经尝试过:

var pharmacyName = "Farmácia Ereirense";
var address = "Cartaxo, Santarém";

var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/xml?name=" + pharmacyName + ", " + address + "&key=" + apiKey;

但我得到了INVALID_REQUEST 结果。

Documentation I based on

【问题讨论】:

    标签: c# google-maps google-maps-api-3 geocoding


    【解决方案1】:

    我终于找到了解决办法!我们可以像这样执行文本搜索请求:

    var pharmacyName = "Farmácia Ereirense";
    var address = "Cartaxo, Santarém";
    
    var url = "https://maps.googleapis.com/maps/api/place/textsearch/xml?query=" + pharmacyName + ", " + address + "&key=" + apiKey;
    

    而且效果很好,就像 Google 的搜索一样。

    Documentation

    【讨论】:

      猜你喜欢
      • 2018-06-07
      • 1970-01-01
      • 1970-01-01
      • 2017-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多