This appears to me as a rather basic requirement, but surprisingly enough, I can find no information on how this can be done.
You know how when you search something on Google maps, apart from just a map with points on it, you are also given a list of those points on the left side, and you can choose any of the names, click on it, and the map will get centered on this point?
So I have a few hundreds of nodes, all displayed on a Geofield Map. There are several exposed filters at work. And I need the ability to display a list of titles for every point currently on screen, so the user would be able to quickly choose the point they need by a title.
Out of the box, I did not find anything of the sort. A closer inspection of how the Geofield Map (and any other map, as far as I'm aware of) works shows two obstacles:
- Map points don't seem to have any unique ID when rendered. I've had hopes for
aria-describedby
, but it's the same for all points on the map.
But OK, let's assume I can modify the Geofield Map's template to include node ID to the rendered map and then use this ID to simulate click on the point in question; and that's where the second problem comes in...
- When points are clustered, they are rendered as a single entity. And there is no way, at least to my knowledge, to de-cluster those groups so JS could find the required point and center the screen on it.
Maybe there's something I don't see? Has anyone dealt with a task like this?