从 Google 地图获取地址(反向地理编码)

发布于 2024-11-19 16:41:15 字数 133 浏览 3 评论 0原文

我有一家网上商店,人们购买产品,我们将产品发送到他们的地址,但有时客户输入的地址错误,我们找不到目的地。

我想以地址形式显示谷歌地图,然后客户在地图上找到他们的地址,最后从谷歌地图中获取该点的地址。

谷歌提供这个功能吗?

I have a online shop and people buy products and we send a products to their address , but sometimes customers enter a bad address and we couldn't find the destination.

I want to show a Google map in address form then customer locate their address on the map and finally address of that point fetched from Google map.

Is Google offers this feature?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

尛丟丟 2024-11-26 16:41:15

您还可以根据该区域内已知的可送达地址检查该地址。该数据库由美国邮政局维护,他们每个工作日都会访问(实际上)每个地址。使用基于 Web 的 API,您可以查询数据库并获取自动匹配或获取建议匹配列表。我知道这不会为您提供地图,但在许多情况下,它可以让您的客户当场更正他们的地址,并且非常容易实施和使用。某些服务提供 Javascript 实现以及 API 中的 XML 挂钩。如果您在谷歌上搜索,请查找地址验证网络服务或类似的内容。

我在一家名为 smartystreets 的地址验证服务公司工作。

You can also check the address against known deliverable addresses within the area. This database is maintained by the USPS, who visits (practically) every address every single weekday. Using a web-based API you could query the database and either get an automatic match or get a list of suggested matches. I know this doesn't provide you a map, but in many cases, it can allow your clients to correct their address right there on the spot and can be very easy to implement and use. Some services offer a Javascript implementation as well as an XML hook into the API. If you're googling it, look for address verification webservice, or something similar.

I work for an address verification service called smartystreets.

许久 2024-11-26 16:41:15

是的,此服务称为反向地理编码
实际上实现起来非常简单。假设您从地图点击事件中获取纬度和经度值,如下所示:

var map;
function initialize() {
  var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var myOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  google.maps.event.addListener(map, 'click', function(event) {
    getAddress(event.latLng);
  });
}

function getAddress(location latlng) {
 var geocoder;
  var map;
  var infowindow = new google.maps.InfoWindow();
  var marker;
  function initialize() {
    geocoder = new google.maps.Geocoder();

    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
}

Yes, this service is known as reverse geocoding.
And it's actually quite simple to implement. Assuming you get lat and long values from map click event, like so:

var map;
function initialize() {
  var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var myOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  google.maps.event.addListener(map, 'click', function(event) {
    getAddress(event.latLng);
  });
}

function getAddress(location latlng) {
 var geocoder;
  var map;
  var infowindow = new google.maps.InfoWindow();
  var marker;
  function initialize() {
    geocoder = new google.maps.Geocoder();

    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
}
土豪 2024-11-26 16:41:15

查看反向地理编码.尽管您的问题是许多问题合而为一,但您应该将其分解为较小的问题并也在这里提问。

Take a look at reverse geocoding.Although your question is many questions in one and you should break it to smaller ones and ask them here also.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文