Add drustack/Leaflet.SyncView Support

Created on 15 December 2021, about 3 years ago
Updated 4 September 2024, 4 months ago

Problem/Motivation

Refer to https://www.drupal.org/project/leaflet/issues/3236815 suggestion, in order to make use of GeoField proximity filtering and ordering, a meaningful "Origin Coordinates" for end-user is important, e.g.:

  • A manual default origin coordinate
  • Center of map after end-user moving the map by mouse click-and-move
  • The client location through the browser HTML5 Geolocation API (e.g. by GPS, IP, etc)

This PR integrate https://github.com/drustack/Leaflet.SyncView, add support for Leaflet with sync map center to text input support, useful for:

  • Set the GeoField proximity exposed filter as "Manual Origin"
  • Enable "Sync View" support in Leaflet display setting
  • Configure the "latitudeSelector", "latitudeSelector" and "zoomSelector" (optional) to above GeoField proximity exposed filter text input

Now when end-user move the map, the map center value will automatically feed into the exposed filter input, and next search will now based on the updated position.

Feature request
Status

Needs review

Version

10.2

Component

Code

Created by

🇭🇰Hong Kong hswong3i

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Closed: outdated almost 2 years ago
  • Status changed to Needs review 5 months ago
  • 🇭🇰Hong Kong hswong3i

    Recreate MR via 10.2.x-dev

  • Pipeline finished with Success
    5 months ago
    Total: 241s
    #232142
  • Pipeline finished with Success
    5 months ago
    Total: 233s
    #232171
  • Pipeline finished with Success
    5 months ago
    Total: 230s
    #232175
  • Pipeline finished with Success
    5 months ago
    Total: 248s
    #232183
  • Pipeline finished with Success
    5 months ago
    Total: 240s
    #232193
  • 🇮🇹Italy itamair

    Thanks @hswong3 for providing an updated MR that applies to the 10.2.x Leaflet branch,
    and indeed this integration with your drustack/Leaflet.SyncView library looks somehow valuable,
    BUT I still feel the following:

    - the integration Leaflet.SyncView setting might need a better and richer description/instruction to more properly guide any user in its proper functionalities and potential use case;
    - the drustack/Leaflet.SyncView still looks very poorly adopted, as Leaflet View control, and not really persuaded it really deserves an official integration in the Drupal Leaflet module itself ...

    Let's if any other use subscribes to this Feature Request and how many others would need this integration more officially embedded and integrated in the Drupal Leaflet module.

    If not, in few weeks, I will close this and leave here for its eventual usage in the form of patch.

  • 🇭🇰Hong Kong hswong3i

    @itamair I am now using https://github.com/drustack/Leaflet.ResetView/ and https://github.com/drustack/Leaflet.SyncView for https://www.wastereduction.gov.hk/en-hk/recycling-map since 3 years agos:

    You could test the drustack/Leaflet.SyncView functionality by:

    • Move the map by mouse
    • The X/Y is now sync to the hidden form value for search
    • Click the "Search this Area"
    • Now the search result will be directly related to recent updated X/Y
  • 🇮🇹Italy itamair

    Thanks a lot! @hswong3i ... finally I get the nice value of your work and inputs.
    Indeed this looks a very useful add-on and setup to search by a specific area and mostly to limit the number of loaded market on the map.
    I am going to definitely better inspect this solution of you, and eventually embed in the leaflet module, with proper documentation.
    ASAP ...

  • 🇩🇰Denmark ressa Copenhagen

    It looks interesting, thanks for working on it @hswong3i! Perhaps you can make a GIF or a movie, to highlight and clarify which features are added?

  • 🇮🇹Italy itamair

    @hswong3i I better reviewed this feature Request of you and QAed also the MR !40.
    and then I also included some enhancements that reflect a new Fork and consequent the following PR#1 to the drustack/Leaflet.SyncView repo itself:

    https://github.com/drustack/Leaflet.SyncView/pull/1

    That have the following tech specification:

    Refinement in the L.Control.SyncView.js:_pullView function #1
    This PR implements the following:

    parsing of Lat and Lon to 6 digit float;
    trigger dynamic sync / update of the proximity-origin-summary Lat and Lon elements (eventually present in case check/selection of "Show (anyway) the Origin coordinates as summary in the Exposed Form" option
    This implementation syncs with latest improvements implemented in Geofield version 8.x-1.61 ., greatly aimed to enhance dynamic sync between Origin coordinates input and Origin coordinates summary elements.

    It would be great if you could merge that PR1 into master and deploy a new 1.9.3 release of drustack/Leaflet.SyncView.

    We then should just update this Version number in the MR !40:
    https://git.drupalcode.org/issue/leaflet-3254562/-/blob/3254562-add-drus...

  • 🇭🇰Hong Kong hswong3i

    @itamair some feedback:

    parsing of Lat and Lon to 6 digit float

    This is somehow a nice idea (but seems not important?), if we have limitation in backend database schema from Drupal Leaflet module point of view.

    trigger dynamic sync / update of the proximity-origin-summary Lat and Lon elements (eventually present in case check/selection of "Show (anyway) the Origin coordinates as summary in the Exposed Form" option

    This doesn't looks like a good idea for me, since the Leaflet.SyncView itself is design for generic Leaflet use case (but not Drupal specific integration only).

    Hard-coded with .geofield-lat-summary may generate upgrade difficulties if Geofield update it's own implementation.

    IMHO, keep Leaflet.SyncView as isolated and independent with it downstream integration could provide much better flexibility.

    Finally, I had create https://www.npmjs.com/package/@drustack/leaflet.syncview/v/1.9.3 which partly integrate the "parsing of Lat and Lon to 6 digit float" implementation, please kindly comment ;-)

Production build 0.71.5 2024