Add markers to a non-georeferenced image

The MapTiler’s SDK ImageViewerMarker allows you to add markers to your non-georeferenced images while interacting with them similarly to how you would navigate a regular map.

Image: 1932 Japanese pictorial world map game board - World Adventure

NPM module setup


npm install --save @maptiler/sdk
import { config, ImageViewer, ImageViewerMarker } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const imageViewer = new ImageViewer({
  container: 'map',
  imageUUID: 'YOUR_MAPTILER_TILESET_ID_HERE',
});

imageViewer.on('imageviewerready', () => {
  const marker = new ImageViewerMarker({})
  .setPosition([1000, 2000])
  .addTo(imageViewer);

  const marker1 = new ImageViewerMarker({
  color: "#FF0000",
  draggable: true
  }).setPosition([2496, 1135])
  .addTo(imageViewer);

  marker1.on("dragend", (evt) => {
    console.log(evt);
  })
});

Learn more

Visit the ImageViewer API reference for full details on supported options, methods, etc.

Check out the ImageViewerMarker API reference for information about available options, functions, and more.

Display a tiled, non-georeferenced image

Display a non-georeferenced image

Examples

Display a zoomable non-georeferenced, geographically "inaccurate" maps in your application using the ImageViewer.

Display simple marker on the map

Display marker

Tutorials

Learn how to add a default marker to your map.

Add custom icons with markers

Add custom icons with markers

Examples

Add custom marker icons to your map.

Was this helpful?