如何更改 JavaScript 代码?
// Update the radius when the user makes a selection.
google.maps.event.addDomListener(document.getElementById('radius'),
'change', function() {
var meters = parseInt(this.value, 10);
layer.setOptions({
query: {
select: locationColumn,
from: tableId,
where: 'ST_INTERSECTS(Latitude, ' +
'CIRCLE(LATLNG(53.337638, -6.266971), ' + meters + '))'
}
});
circle.setRadius(meters);
//alert(position);
//circle.setCenter(new google.maps.LatLng(position));
});
我想将 (53.337638, -6.266971) 更改为变量“位置”,位置与 (x,y) 具有相同的值类型,但它不适用于 其中:'ST_INTERSECTS(纬度,'+ 'CIRCLE(LATLNG('+位置+'), ' + 米 + '))' 我该如何修改代码?
// Update the radius when the user makes a selection.
google.maps.event.addDomListener(document.getElementById('radius'),
'change', function() {
var meters = parseInt(this.value, 10);
layer.setOptions({
query: {
select: locationColumn,
from: tableId,
where: 'ST_INTERSECTS(Latitude, ' +
'CIRCLE(LATLNG(53.337638, -6.266971), ' + meters + '))'
}
});
circle.setRadius(meters);
//alert(position);
//circle.setCenter(new google.maps.LatLng(position));
});
I want to change the (53.337638, -6.266971) to be a varible 'position', position has the same value type with (x,y), but it doesn't work with
where: 'ST_INTERSECTS(Latitude, ' +
'CIRCLE(LATLNG('+position+'), ' + meters + '))'
How can I modify the code ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个简短的解决方案是:
一个更长(但语义上更好)的解决方案是定义一个具有两个属性的对象,
然后重载其 toString() 方法。
A short solution is:
A longer (but better semantically) solution would be to define an object with two properties,
then overload its toString() method.
您可以分别指定
position
的两个属性,如下所示:You could specify the two properties of
position
individually, like this: