Git Product home page Git Product logo

maplibre-gl-leaflet's Introduction

MapLibre Organization

https://www.maplibre.org/

This repository contains various documents that define the MapLibre Organization such as the Charter, our Code of Conduct, the list of Voting Members, and more.

You also find here the results of past Governing Board elections.

Formatting

Markdown files in this repo are formatted with markdownlint. If you have formatting problems you can sometimes fix them with:

npx markdownlint-cli *.md --fix

maplibre-gl-leaflet's People

Contributors

codespree avatar dependabot[bot] avatar fnicollet avatar fogfish avatar goapunk avatar jeffschuler avatar jfirebaugh avatar jgravois avatar jingsam avatar kf99916 avatar litomore avatar lseelenbinder avatar lyzidiamond avatar ma7moudat avatar mathieuzimmo avatar mourner avatar nrenner avatar ottylab avatar patrickarlt avatar pratikyadav avatar smeyer-p2er avatar superpat45 avatar theel0ja avatar tmcw avatar tuukka avatar w8r avatar wadclapp avatar waldyrious avatar webberig avatar wipfli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maplibre-gl-leaflet's Issues

null is not an object (evaluating 'this._map.containerPointToLayerPoint')

I'm facing the issue following issue:

null is not an object (evaluating 'this._map.containerPointToLayerPoint')

