- Posts: 1
- Thank you received: 0
Dynamically hiding placemarks
- Markantonio
- Topic Author
- Offline
- New Member
Less
More
3 years 4 months ago - 3 years 4 months ago #14400
by Markantonio
Dynamically hiding placemarks was created by Markantonio
Hi, I'm new to the forum.
I'm developing a website for showing the locations of some items on the map using Zh GoogleMap.
I'd like to allow the visitor to dynamically filter the placemarks depending on a few of criteria.
When I say a few, I mean at least two, or more, because it'd be easy to filter them by a single criteria by using groups, but that'd not be enough for my needs.
After analyzing the JS object the component created, zhgmObjMgr (I had already been using zhgmObjMgr.bN[] for adding event listeners to StreetView), I found that I can hide a placemark from the map by either calling
zhgmObjMgr.bN[ID].setVisible(false);
or
zhgmObjMgr.bL[0][ID]setVisible(false);
(with ID being its numeric ID)
I can even hide them all by using either
zhgmObjMgr.bN.forEach((Obj, Id) => { Obj.setVisible(false);});
or
zhgmObjMgr.bL[0].forEach((Obj, Id) => { Obj.setVisible(false);});
The problem is that they get hidden as single elements, from both map and StreetWiew, but the clusters on the former still count them: even hiding every single placemark, nothing changes with the clusters.
What am I missing?
How can I hide them from the clusters as well?
Thank you
I'm developing a website for showing the locations of some items on the map using Zh GoogleMap.
I'd like to allow the visitor to dynamically filter the placemarks depending on a few of criteria.
When I say a few, I mean at least two, or more, because it'd be easy to filter them by a single criteria by using groups, but that'd not be enough for my needs.
After analyzing the JS object the component created, zhgmObjMgr (I had already been using zhgmObjMgr.bN[] for adding event listeners to StreetView), I found that I can hide a placemark from the map by either calling
zhgmObjMgr.bN[ID].setVisible(false);
or
zhgmObjMgr.bL[0][ID]setVisible(false);
(with ID being its numeric ID)
I can even hide them all by using either
zhgmObjMgr.bN.forEach((Obj, Id) => { Obj.setVisible(false);});
or
zhgmObjMgr.bL[0].forEach((Obj, Id) => { Obj.setVisible(false);});
The problem is that they get hidden as single elements, from both map and StreetWiew, but the clusters on the former still count them: even hiding every single placemark, nothing changes with the clusters.
What am I missing?
How can I hide them from the clusters as well?
Thank you
Last edit: 3 years 4 months ago by Markantonio.
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
3 years 4 months ago #14402
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Dynamically hiding placemarks
Hi
If you want to use my extension and your code - to hide placemark from cluster you need to remove it from cluster. To show - add into it.
Ie in this case main code is like
Cluster created, Cluster added to map, Placemarks added to cluster
If you want to use my extension and your code - to hide placemark from cluster you need to remove it from cluster. To show - add into it.
Ie in this case main code is like
Cluster created, Cluster added to map, Placemarks added to cluster
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
Time to create page: 0.164 seconds