Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MapComponent] Multi-layer support #2449

Open
giosal opened this issue Dec 13, 2024 · 3 comments
Open

[MapComponent] Multi-layer support #2449

giosal opened this issue Dec 13, 2024 · 3 comments
Labels
RFC Status: Waiting Feedback Needs feedback from the author

Comments

@giosal
Copy link

giosal commented Dec 13, 2024

Hello,

I've recently checked out the Symfony UX Map Component as I wanted to migrate the page with Leaflet JavaScript to Symfony UX Map, however I found that for now you don't support neither multiple tile layers (with an option to switch between them), nor multiple data layers (with an option to display one or multiple layers at the same time).

I'm talking about something like this:
image

I wanted to know if this feature is coming. If so, do you have an estimate? If not, do you have any guidelines on how I might be able to migrate this Leaflet functionality to Symfony UX?

@giosal giosal added the RFC label Dec 13, 2024
@Kocal
Copy link
Member

Kocal commented Dec 13, 2024

Hi @giosal, do you have some documentation about this feature?

@Kocal Kocal added the Status: Waiting Feedback Needs feedback from the author label Dec 14, 2024
@smnandre
Copy link
Member

You have access to the map instance with the various js event provided, you can use them if you want!

@giosal
Copy link
Author

giosal commented Jan 6, 2025

Hi @giosal, do you have some documentation about this feature?

Here's the link to the documentation of Leaflet.js
And here's an example code:

var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 19,
    attribution: '© [OpenStreetMap](http://www.openstreetmap.org/copyright)'
});
var osmHOT = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    maxZoom: 19,
    attribution: '© [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors, Tiles style by [Humanitarian OpenStreetMap Team](https://www.hotosm.org/) hosted by [OpenStreetMap France](https://openstreetmap.fr/)'});
var map = L.map('map', {
    center: [39.73, -104.99],
    zoom: 10,
    layers: [osm, cities]
});

So, this way you can have multiple layers for the tiles that the user can select as in the original screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Status: Waiting Feedback Needs feedback from the author
Projects
None yet
Development

No branches or pull requests

3 participants