How to display duplicate maker in cluster here map

柔情痞子 提交于 2020-01-06 18:00:38

问题


I am using here map and I use clustering. But I have problem for displaying maker whose cordinates are same /dublicate . When I zoom in clustering , unfortunately the makers are not visible but cluster is still visible. How to display these makers when cluster is zoomed ?

My clustering options is as following

var clusteredDataProvider = new H.clustering.Provider(dataPoints, {
                clusteringOptions : {
                    eps : 16,
                    minWeight : 2
                },
                theme : new PusulaClusterTheme()
            });

回答1:


We had the same issue. If you absolutely need the markers to show the exact very same spot up to the inch so to speak, then I don't know what you could do. But we wanted to show markers for each house on a street and sometimes we had multiple families in a house so we could not get the multiple ones to properly show.

We opened a ticket with HERE and this was their reply:

"...when you are placing multiple markers at the same geo-point, it is just that they are stacked one on top of the other. Since they are all at the same coordinate only the top most one will be displayed. So to enable multiple marker to be shown at the same coordinate, you will need to have some logic to avoid overlapping of markers. There is no method straight off the shelf in JS API that can do this for you, but maybe you can use the method map.getObjectsat(X,Y) to check if there are already any markers at the point. If there is an existing one, then use some logic to slightly change the coordinate value of the new marker to be added at the point.

We ended up copying a solution we found here on Stackoverflow see this link that was written for Google Maps, but is just as relevant here with HERE. It uses a function to randomly change the last digit or 2 of the coordinates if they are multiple, and that way all your multiple coordinates will be a little bit unique and spaced out.



来源:https://stackoverflow.com/questions/44203836/how-to-display-duplicate-maker-in-cluster-here-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!