Center map on newest node in Views

Created on 24 August 2024, 8 months ago

Problem/Motivation

I have a fullscreen map which shows all nodes of a certain content type where geofield information gives longitude and latitude - and the center of the map is the newest node.

I'm trying to replicate this with Drupal 10.3.1 and Leaflet 10.2.24. No matter what settings I choose, the map starts off on a - too me - random location (the same location every time, though).

Is there a way I can accomplish this? Am I looking at the wrong places? Or should I abandon Leaflet for some other module solution?

// Adam

💬 Support request
Status

Active

Version

10.2

Component

User interface

Created by

🇸🇪Sweden adamevertsson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @adamevertsson
  • Status changed to Closed: outdated about 1 month ago
  • 🇸🇪Sweden adamevertsson

    Just closing issues is one way to keep the numbers down. Answering them is another. I wish you could have chosen the latter one since I'm still looking for an answer to my question.

  • 🇮🇹Italy itamair

    Let’s try to keep staying respectful and polite here,
    Where we are providing feedback and support mostly for free.
    …
    This issue looked pretty old to me and with no contribution for a long while,
    And I guessed it was already solved.

    Especially as consequence of numerous lates posts that clearly explain how to interact with Drupal Leaflet map, once it is generated.

    For instance this one: https://www.drupal.org/project/leaflet/issues/3047091 📌 Leaflet Map & Markers external interaction, on events - LIVE DEMO Needs review
    that points to the Live Demo,
    and explains how to interact with the Leaflet Map and its features.

    Basically in your case you will need to re center the Leaflet Map against the latest / newest Marker on the map.

    How to pick the newest?
    Well, taking it as the last if properly ordered by the Leaflet View sorting,
    Or adding each date to each feature with the Leaflet Feature hook, ecc.
    Kind of that …

    Hope this helps.
    Happy extending your Leaflet Map!

Production build 0.71.5 2024