Multimap API V1.2 JavaScript Example
The Multimap Open API now allows you to filter markers icons on a map depending on the markers' attributes.
In this example, the markers are filtered by their number attribute, using the ge and le operators.
The full list of operators by which it is possible to filter is shown in the table below.
| Operator | Description |
|---|---|
eq |
Is equal to |
ne |
Is not equal to |
lt |
Is less than |
gt |
Is greater than |
not |
Is not |
le |
Is less than or equal to |
ge |
Is greater than or equal to |
in |
Is in the set or range |
null |
Is NULL |
notnull |
Is not NULL |
contains |
Contains |
startswith |
Starts with |
endswith |
Ends with |
like |
Is like |
It is also possible to filter markers by specifying a minimum and maximum zoom factor for each of them, by setting attributes with the names mm:min_zoom and mm:max_zoom.
You can now combine marker 'decluttering' and filtering; please see the separate topic on Decluttering Markers.
MultimapViewer: setMarkerFilters()
If you view this in your browser you should see a Multimap draggable map centered on Saint James Avenue, Boston, Massachusetts, USA, at zoom factor 15.
This example overlays 25 markers on the map. For each marker, coordinates are assigned at random and a numeric value between 0 and 10 is assigned to the marker's number attribute.
You can use the Min: and Max: boxes to filter out the markers you wish to exclude from the map, then click on the Filter button to hide every markers whose number attribute lies outside the selected range.
|
|
Min: Max: |
There are three parts to the code below. The first is the line that links to the Multimap Open API. The second is an example of the HTML you must have in your page. The third is an example of the JavaScript required to implement the page.
<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA08061815803962482"></script>
Sorry, JavaScript required...
Sorry, JavaScript required...
Sorry, JavaScript required...
For more information on the subject of Multimap Open API JavaScript code, please read the Open API documentation at: http://www.multimap.com/share/documentation/api/1.2/classes/.
If you require further help with your Multimap Open API implementation, please visit the Multimap Developer Forums.
For Open API news, announcements and other information, please see our blog.
For enquiries about further Multimap services, please contact the Multimap Sales team:
For general account enquiries or further services, please contact the Multimap Sales team:
| London, Great Britain | +44 (0)20 7632 7800 |
| email: | sales@multimap.com |