使用 Fusion Table Layer 平移和缩放以显示查询结果
我是 Fusion Table Layer 的初学者。我想在此处显示查询结果(平移和缩放): https://developers .google.com/fusiontables/docs/samples/search_and_zoom ,但我无法使用 AND 子句为我的函数执行此操作:
function changeMap() {
var dzialka = document.getElementById('dzialka').value;
var symbol = document.getElementById('symbol').value;
var where = '';
if (dzialka) {
dzialka = dzialka.replace(/'/g, '\\\'');
where = "'NUMER' CONTAINS IGNORING CASE '" +
dzialka + "'";
}
if (symbol) {
if (dzialka) {
where += ' AND ';
}
where += "SYMBOL_OG = '" + symbol + "'";
}
layer.setOptions({
query: {
select: locationColumn,
from: tableid,
where: where
}
});
}
有人可以帮助我吗?我将感谢您的帮助。
特雷博尔
I am beginner in Fusion Table Layer. I would like to display the query results as here (pan and zoom): https://developers.google.com/fusiontables/docs/samples/search_and_zoom ,but I can't do this for my function with AND clause:
function changeMap() {
var dzialka = document.getElementById('dzialka').value;
var symbol = document.getElementById('symbol').value;
var where = '';
if (dzialka) {
dzialka = dzialka.replace(/'/g, '\\\'');
where = "'NUMER' CONTAINS IGNORING CASE '" +
dzialka + "'";
}
if (symbol) {
if (dzialka) {
where += ' AND ';
}
where += "SYMBOL_OG = '" + symbol + "'";
}
layer.setOptions({
query: {
select: locationColumn,
from: tableid,
where: where
}
});
}
Can someone help me? I will be grateful for your help.
Trebor
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
做自己想做的事情肯定是有可能的,但并不是那么容易。在示例中,平移到的位置是由 Google 地理编码 API 使用地址计算得出的。但您的 JavaScript 代码中并没有真正拥有地址(即
locationColumn
的内容)。这取决于您在locationColumn
中存储什么类型的信息,我想它是某种可以进行地理编码的地址。因此,您必须将 select 语句直接发送到 Fusion Tables。 Google Fusion Tables 有一个 JSONP 接口,您可以将其用于此目的。
在此示例中,我使用 jQuery 作为
$.post
函数。It is definitely possible to do what you want to do, but it's not that easy. In the example the location to pan to is calculated by the Google Geocoding API using an address. But you don't really have the address (i.e. content of
locationColumn
) in your JavaScript code. It depends what kind of information you store in thelocationColumn
, I suppose it's some kind of address that can be geocoded.Therefore you have to send a select statement directly to Fusion Tables. Google Fusion Tables has a JSONP interface that you can use for this purpose.
In this example I use jQuery for the
$.post
function.