APIs
Log In
APIs

YoumapsAPI.getFilter

YoumapsAPI.getFilter(filterId:Integer)

Gets the given filter and returns its properties in JSON format.

📘

Prerequisite

You must have loaded all filters through the YoumapsAPI.initMapboardSpatialFilters & YoumapsAPI.initMapboardAttributeFilters methods to use this method.

function onYoumapsApiLoaded(){
  console.log("YoumapsAPI loaded!");
  youmapsApi.initMapboardSpatialFilters(<MAPBOARD_ID>, function(){
  	youmapsApi.initMapboardAttributeFilters(<MAPBOARD_ID>, function(){
    	var filter = youmapsApi.getFilter(<FILTER_ID>);
    });
  }); 
}

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

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

The filter returned by this method has the following format :

//CIRCLE SPATIAL FILTER
{
  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}]"
}

//POLYGON SPATIAL FILTER
{
  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}]"
}

//ATTRIBUTE FILTER
{
  conditions : "[{"attribute":"axa_eq_zon","condition":"equal to","value":"2","operator":""}]",
  id : <FILTER_ID>,
  mapboardId : <MAPBOARD_ID>,
  mapdataId : <MAPDATA_ID>,
  name : "Attribute Filter name"
}