// Caso de pruebas
let mapajs = M.map({
'container': 'map',
"controls": ["layerswitcher"],
"layer": ["OSM"]
});
let layer = new M.layer.WFS({
name: "Municipios",
url: "https://clientes.guadaltel.es/desarrollo/geossigc/wfs?",
namespace: "mapea",
name: "da_municipio_pol",
legend: "Municipios - CATEGORÍAS",
geometry: 'POLYGON',
});;
mapajs.addLayers(layer);
mapajs.addPlugin(new M.plugin.AttributeTable());
/**
* attribute: Parametro por el cual se calcula la proporcion en los features
* maxRadius: Parametro que define el radio maximo de la proporcion
* minRadius: Parametro que define el radio minimo de la proporcion
*/
let options = {
attribute: "gid",
maxRadius: 25,
minRadius: 8
};
/**
* Funcion que calcula el maximo y el minimo valor del atributo
* por el cual se calcula la proporcion de los features de la cama
*/
const getMaxMinValues = function(features, attribute) {
let [minValue, maxValue] = [undefined, undefined];
let filteredFeatures = features.filter(feature =>
!isNaN(feature.getAttribute(attribute))).map(f => parseInt(f.getAttribute(attribute)));
let index = 1;
if (!M.utils.isNullOrEmpty(filteredFeatures)) {
minValue = filteredFeatures[0];
maxValue = filteredFeatures[0];
while (index < filteredFeatures.length - 1) {
let posteriorValue = filteredFeatures[index + 1];
minValue = (minValue < posteriorValue) ? minValue : posteriorValue;
maxValue = (maxValue < posteriorValue) ? posteriorValue : maxValue;
index++;
}
}
return [minValue, maxValue];
}
/**
* Funcion que en base al valor maximo, al valor minimo, al radio maximo,
* al radio minimo y al valor del atributo del feature devuelve el radio
* que le corresponde al realizar una representación proporcional
*/
const proportionalFunction = function(feature, options) {
let value = parseFloat(feature.getAttribute(options.attribute));
return calcProportion(value, options.minValue, options.maxValue, options.minRadius,...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.