Skip to main content

Display overlays

|

Overlays are used to provide enhanced, layered information that adds contextual value to a base map, offering users dynamic, interactive, and customized data that can be visualized on top of other map elements.

Disabling overlays

Overlays can be disabled either by applying a predefined, custom map style created in Magic Lane Map Studio - where certain overlays are already disabled - or by using the disableOverlay method, as shown below:

auto error = OverlayService().disableOverlay(ECommonOverlayId::OID_PublicTransport);

Passing -1 (default value) as the optional categUid parameter indicates that we want to disable the entire public transport overlay, rather than targeting a specific category.

The error returned will be KNoError if the overlay was disabled or error::KNotFound if no overlay (or overlay category) with the specified ID was found in the applied style.

To disable specific overlays within a category, you'll need to retrieve their unique identifiers (uid) as shown below:

auto availableOverlaysResult = OverlayService().getAvailableOverlays(yourProgressListenerImplementation);

// wait until notifyComplete is received in your progress listener implementation

auto collection = availableOverlaysResult.first;
auto overlayInfo = collection.getOverlayAt(0);

if(overlayInfo)
{
auto uid = overlayInfo.getUid();
auto err = OverlayService().enableOverlay( uid );
}

Enabling overlays

In a similar way, the overlay can be enabled using the enableOverlay method by providing the overlay id. It also has an optional categUid parameter, which when left as default, it activates whole overlay rather than a specific category.