0

I add maplibregl in my react js project but https://api.maptiler.com/tiles/v3/2/0/2.pbf?key=my-key does not load.

map = new maplibregl.Map({
            container: 'map',
            style: 'https://api.maptiler.com/maps/basic/style.json?key=my-key', // stylesheet location
            
            center: [-122.4849334359169, 37.829298101706186], // starting position [lng, lat]
            zoom: 13, // starting zoom
            renderWorldCopies: true,
            bounds:[listShips[0].geometry.coordinates,listShips[1].geometry.coordinates],
            fitBoundsOptions: {padding: 300}
        });
Samira
  • 2,361
  • 1
  • 12
  • 21

1 Answers1

0

I have found the answer: you should change the version to

   "maplibre-gl": "^1.15.2",

on your package.json. Then don't forget to npm i .

Samira
  • 2,361
  • 1
  • 12
  • 21