[Test] 5.1.0 excepciones proxy
by Francisco
HTML
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea5/assets/css/mapea-5.1.0.ol.min.css">
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/mapea-5.1.0.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/configuration-5.1.0.js"></script>
<div id="map"></div>
CSS
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
JavaScript
M.addProxyException("https://geostematicos-sigc.juntadeandalucia.es");
const mapa = M.map({
container: 'map',
controls: ['layerswitcher'],
layers: ['OSM',"WFST*Campamentos*http://geostematicos-sigc.juntadeandalucia.es/geoserver/sepim/ows?*sepim:campamentos*MPOINT"]
});
//M.proxy(true);
/*M.addProxyException("https://www.twitter.com");
console.log("================");
console.log("Llamando a Google. Deberá llamarla correctamente dado que proxy");
M.remote.get("https://www.google.es/", {}).then((res) => {
console.log(res);
console.log("================");
console.log("================");
console.log("Llamando a Twitter. Deberá fallar por CORS dado que se saltará el proxy");
console.log("================");
M.remote.get("https://www.twitter.com/", {}).then((res) => {
console.log(res);
});
});*/
mapa.addLayers(new M.layer.GeoJSON({name: "Provincias", url: "https://geostematicos-sigc.juntadeandalucia.es/geoserver/tematicos/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tematicos:Provincias&maxFeatures=50&outputFormat=application/json"}));