Skip to content
Getting started

Getting started

Set up a map

Add a ScreenMapView to a GameObject with a camera. In the inspector, open Tile Source and pick a provider. OpenStreetMap is the default: a fresh scene renders with no key. Use it to try the asset; pick your own provider before you ship (requirements, and the rules below). Add a MapInteractionController to the same object for drag, zoom, rotate and pitch. Press Play.

From code:

using LansMap.Core;
using LansMap.Runtime;
using UnityEngine;

public sealed class Example : MonoBehaviour
{
    public ScreenMapView Map;

    void Start()
    {
        Map.Latitude = 48.8566;
        Map.Longitude = 2.3522;
        Map.Zoom = 14;

        Map.Markers.Store.Add(new LatLon(48.8584, 2.2945), 0, 14f,
            MarkerSizeMode.SceneSize, new Color32(255, 64, 64, 255));
    }
}

Markers are ready in Start - ScreenMapView builds them in Awake. The exception is Map.PlaceLabels, built in Start; touching that from your own Start needs [DefaultExecutionOrder] above 100.

Screen to lat/lon

Same transform the renderer uses, so a converted point lines up with the pixels:

LatLon under = Map.ScreenToLatLon(Input.mousePosition);
Vector2 pixel = Map.LatLonToScreen(48.8584, 2.2945);

Prefab markers

For real GameObject markers (hundreds, not thousands of GPU pins):

WorldMarkerInstance pin = worldMarkerManager.Spawn(prefab, 48.8584, 2.2945, altitudeMeters: 0);

The handle stays on the map as the view moves.

Clustering

Nearby markers collapse into one bubble when zoomed out, then split on the way in. Add MarkerClusterController next to the map:

var cluster = gameObject.AddComponent<MarkerClusterController>();
cluster.Map = Map;
cluster.MaxClusterZoom = 13;
FieldDefaultWhat it does
ClusteringEnabledtrueOn or off, without removing the component.
MaxClusterZoom13At this zoom and closer, markers are individual.
ClusterRadiusPx90How close on screen two markers must be to join.
BubbleColor-Bubble colour.
BubbleBaseSizePx28Size at the smallest count; larger clusters grow from here.
ClickZoomInLevels2Zoom steps when a bubble is clicked.
ClickFitPaddingPx80Padding if a click fits the view to the cluster instead.
ClusterLerpSeconds0.25Time to merge or split.

Pick a tile provider

30 built-in sources, plus Custom for any {z}/{x}/{y} URL:

Map.Provider = TileProvider.Custom;
Map.CustomUrlTemplate = "https://tiles.example.com/{z}/{x}/{y}.png";
Map.CustomAttribution = "(c) Example Tiles";
Map.CustomTileSizePx = 256;

Three rules, enforced in the inspector:

  1. Attribution is required and stays visible. Each provider’s terms are yours to follow.
  2. Put an API key in the template as {key}, never in the URL. An inline key becomes part of the disk-cache name, so rotating it orphans every cached tile.
  3. OpenStreetMap is for trying the asset. For production, pick a provider that fits your use and follow its terms. OSM’s public servers run on donations; the OSM Foundation tile policy forbids heavy use and bulk downloading.

WebGPU in the browser? Requirements. Something missing? Support.