#Draw a Point on Map
To draw a point on the map:
// use maplibre addSource and addLayer function
const sourceId = 'myPoint';
const layerId = sourceId + 'Layer';
const coordinates = [114.16158, 22.30498];
// init maplibre-gl map
const maplibreMap = new maplibregl.Map({
container: 'map'
});
function addSource() {
maplibreMap.addSource(sourceId, {
type: 'geojson',
data: {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: coordinates
}
}
});
}
function addLayer() {
maplibreMap.addLayer({
id: layerId,
type: 'circle',
source: sourceId,
paint: {
'circle-radius': 5,
'circle-color': '#007cbf'
}
});
}Sample web page:

