Place a 2D View on the Map

Place a 2D View on the screen, using the projected position of a Positioner. This works in both Unity and ECEF coordinate systems.

To run this example, open the Wrld/Demo/Examples.unity scene, click the Play button, and select Place a 2D View on the Map from the dropdown.

using System.Collections;
using UnityEngine;
using Wrld;
using Wrld.Space;
using Wrld.Space.Positioners;

public class Position2DViewOnMap: MonoBehaviour
    static LatLong targetPosition = LatLong.FromDegrees(37.802355, -122.405848);
    Positioner viewPositioner;
    public UnityEngine.RectTransform target2DView;

    private void OnEnable()
        var positionerOptions = new PositionerOptions()

        viewPositioner = Api.Instance.PositionerApi.CreatePositioner(positionerOptions);
        viewPositioner.OnScreenPointChanged += OnPositionerPositionChanged;

    private void OnPositionerPositionChanged()
        var screenPoint =;
        if (viewPositioner.TryGetScreenPoint(out screenPoint))
            target2DView.position = new Vector3(screenPoint.x, screenPoint.y);

    public void OnCollapseButtonClicked()

    public void OnDisable()
        viewPositioner.OnScreenPointChanged -= OnPositionerPositionChanged;