在一个融合层中可以有多少不同的标记有限制吗
Is there a limit to how many different markers you can have in a fusion layer?
我有一个带有融合表层的实现,在那里我尝试使用带有字母A-Z的预定义标记图标来显示地图上搜索查询的结果(很像原始的谷歌地图)。
我实现这一点的方法是首先创建一个层,为所有标记提供一个通用图标。。
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Geometry',
from: 0000000
},
map: map,
options: {
suppressInfoWindows: true
},
styles: [{
markerOptions: {
iconName: "measle_white"
}
}]
});
同时,我在同一张表中查询了25个结果,其中ST_DISTANCE排序基于我的地图的中心位置(地理位置),
var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=',
queryUrlTail = '&jsonCallback=success',
query = 'SELECT+ID+FROM+0000000+ORDER+BY+ST_DISTANCE(Geometry,LATLNG('+position.coords.latitude+','+position.coords.longitude+'))+LIMIT+25';
var queryurl = queryUrlHead + query + queryUrlTail;
返回的JSON对象是一个唯一ID的数组,我称之为"ids"。然后,我使用一些触发器(zoomchanged)用字母图标重新绘制25个最近的图标(受此影响)。
google.maps.event.addListener(map, 'zoom_changed', function () {
layer.setOptions({
styles: [{
markerOptions: {
iconName: "measle_white"
}
}, //fallback
{
where: "'ID' = " + ids.table.rows[0][0],
markerOptions: {
iconName: "a_blue"
}
}, {
where: "'ID' = " + ids.table.rows[1][0],
markerOptions: {
iconName: "b_blue"
}
}, {
where: "'ID' = " + ids.table.rows[2][0],
markerOptions: {
iconName: "c_blue"
}
}, {
where: "'ID' = " + ids.table.rows[3][0],
markerOptions: {
iconName: "d_blue"
}
}, {
where: "'ID' = " + ids.table.rows[4][0],
markerOptions: {
iconName: "e_blue"
}
}, {
where: "'ID' = " + ids.table.rows[5][0],
markerOptions: {
iconName: "f_blue"
}
}, {
where: "'ID' = " + ids.table.rows[6][0],
markerOptions: {
iconName: "g_blue"
}
}, {
where: "'ID' = " + ids.table.rows[7][0],
markerOptions: {
iconName: "h_blue"
}
}, {
where: "'ID' = " + ids.table.rows[8][0],
markerOptions: {
iconName: "i_blue"
}
}, {
where: "'ID' = " + ids.table.rows[9][0],
markerOptions: {
iconName: "j_blue"
}
}, {
where: "'ID' = " + ids.table.rows[10][0],
markerOptions: {
iconName: "k_blue"
}
}, {
where: "'ID' = " + ids.table.rows[11][0],
markerOptions: {
iconName: "l_blue"
}
}, {
where: "'ID' = " + ids.table.rows[12][0],
markerOptions: {
iconName: "m_blue"
}
}, {
where: "'ID' = " + ids.table.rows[13][0],
markerOptions: {
iconName: "n_blue"
}
}, {
where: "'ID' = " + ids.table.rows[14][0],
markerOptions: {
iconName: "o_blue"
}
}, {
where: "'ID' = " + ids.table.rows[15][0],
markerOptions: {
iconName: "p_blue"
}
}, {
where: "'ID' = " + ids.table.rows[16][0],
markerOptions: {
iconName: "q_blue"
}
}, {
where: "'ID' = " + ids.table.rows[17][0],
markerOptions: {
iconName: "r_blue"
}
}, {
where: "'ID' = " + ids.table.rows[18][0],
markerOptions: {
iconName: "s_blue"
}
}, {
where: "'ID' = " + ids.table.rows[19][0],
markerOptions: {
iconName: "t_blue"
}
}, {
where: "'ID' = " + ids.table.rows[20][0],
markerOptions: {
iconName: "u_blue"
}
}, {
where: "'ID' = " + ids.table.rows[21][0],
markerOptions: {
iconName: "v_blue"
}
}, {
where: "'ID' = " + ids.table.rows[22][0],
markerOptions: {
iconName: "w_blue"
}
}, {
where: "'ID' = " + ids.table.rows[23][0],
markerOptions: {
iconName: "x_blue"
}
}, {
where: "'ID' = " + ids.table.rows[24][0],
markerOptions: {
iconName: "z_blue"
}
}
]
});
现在,除了前5个结果A-D(后退图标为+1)之外,这实际上非常有效。这里出了什么问题?我是达到了某个限制(markerOptions只接受5个值??)还是把代码搞砸了?
旁注:这个例子似乎每层有5个以上的图标,但谷歌做到了,我一个都不懂。
很抱歉,通过Maps API只能设置5种样式。开发者指南中提到了这个限制。我怀疑显示所有可能图标的地图不是FT层。如果通过FT UI完成,你可以有更多的风格,但这不是动态的,可能不适合你的情况。
相关文章:
- setTimeout有限制吗
- document.getElementById(“”).value是否有限制
- 在Javascript中,大浮点数的小数位数有限制吗
- 根据类型通过 HTML ID 标记进行 JS 搜索是否有限制
- 将JavaScript值传递给PHP变量(有限制)
- Jquery:一个jquery对象(方法链)上可以调用的函数数量是否有限制
- chrome.hid.send的ArrayBuffer大小是否有限制
- 在jQuery中使用replaceWIth的数据大小是否有限制
- 在一个融合层中可以有多少不同的标记有限制吗
- 在一个JavaScript函数中可以对DOM进行的更改数量有限制吗
- 在Javascript中使用JSP标记有限制吗
- 元素的背景图像的修改频率是否有限制
- 在Javascript中,行的大小有限制吗
- crossfilter.js&dc.js:要使用的维度和事实的数量有限制吗
- 在Netsuite API中调用nlapiSearchGlobal(keywords)方法是否有限制?
- 添加多个有限制的数组
- http协议对正文大小有限制吗?
- 关于AJAX XMLHttpRequest post函数的数据大小是否有限制?
- 在javascript中通过class属性应用样式时是否有限制?
- 对表单字段使用jquery serialize()函数有限制吗?