Score:0

Using Geofield, how do I create links that would center the map on required point?

pk flag

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:

  1. 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...
  2. 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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.