For AI agents: the complete documentation index is available at /core-sdk/map/web/llms.txt, the full documentation bundle is available at /core-sdk/map/web/llms-full.txt, and this page is available as Markdown at /core-sdk/map/web/v10/10-markers-annotations/01-create-marker.md.
MapxusDeveloper Platform
Products
Positioning APIAccess real-time indoor coordinates and contextual signals.API
UI SDKProduction-ready indoor map interfaces and UI components.AndroidiOS

Create Marker

To create marker[s] on map:

// init maplibre-gl map
const maplibreMap = new maplibregl.Map({
  container: "map",
});
// create marker
const marker = new MapxusMap.Marker(maplibreMap);
marker.create([
  {
    lngLat: [114.1109316, 22.3709052],
    properties: { buildingId: "tsuenwanplaza_hk_369d01", ordinal: "0" },
  },
  {
    lngLat: [114.1113619, 22.3706961],
    properties: { buildingId: "tsuenwanplaza_hk_369d01", ordinal: "0" },
  },
]);

Set markers' opacity by building(or venue, Refer API) and ordinal:

map.onMapChangeListener(({ building, floor }) => {
  marker.setOpacityByBuilding(building?.properties?.id, floor.ordinal, 0.5);
});

To add a marker event listener:

// marker on click event
marker.on("click", (marker) => {
  // do something
});

Sample web page: