【发布时间】:2011-10-03 21:14:57
【问题描述】:
我想:
- 使用 HTML5 收集用户的纬度、经度和准确度
- 在谷歌地图中显示为一个点
- 更改点的大小和地图的实际比例以反映位置的准确性。
这应该是可能的,但我还没有看到有人实现这个。
【问题讨论】:
标签: html google-maps geolocation
我想:
这应该是可能的,但我还没有看到有人实现这个。
【问题讨论】:
标签: html google-maps geolocation
应该是可以的。根据article,HTML5 位置对象返回以米为单位的准确度属性。
google map api 能够在给定中心点(lat、lng)和以米为单位的半径的情况下绘制圆。
我在想这样的事情:
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var accuracy = position.coords.accuracy;
var centerPosition = new google.maps.LatLng(latitude, longitude);
var marker = new google.maps.Marker({
position: centerPosition,
map: //your map,
icon: //the dot icon
});
var circle = new google.maps.Circle({
center: centerPosition,
radius: accuracy,
map: //your map,
fillColor: //color,
fillOpacity: //opacity from 0.0 to 1.0,
strokeColor: //stroke color,
strokeOpacity: //opacity from 0.0 to 1.0
});
//set the zoom level to the circle's size
map.fitBounds(circle.getBounds());
【讨论】:
【讨论】: