-
Hi everyone, I am recently using MapLibre for my personal projects and I would like to have my marker with a popup open, however it doesn't allow me to do it. var map = new maplibregl.Map({
container: 'map',
style:
'https://api.maptiler.com/maps/outdoor/style.json?key=KEY',
center: [-71.04286,-13.85728],
zoom: 10
}).addControl(new maplibregl.NavigationControl(), 'top-right');
// New Popup
var popup = new maplibregl.Popup({offset: 25,closeOnClick: false})
.setHTML('<b> Hi everyone! My name is Antony :3 and I am a Geographer in internet </b>');
// create DOM element for the marker
var el = document.createElement('div');
el.id = 'marker';
var maker = new maplibregl.Marker(el)
.setLngLat([-71.04286,-13.85728])
.setPopup(popup)
.addTo(map); |
Beta Was this translation helpful? Give feedback.
Answered by
ambarja
Sep 22, 2022
Replies: 2 comments 2 replies
-
Take a look at the examples docs, here's a similar one: |
Beta Was this translation helpful? Give feedback.
2 replies
-
Thanks, but the answer was the following: // Basic basemap
var map = new maplibregl.Map({
container: 'map',
style:
'https://api.maptiler.com/maps/outdoor/style.json?key=hdV4nOYKQa4di4tH4qr2 ',
center: [-71.04286,-13.85728],
zoom: 10
}).addControl(new maplibregl.NavigationControl(), 'top-right');
// New Popup
var popup = new maplibregl.Popup({offset: 25,closeOnClick: false})
.setHTML('<b> Hi everyone! My name is Antony :3 and I am a Geographer in internet </b>')
.setLngLat([-71.04286,-13.85728])
.addTo(map);
// create DOM element for the marker
var el = document.createElement('div');
el.id = 'marker';
var maker = new maplibregl.Marker(el)
.setLngLat([-71.04286,-13.85728])
.setPopup(new maplibregl.Popup({offset: 25}).setHTML('<b> Hi everyone! My name is Antony :3 and I am a Geographer in internet </b>'))
.addTo(map); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ambarja
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, but the answer was the following: