Mapbox GL w / geojson - 单个位置的多个图标

时间:2018-03-21 14:44:27

标签: geojson mapbox-gl-js

我正在整个城市创建一个可公开访问的水域的网络应用程序。这将包括饮水机,水瓶加油站,游泳池等(我们称这些'访问类型')。

我已经在数据库中完成了所有工作,使用PHP生成GeoJSON,它可以正常工作(意思是,我可以调用它并通过Mapbox GL显示信息)。

我仍然坚持如何处理显示/过滤图层/标记/图标。我已经关注了Mapbox的商店定位器'和'过滤'教程,我已经在基础层面上工作了,但这些都似乎在假设每个位置可以/应该只有一个访问类型的情况下运行,并显示每个地址的倍数当有多个(堆叠图标并显示重复地址的巨大列表)时。

我是否应该使用我的数据库查询进行分组,创建包含不同访问类型的子数组(对象)(在下面称为' icon'),或者单独提取所有内容(见下文),然后排序它w / javascript / jquery?

{"type":"FeatureCollection",
"features":[{
"id":19,"type":"Feature","geometry":{
"type":"Point","coordinates":[-83.053604,42.307877]},
"properties":{"name":"Adie Knox Herman Arena","address":"1551 Wyandotte St W, Windsor, ON N9B 1H6","icon":"Water Fountain"}},{"id":19,"type":"Feature","geometry":{
"type":"Point","coordinates":[-83.053604,42.307877]},
"properties":{"name":"Adie Knox Herman Arena","address":"1551 Wyandotte St W, Windsor, ON N9B 1H6","icon":"Water Bottle Filling Station"}},{"id":65,"type":"Feature","geometry":{
"type":"Point","coordinates":[-82.976415,42.314787]},
"properties":{"name":"Atlas Tube Centre","address":"447 Renaud Line Road, Maidstone, ON N0R 1K0","icon":"Water Fountain"}},{"id":9,"type":"Feature","geometry":{
"type":"Point","coordinates":[-82.757893,42.283526]},
"properties":{"name":"Atlas Tube Centre","address":"447 Renaud Line Road, Maidstone, ON N0R 1K0","icon":"Water Bottle Filling Station"}}]}

非常感谢任何帮助!

0 个答案:

没有答案