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

Use with MapLibre doesn't work :( #66

Open
caronte3d opened this issue Nov 29, 2024 · 2 comments
Open

Use with MapLibre doesn't work :( #66

caronte3d opened this issue Nov 29, 2024 · 2 comments

Comments

@caronte3d
Copy link

caronte3d commented Nov 29, 2024

I need to use MapLibre maps to store tiles legally for offline use. Everything works fine without the leaflet rotation feature.
Any ideas to make it compatible?

This code works until you uncomment the leaflet-rotate script:

<!DOCTYPE html>
<html>
<head>
    <title>WebGL</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
      html, body, #map {
        width: 100%;
        height: 100%;
        margin: 0;
      }
    </style>

    <!-- Leaflet -->
    <link rel="stylesheet" href="./resources/leaflet/dist/leaflet.css" />
    <script src="./resources/leaflet/dist/leaflet.js"></script>

    <!--
	<script src="./resources/leaflet-rotate/dist/leaflet-rotate.js"></script>
	-->
	
    <!-- Maplibre GL -->
    <link href="./resources/maplibre-gl.css" rel='stylesheet' />
    <script src="./resources/maplibre-gl.js"></script>

    <!-- Leaflet Maplibre GL plugin -->
    <script src="./resources/leaflet-maplibre-gl.js"></script>
</head>

<body>
<div id="map"></div>

<script>
var map = L.map('map').setView([38.912753, -77.032194], 15);

L.marker([38.912753, -77.032194])
    .bindPopup("Hello <b>Leaflet GL</b>!<br>Whoa, it works!")
    .addTo(map)
    .openPopup();

var gl = L.maplibreGL({
    // Cambia el estilo según tus necesidades
    style: './resources/liberty.json',
}).addTo(map);
</script>
</body>
</html>
@Raruto
Copy link
Owner

Raruto commented Dec 3, 2024

Hi @caronte3d,

It really depends on how other libraries work internally.

BTW, usually in here, you have to make sure your layer is added to one of the rotated "panes" (ref: #2).

👋 Raruto

PS: If you could also attach a jsfiddle that would be easier to debug.. 😉

@caronte3d
Copy link
Author

Hi @Raruto,
The attached code above is a simple snippet you can save to an html file (notice local scripts).
As you can see, the only fact of uncomment the leaflet-rotate.js breaks everything and nothing works.
Really would be vey nice if you can make it compatible with maplibre, because actually it's THE ONLY tiles provider that allow to use and download maptiles for free (even for comercial use).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants