Maps SDK for Web
Class L.MarkersLayer Deprecated
Deprecation Warning
Please use the TomTomMarkersLayer class instead.
The MarkersLayer allows you to display search service results on a map. It is based on Leaflet's marker cluster plugin.
The default plugin functionality is enhanced for handling TomTom services responses and L.SearchBox widget events.
Constructor
L.MarkersLayer([options]) Deprecated
Please use the
TomTomMarkersLayer class instead.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | No | Object | None |
Example
tomtom.key("<your-tomtom-API-key>");
tomtom.searchKey("<your-tomtom-search-key>");
var map = tomtom.map("map");
var searchBoxInstance = (new L.SearchBox()).addTo(map);
var markersLayer = (new L.MarkersLayer()).addTo(map);
searchBoxInstance.on(L.SearchBox.Events.ResultsFound, function (results) {
markersLayer.clearLayers();
markersLayer.add(results);
});
Methods
add(points, [options]): L.MarkersLayer Chainable
Method used to add new markers based on the TomTom search service response.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
points | The response from search service or event from searchBox widget. | Yes | Object | None |
options | The options to be used when creating a marker. | No | Object | None |
options.eachIcon | The function called to create each icon. It has one argument which is the point - object containing text, position, type, poiCategories (deprecated, use poiClassifications) if the type is poi, and poiClassifications if the type is poi | No | Function | None |
Returns