In this article I will explain with an example, how to get Location Coordinates i.e. Latitude and Longitude from Zip Code (Pin Code) by making use of Google Maps API V3 (Version 3) and JavaScript.
Google Maps API V3: 通过邮编获取经纬度 Get Location (Latitude and Longitude) from Zip Code (Pin Code) using JavaScript
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title>
</head>
<body><textarea id="txtAddress" rows="3" cols="25"></textarea><br /><input type="button" οnclick="GetLocation()" value="Get Location" /><script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script><script type="text/javascript"><!--function GetLocation() {var geocoder = new google.maps.Geocoder();var address = document.getElementById("txtAddress").value;geocoder.geocode({ 'address': address }, function (results, status) {if (status == google.maps.GeocoderStatus.OK) {var latitude = results[0].geometry.location.lat();var longitude = results[0].geometry.location.lng();alert("Latitude: " + latitude + "nLongitude: " + longitude);} else {alert("Request failed.")}});};//--></script>
</body>
</html>

Explanation
I have made use of HTML <textarea> for allowing user enter the address of a location and an HTML button which will trigger the process of fetching the Latitude and Longitude using the Google Maps API.
As soon as the button is clicked the JavaScript click event handler is raised which executes the JavaScript function GetLocation which makes call to the Google Maps API which in turn returns the Latitude and Longitude based on the address provided for the location.
Note: Here I have not specified the API Key but you need to get one from the Google Maps API V3 in order to use on hosted server.
下载:GoogleMaps_GetLat_Long
原文:http://www.aspsnippets.com/Articles/Google-Maps-API-V3-Get-Location-Latitude-and-Longitude-from-Zip-Code-Pin-Code-using-JavaScript.aspx
转自:Google Maps API V3: 通过邮编获取经纬度 Get Location (Latitude and Longitude) from Zip Code (Pin Code) using JavaScript

Google Maps API V3: 通过邮编获取经纬度 Get Location (Latitude and Longitude) from Zip Cod相关推荐

  1. Google Maps API V3学习--- 简单地图显示

    技术发展日新月异,为了与时俱进,不让自己很快的落伍,正好项目有所需要,就学习了下 新发布的Google Maps API V3. V3相对于V2存在许多改变,比如在地图的加载上,尤其是手机浏览器访问的 ...

  2. Google Maps API v3:如何删除所有标记?

    本文翻译自:Google Maps API v3: How to remove all markers? In Google Maps API v2, if I wanted to remove al ...

  3. Google Maps API V3 之绘图库

    绘图库 本文档中的概念仅适用于 google.maps.drawing 库中提供的地图项.默认情况下,系统在加载 Maps JavaScript API 时不会加载该库,您必须使用 libraries ...

  4. Google Maps API V3 之绘图库 信息窗口

    Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...

  5. Google Maps API V3 之 图层

    图层概述 图层是地图上的对象,包含一个或多个单独项,但可作为一个整体进行操作.图层通常反映了您添加到地图上用于指定公共关联的对象集合.Maps API 会通过以下方法管理图层内对象的显示形式:将图层的 ...

  6. 谷歌地图添加点击事件 Google Maps API V3: Add click event listener to all (multiple) marker

    代码: <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sen ...

  7. ASP.NET调用V3版本的Google Maps API

    英文原文:Google Maps API V3 for ASP.NET 译文出处:青藤园 译文作者:王国峰 译文链接:ASP.NET中使用Google Maps API V3[译] 简介 Google ...

  8. Google Maps API 简易教程(一)

    Google Maps API 简易教程(一) 一.API Key 使用Google API,必须要从Google 那里获取一个免费的API 键.获取过程如下: (1)用google账户登陆https ...

  9. Google Map API v3 - 设置边界和中心

    本文翻译自:Google Map API v3 - set bounds and center I've recently switched to Google Maps API V3. 我最近切换到 ...

最新文章

  1. 关于CVPR 2019投稿的一些感想
  2. JavaScript 表单编程
  3. win7右键在桌面上转圈圈的解决办法
  4. java多线程系列13 设计模式 Future 模式
  5. PHP 正则表达式资料
  6. 转一个高内存定位的文章
  7. 【zabbix解决value too small or too large】
  8. HTML中的图像和链接
  9. c++ opencv4.5.0 头文件_简单的C程序分析(first.c程序)
  10. [CDLinux]安装向导
  11. 如何根据图片找到图中的地点
  12. 三度冲刺IPO,负债率超70%的喜相逢能否成功敲钟?
  13. 离散数据:析取范式与合取范式
  14. js设置一个打点计时器
  15. 活动预告 | 伍鸣博士受邀参加深链财经“2020非共识大会”
  16. 遇到这样的事,是挺难受的
  17. 【附源码】计算机毕业设计SSM我的大学电子相册
  18. C#之windous界面应用编程
  19. 【数据结构】使用队列实现循环调度法
  20. 看了一遍蝴蝶效应1,在看到了一篇很好的《蝴蝶效应1》影评

热门文章

  1. 高橋君とホテル / Tak and Hotels(AtCoder-2039)
  2. 字符串处理 —— 单模式匹配 —— MP 算法与 KMP 算法
  3. 整数去重(信息学奥赛一本通-T1117)
  4. oracle 朱志辉_DB2设计、管理与性能优化艺术
  5. android案例_Android实训案例——计算器的运算逻辑
  6. 无法将类型int隐式转换为string_Scala implicit 隐式转换安全驾驶指南
  7. 为k8s-master节点添加/移除污点taints
  8. CMake configure_file命令
  9. 剖析Caffe源码之Net---NetParameter参数
  10. 免费解决vcruntime140.dll文件缺失 - 资源篇