as seen in the original mapbox-package (https://github.com/mapbox/mapbox-gl-leaflet/blob/master/leaflet-mapbox-gl.js)
on:
https://github.com/mapbox/mapbox-gl-leaflet/blob/df9c10ccf4fe92238f97ea0d64d8366ec709d5d3/leaflet-mapbox-gl.js#L159-L1

the _update method will return, if this._map is not null.

in the current release of

// update the offset so we can correct for it later when we zoom

this part is missing
if (!this._map) { return; }

Put the minified files on a CDN

Currently the README.md points to minified files hosted at the following two locations:

<!-- Maplibre GL -->
<link href="https://media.seventhsense.ai/maplibre-gl-js/v1.14.0/maplibre-gl.css" rel='stylesheet' />
<script src="https://media.seventhsense.ai/maplibre-gl-js/v1.14.0/maplibre-gl.js"></script>

I suggest that we move away from my org CDN to a publicly available CDN like https://cdnjs.com/

This will allow you to keep the files in sync with any updates in this repository.

Zoom Level Different with Leaflet map

Hi I am using this package to get the vector tiles for my leaflet map. But I see the in the pbf files that is being called the zoom level is 1 less than the map actual zoom level. Which is causing issues for me. It should be in sync with mapzoom Right.

Demo is broken

The demo as linked in the readme gives a gray background - maybe an incompatibility with current leaflet?

We want to use this in MapComplete...

image

Blurry tiles

While re-implementing the tile layer with maplibre-gl-leaflet I noticed the quality of the tiles dropped due to blurriness.

I hope the difference is recognisable in the screenshots 😅

With leaflet on its own with raster tiles (or maplibre-gl on its own with vector tiles), the map looks sharp and crisp:
leaflet

But when I try to use maplibre-gl-leaflet, it's not as clean:
maplibre-gl-leaflet

The reason is that tile layer gets a transform css rule with fractions:
maplibre-gl-leaflet-style

So if the style were transform: translate3d(-107px, -50px, 0px) instead, we would not have the problem.

Can we round the translate properties?

Tiles wrongly placed after switching view

Hello there,

I've been trying to use maplibre-gl with react-leaflet to display satellite and roadmap layers from an external provider. I noticed a random behaviour when switching from one to another.

As you can notice from the screenshot below, when switching from satellite to roadmap the map / layers are shifted to the left and not correctly loading. Interacting with the map however will make it work again.

Screenshot 2023-09-05 at 13 35 10 Screenshot 2023-09-05 at 13 37 48

React Leaflet tile layer:

import L from 'leaflet';

import '@maplibre/maplibre-gl-leaflet';

const MapLibreTileLayer = createTileLayerComponent(
    function createTileLayer({ url, attribution, ...options }, context) {
        const instance = L.maplibreGL(
            { style: url, attribution: attribution, noWrap: true },
            withPane(options, context),
        );
        return Object.freeze({ instance, context });
    },
    function updateTileLayer(layer, props, prevProps) {
        updateGridLayer(layer, props, prevProps);

        const { url, attribution } = props;
        if (url != null && url !== prevProps.url) {
            layer.getMaplibreMap().setStyle(url);
        }

        if (attribution != null && attribution !== prevProps.attribution) {
            layer.options.attribution = attribution;
        }
    },
);

export default MapLibreTileLayer;

versions:

@maplibre/maplibre-gl-leaflet": "0.0.19",
react-leaflet: "3.2.5",
maplibre-gl: "3.3.1",
leaflet: "1.9.3",

Migrating from @codespree

Thank you @codespree for migrating mapbox-gl-leaflet to maplibre-gl-leaflet. As you have suggested in maplibre/maplibre-gl-js#123 we can now continue maintaining this project in the maplibre organization on GitHub.

Maybe you can add a link to this repository here at the top of the README in your repo.

Maplibre-gl-leaflet layer is mis-aligned with map when panning the map off screen

If you drag the map out of the window, the maplibre-gl-leaflet layer gets stuck in view while other leaflet layers (like markers) continue to get pulled, causing the two layers not to be aligned correctly.

Replication case

https://jsbin.com/vepuyeqoyo/3/edit?html,output

  1. Open the demo case
  2. Drag the map down
    • Expected: point stays in its place relative the maplibre-gl-leaflet layer (in the ocean above greenland)
    • Actual: when the maplibre-gl-leaflet layer reaches the bottom of the window, as the map continues to be drug down, the point moves relative to the maplibre-gl-leaflet layer, moving all the way off screen.
chrome_t6InO6UcHH.mp4

Arabic rendering of text is broken

Thanks for this great project.

I've just noticed that Arabic words are rendered without ligature (letters not connected) and with the letters in the reverse order.

TouchPitchHandler is not active by default?

Hi,

Sorry, I'm new to maplibre-gl-leaflet and I'm testing it on an Android device. It seems that TouchPitchHandler is not active by default or it is not working.

For instance in the example:
https://raw.githack.com/maplibre/maplibre-gl-leaflet/main/examples/events.html

Is this the expected behaviour with maplibre-gl-leaflet? Using pure maplibre-gl-js I can use the two fingers to tilt and rotate.

Thank you very much!

working with vue 3

Hi,

I'd like to use this leaflet plugin, but I"m having trouble trying to figure out how to set this up in Vue3 components.

I import the Leaflet plugin like this:
import L from "leaflet"

I have added maplibre-gl to the project, but i'm not sure how to import this and the maplibre-gl-leaflet plugin in my component.

I tried the standard approach of adding the cdn package sin the , but that wasn't working for me. Any suggestions here?

L.maplibreGL options is missing `style`

After updating from 0.0.17 to 0.0.18 the example in README won't compile with typescript because style property is missing in the type.

L.maplibreGL({
	style: 'https://api.maptiler.com/maps/topo/style.json?key=<YOUR_MAPTILER_API_KEY>'
})

Cannot add multiple instances of L.MaplibreGL to a leaflet map

This is a minimal example showing the problem and a quick fix.

<!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;
      }

      /* this is the quick fix */
      /*
      .maplibregl-map.leaflet-gl-layer {
        z-index: 2;
        position: absolute;
      }
      */
    </style>

    <!-- Leaflet -->
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
    <script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>

    <!-- Maplibre GL -->
    <script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" integrity="sha256-DZX5P4DwrMTAQcrxknJKB7yvckwa5gw12lN0KL+Qz/Q=" crossorigin="anonymous"></script>
    <link href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" rel="stylesheet" integrity="sha256-Ql8WB81mu27BVBng2iDbDN28cueGCEnDWtZ5U/fKIBA=" crossorigin="anonymous" />
    <script src="https://unpkg.com/@maplibre/[email protected]/leaflet-maplibre-gl.js" integrity="sha256-eUY3Ak8dlanzgNHMl6V+uOFMR6y6PIgdArTaG/dqn2k=" crossorigin="anonymous"></script>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var leafletMap = L.map('map').setView([0,0], 2);

      var gl1 = L.maplibreGL({
        style: {
          "version": 8,
          "name": "blah",
          "sources": {
            "points": {
              "type": "geojson",
              "data": {
              "type": "Feature",
              "geometry": {
                "type": "Polygon",
                "coordinates": [[
                  [10,10],
                  [20,10],
                  [20,20],
                  [10,20]]]
                }
              }
            }
          },
          "layers": [
            {
              "id": "points",
              "source": "points",          
              "type": "fill",
              "paint": {
                "fill-color": "#800",
                "fill-opacity": 0.8
              }
            }
          ]
        }
      }).addTo(leafletMap);
      
      var gl2 = L.maplibreGL({
        style: {
          "version": 8,
          "name": "blah",
          "sources": {
            "points": {
              "type": "geojson",
              "data": {
              "type": "Feature",
              "geometry": {
                "type": "Polygon",
                "coordinates": [[
                  [30,10],
                  [40,10],
                  [40,20],
                  [30,20]]]
                }
              }
            }
          },
          "layers": [
            {
              "id": "points",
              "source": "points",          
              "type": "fill",
              "paint": {
                "fill-color": "#008",
                "fill-opacity": 0.8
              }
            }
          ]
        }
      }).addTo(leafletMap);

      var layerCtrl = new L.Control.Layers({}, {gl1, gl2}, {collapsed: false});
      layerCtrl.addTo(leafletMap);

    </script>
  </body>
</html>

The root of the problem is that the .leaflet-gl-layer container has position: relative; which causes the second layer to be placed just outside of the viewport. It also seems that the zIndex option is not working, which causes problems when combining maplibre-gl layer with other leaflet layers. But I would consider this a separate issue.

support for maplibre-gl 3.x

Hi,
firstly, thanks for maintaining this!

This package currently lists "maplibre-gl": "^2.4.0" as peer dependency. Is there anything stopping it from moving to 3.x ?

Demos not working

support maplibre-gl 4.x

So far everything appears to be working; if there are no known issues, could 4.x be added to the version spec? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.