[Test] Filtros lista externa

by Francisco

HTML

<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.1.0.ol.min.js"></script>
<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.1.0.ol.min.css">
<script src="https://mapea4-sigc.juntadeandalucia.es/js/configuration-5.1.0.js"></script>
<div id="map"></div>

CSS

html,
body,
#map {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}

JavaScript

var mapajs = M.map({
  container: "map",
  wmcfiles: ["mapa"],
  controls: ["mouse"]
});


let feature1 = new M.Feature("feature1", {
  "properties": {
    "name": "feature1"
  },
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [293297, 4190525]
  }
});

let feature2 = new M.Feature("feature2", {
  "properties": {
    "name": "feature2"
  },
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [299183, 4173358]
  }
});

let feature3 = new M.Feature("feature3", {
  "properties": {
    "name": "feature3"
  },
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [357548, 4201805]
  }
});

let feature4 = new M.Feature("feature4", {
  "properties": {
    "name": "feature4"
  },
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [436513, 4138535]
  }
});


let misFeatures = [feature1, feature2, feature3, feature4];

  // filtro contains:
  let filterContain = M.filter.spatial.CONTAIN({
    'type': 'Polygon',
    'coordinates': [
      [
        [251853, 4200334],
        [326894, 4200334],
        [326894, 4129217],
        [251853, 4129217],
        [251853, 4200334]
      ]
    ]
  });

let featureFiltrados = filterContain.execute(misFeatures);

console.log('Features contenidos: ');
featureFiltrados.forEach(f => {
	console.log(f.getId())
})




//});