APIs
Log In
APIs

Filters.getMapboardSpatialFilters

📘

Related REST API method

Take a look at getSpatialFilters.

📘

Static method

Filters.getMapboardSpatialFilters is static.
You can call it without actually instantiating the Filters class.

Filters.getMapboardSpatialFilters(mapboardId:Integer, callback?:Function)

Return the list of spatial filters for a given mapboard.

function onYoumapsApiLoaded(){
  console.log("YoumapsAPI loaded!");
  Filters.getMapboardSpatialFilters(<MAPBOARD_ID>, callback);
}

function callback(spatialFilters){
	console.log(spatialFilters);
}

var mapOptions = {  
  center : new google.maps.LatLng(48.858386, 2.343435), // Paris,
  zoom : 11,
  minZoom : 6,
  maxZoom : 17
};

var mapdataId;
var youmapsApi = new YoumapsAPI(
  {
    techID : <YOUR_TECH_ID>, 
    initMapboards : true,
    mapDivId : "map",
    mapOptions : mapOptions
  },
  onYoumapsApiLoaded
);

The array of spatial filters returned through the callback has the following format :

[
  {
    id : <FILTER_ID>,
    name : "Circle Spatial Filter",
    radius : 67088,
    selectedMapdata : "[<MAPDATA_ID_1>,<MAPDATA_ID_2>]",
    type : "circle",
    vertices : "[{"lat":51.24472459284824,"lng":-2.8487205505371094}]"
  },
  {
    id : <FILTER_ID>,
    name : "Polygon Spatial Filter",
    selectedMapdata : "[<MAPDATA_ID_1>]",
    type : "polygon",
    vertices : "[{"lat":51.83577752045248,"lng":-7.101287841796875}{"lat":52.133488040771475,"lng":10.301055908203125},{"lat":48.28319289548349,"lng":8.850860595703125},{"lat":48.28319289548349,"lng":-6.398162841796875}]"
  }
]