我想使用谷歌地图API从服务器端的功能(使用node.js) https://developers.google.com/maps/documentation/javascript/geometry#poly 我想看看点是否在谷歌地图方向之间的点A到点B如何使用谷歌地图islonedonedge服务器?
isLocationOnEdge(point:LatLng, poly:Polygon|Polyline, tolerance?:number)
我在谷歌地图文档中使用了示例代码,并添加了一个console.log语句。但是,它不会向控制台输出任何内容。
function initialize() {
var mapOptions = {
zoom: 5,
center: new google.maps.LatLng(24.886, -70.269),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var cascadiaFault = new google.maps.Polyline({
paths: [
new google.maps.LatLng(49.95, -128.1),
new google.maps.LatLng(46.26, -126.3),
new google.maps.LatLng(40.3, -125.4)
]
});
var myPosition = new google.maps.LatLng(43.0, -125.9, 10e-7);
console.log('google.maps.geometry.poly.isLocationOnEdge(myPosition, cascadiaFault))');
}
另一个堆栈溢出问题,说要用包含的网址,http请求 http://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry&sensor=TRUE_OR_FALSE但我知道我需要实际包括islocationonedge参数莫名其妙。我应该要求 http://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry&sensor=TRUE_OR_FALSE&islocationonedge(point:latlong,折线:[adfasd,sdfs,adfasdf,adfasd],0.0001)?
非常感谢你的帮助
你能在客户端上运行? – geocodezip 2014-12-04 20:11:10
我不能,它说谷歌没有定义。 – user1476390 2014-12-04 20:17:38
然后你没有包括图书馆。 – geocodezip 2014-12-04 20:33:21