APIs
Log In
APIs

Filters.getFilteredGeometriesByPolygon

📘

Related REST API method

Take a look at getFilteredGeometriesByPolygon.

📘

Static method

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

Filters.getFilteredGeometriesByPolygon(mapdataLayer : TileLayer | MarkerLayer, vertices:String, geomIdsToSkip:array, callback?:Function)

Returns a map containing an array of geometry ids filtered by the given polygon.

function onYoumapsApiLoaded(){
  console.log("YoumapsAPI loaded!");
  var mapdataLayer = youmapsApi.getMapdata(<MAPDATA_ID>);
  mapdataId = mapdataLayer.id;
  var polygon = [];
  polygon.push({"lat" : 48.858842286992044, "lng" : 0.3076171875});
  polygon.push({"lat" : 48.68506755483561, "lng" : 4.658203125});
  polygon.push({"lat" : 45.36131273322709, "lng" : 4.658203125});
  polygon.push({"lat" : 44.55280277876862, "lng" : 0.791015625});
  polygon.push({"lat" : 47.3625483380577, "lng" : -0.263671875});
  polygon.push({"lat" : 48.858842286992044, "lng" : 0.3076171875});
  polygon.push({"lat" : 48.858842286992044, "lng" : 0.3076171875});
  var polygonString = JSON.stringify(polygon);
  Filters.getFilteredGeometriesByPolygon(mapdataLayer, polygonString, null, callback);
}

function callback(responseMap){
  var geometryIds = responseMap.filteredGeometries;
	youmapsApi.applyFilter(mapdataId, geometryIds);
}

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
);