javascript/谷歌地图:将位置对象转换为字符串
javascript/google maps: convert location object to string
我正试图找出如何将以下对象从使用谷歌位置api转换为字符串
initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
以上内容显示了您的位置。然而,我想不出一种方法来查看它是什么字符串,这样我就可以使用它了。当我提醒它时,我会得到未定义的结果,我尝试了常见的可疑属性,但它们不会显示。我需要弄清楚它是什么,这样我就可以把它输入到以"Boston"或lat-lon或类似字符串为输入的方向服务中。
Please refer the below link.
http://jsfiddle.net/y829C/1/
Here you can enter zip code and get the latitude and longitude.
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': addresscity }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
latitude = results[0].geometry.location.lat();
longitude = results[0].geometry.location.lng();
var myLatlng = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
center: new google.maps.LatLng(latitude, longitude),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
相关文章:
- 如何在Javascript中将JSon对象转换为数组
- 如何将TypeScript对象转换为普通对象
- JavaScript代码问题:我正在将对象转换为数组
- 如何将对象转换为数组
- JS-如何将图像对象转换为灰度并显示
- 如何将javascript对象转换为json
- 将Java对象转换为JSON
- Undercore将对象转换为数组并按关键字名称排序
- Javascript,简化了对象转换
- Mongo-JS-如何将BSON/JSON对象转换为XML
- 将一个对象转换为一个单键对象数组(带下划线?)
- 如何将一个对象转换为数组对象
- 如何将对象转换为对象数组javascript
- 将 JSON 对象转换为 JSON 树
- 将主干集合对象转换为其原始类型
- 将 JSON 对象转换为序列化字符串以进行服务器端处理
- 将 JavaScript 对象转换为其他格式
- Angularjs:将对象转换为数组
- 如何将数组的对象转换为对象
- JavaScript 中的对象转换