A map inlay is a temporary way of applying a custom style for a geometry. The new style will only be applied to the geometry which is indicated by id.

Like many customizations of Micello maps, the map will have to be fully loaded before attempting to assign inlays to geometries. Initialize the map and setup a mapChanged override to detect the map load.

micello.maps.init (apikey, mapInit);
var mapControl;
var mapDataObject;
function  mapInit() {
    mapControl =  new micello.maps.MapControl('mapElement');
    mapDataObject = mapControl.getMapData();
    mapDataObject.mapChanged = onMapChanged;
    mapDataObject.loadCommunity(15);
}
function onMapChanged (e) {
    if (e.comLoad) { // the map has loaded
        add_one_inlay();
    }
}

The map will now execute the function add_one_inlay() when the map is completely loaded.

Adding An Inlay
An inlay is defined as an object and then passed to addInlay() to be added to the map. The properties that make up an inlay are:

"id" - The geometry id of the geometry to receive the inlay.
"t" - The theme style to be applied. These are defined in a theme file.
"anm" - Annotation group name for inlays of the same type.
Only the geometry id and the desired style are required to add the inlay, but it is recommended to assign an anm (annotation group name) so inlays can be removed by group.

function add_one_inlay () {
     var inlay = {"id": 3217183, "t": "Search Result", "anm":"my_inlays"};
     mapDataObject.addInlay(inlay);
     aid = inlay.aid; // keep track of the unique annotation id for this inlay
}

The theme style 'Search Result' is used here because it's predefined and easy to spot on a map.

Removing An Inlay
When an inlay is added to the map, it is assigned a unique .aid property. This value can later be used to remove the inlay.

Removing the inlay from the last example can be done in a single line of code:

mapDataObject.removeInlay(aid); // remove inlay by aid

If removing inlays by .anm an additional argument 'true' must be passed to indicate removal by group name.

mapDataObject.removeInlay("my_inlays", true); // remove inlay by anm

Try removing and replacing the inlay to see the effect on the map.