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.
<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" onclick="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.
相关推荐
Lite IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE
get_addr_longitude_latitude.pyget_addr_longitude_latitude.pyget_addr_longitude_latitude.pyget_addr_longitude_latitude.pyget_addr_longitude_latitude.pyget_addr_longitude_latitude.pyget_addr_longitude_...
and seconds, latitude and longitude of degrees, minutes, seconds field can be fine-tuning button or the keyboard up and down keys to increase or decrease the number,you can use left and right ...
Android : Example of Locations api. In this project we can get latitude and longitude of present locations
iPhone SDK : Get gps location latitude longitude
我们可以通过地球两点间的经纬度计算对应两点间的求面距离
In the GIS-related software often have to enter the latitude and longitude values, and MFC Edit control based on the latitude and longitude input controls need to create three Edit edit box to enter ...
geo-location, 地理定位API的Web组件元素 <位置>地理定位API聚合物网络组件。获取设备地理位置值的示例:<geo-location latitude="{{latitude}}" longitude="{{longitude}}">
convert the classical latitude & longitude coordina
2019年3月最新权威(www.ip2location.com)全球ip地址库,为.csv格式,类型为[DB5.LITE] IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE Database,即提供按 国家-地区-城市-经纬度 来区分的数据
DEPTH = GETDEPTH(LATITUDE, LONGITUDE) 估计指定坐标处的海底深度 DEPTH。 LATITUDE 和 LONGITUDE 坐标可以是指定十进制度的数值数组,也可以是指定度、分、秒或 GPS 度的字符串元胞数组。 DEPTH 以米为单位返回,...
2019年7月最新权威(www.ip2location.com)全球ip地址库,为.csv格式,类型为[DB11.LITE]级别,即提供 [DB9.LITE] IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database 国家-地区-城市-经纬度-邮政...
// Latitude and Longitude var PX = [ 293359.96770986664 , 382616.79057958454 ] ; var POINT = [ 71.62108586666666 , 93.41230238759388 ] ; coords . llToPX ( LL , zoom ) ; coords . llToPoint ( LL ) ;
数据集包含全球每个国家和每个美国州的GPS坐标。包括:国家代码,纬度,经度,国家,美国州代码,美国州纬度,美国州经度,美国州。...world_country_and_usa_states_latitude_and_longitude_values.csv
经纬度格式转换:度分秒格式之间的转换 编程语言:C++ 包括代码,debug版本与release版本,有可执行exe文件
1. Conveniently convert longitude and latitude coordinates to metric UTM northeast coordinate system 2. Calculate the distance between two UTM coordinates C++ See main.cpp function for details of ...
微信小程序中使用地图(map)组件,通过点击(tap)获取经纬度,按照官方的回应,暂时是没法做到的,从地图组件API多有残缺判断,怀疑是个实习生干的… 做个变通,适用性有限,请大家参考。基本思路就是在地图上铺满一层...
2020年6月最新权威(www.ip2location.com)全球ip地址库,为.csv格式,类型为[DB11.LITE]级别,即提供 [DB9.LITE] IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database 国家-地区-城市-经纬度-邮政...
2020年2月IP2Location(www.ip2location.com)全球ip地址库,为.bin格式,类型为[DB11.LITE]级别,即提供 [DB9.LITE] IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database 国家-地区-城市-经纬度-...
2019年7月最新权威(www.ip2location.com)全球ip地址库,为.csv格式,类型为[DB5.LITE] IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE Database,即提供按 国家-地区-城市-经纬度 来区分的共5字段数据