function getAjaxDataZlotSA(mymap, surl, img_path, show_spot_count=true) {
mymap.eachLayer(function (layer) {
if(!layer.hasOwnProperty('_url')) mymap.removeLayer(layer);
});
var cSE = [[19.36066,52.20256],[23.37204,52.20256],[23.67004,52.00856],[23.64258,51.92564],[23.61237,51.82729],[23.62610,51.77719],[23.53821,51.72533],[23.55881,51.65807],[23.56842,51.56170],[23.62747,51.49164],[23.67691,51.46513],[23.68927,51.41976],[23.68652,51.36749],[23.63983,51.31345],[23.69888,51.28082],[23.74557,51.22065],[23.78403,51.19053],[23.86780,51.14920],[23.87466,51.07247],[23.93097,51.00857],[24.14383,50.86404],[24.05182,50.82936],[23.95981,50.79552],[24.02847,50.75818],[24.06281,50.71559],[24.06143,50.67209],[24.09714,50.63030],[24.07104,50.45750],[23.76343,50.33845],[22.66479,49.48954],[22.90649,49.00184],[21.93970,49.28931],[21.39038,49.37522],[20.99487,49.27497],[20.64331,49.36807],[20.40161,49.36807],[20.18188,49.27497],[20.10498,49.14578],[19.80835,49.15297],[19.37851,49.42527],[19.36066,49.41455],[19.36066,52.20256]];
var cNE = [[19.36066,52.20256],[23.37204,52.20256],[23.23471,52.21602],[23.20175,52.26816],[23.17841,52.28160],[23.47641,52.54880],[23.72910,52.60138],[23.93646,52.70801],[23.92685,52.89482],[23.92685,53.02222],[23.89801,53.11958],[23.87604,53.18629],[23.79089,53.28328],[23.63434,53.57702],[23.57391,53.74709],[23.51898,53.95285],[23.48053,53.99647],[23.52173,54.08034],[23.48740,54.14394],[23.46268,54.16806],[23.42697,54.17208],[23.34183,54.24838],[23.23471,54.25319],[23.15643,54.30370],[23.04657,54.31172],[22.99713,54.35896],[22.99026,54.38775],[22.84882,54.40215],[22.77740,54.35816],[22.51511,54.34135],[22.32285,54.33975],[21.88751,54.33334],[21.56616,54.31652],[21.21735,54.33174],[20.85617,54.35255],[20.56366,54.37336],[20.29999,54.39895],[20.08163,54.41813],[19.84406,54.43171],[19.64218,54.45008],[19.36066,54.36376],[19.36066,52.17393]];
var cSW = [[19.36066,52.20256],[19.36066,49.42527],[19.08325,49.37880],[18.85254,49.49667],[18.62732,49.69961],[18.58337,49.91586],[18.28674,49.90171],[18.02856,50.05008],[17.91321,49.94415],[17.62207,50.11353],[17.72644,50.24369],[17.69348,50.31039],[17.50671,50.25072],[17.31995,50.29285],[16.87500,50.41902],[17.02332,50.20152],[16.72668,50.08887],[16.52893,50.22612],[16.34766,50.35247],[16.20483,50.41202],[16.46851,50.57975],[16.17737,50.64598],[16.00159,50.60416],[15.82031,50.73298],[15.47974,50.76773],[15.34790,50.83023],[15.11719,50.97572],[15.00732,50.97918],[15.00732,50.85104],[14.83154,50.84757],[15.06775,51.24472],[14.89746,51.47112],[14.69971,51.53267],[14.58984,51.79503],[14.72168,52.06938],[14.68323,52.20256],[19.36066,52.20256]];
var cNW = [[14.71069,52.20256],[19.36066,52.20256],[19.36066,54.36456],[18.95416,54.33414],[18.71521,54.37576],[18.55316,54.42532],[18.55042,54.51470],[18.45978,54.69130],[18.39386,54.72779],[18.41034,54.78010],[18.80035,54.60071],[18.77014,54.65318],[18.49548,54.75950],[18.35266,54.82126],[18.21259,54.82126],[17.95166,54.82284],[17.55066,54.75475],[17.21832,54.70876],[17.03979,54.65795],[16.87500,54.57684],[16.63605,54.55295],[16.48499,54.50673],[16.35040,54.39975],[16.04553,54.24597],[15.72693,54.21225],[15.52368,54.16887],[15.32867,54.13991],[14.87000,54.03681],[14.54590,53.96740],[14.35364,53.89787],[14.23004,53.92052],[14.28497,53.65766],[14.40582,53.36203],[14.45526,53.24878],[14.34814,53.05772],[14.14215,52.95360],[14.17511,52.87410],[14.11743,52.82434],[14.58435,52.60472],[14.60632,52.45768],[14.55139,52.34037],[14.71069,52.23453]];
var plSE = {"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"SE","density":94.65},"geometry":{"type":"Polygon","coordinates":[cSE]}}]};
var plNE = {"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"SE","density":94.65},"geometry":{"type":"Polygon","coordinates":[cNE]}}]};
var plSW = {"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"SE","density":94.65},"geometry":{"type":"Polygon","coordinates":[cSW]}}]};
var plNW = {"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"SE","density":94.65},"geometry":{"type":"Polygon","coordinates":[cNW]}}]};
var zloty_markers = new Array();
var LeafEndIcon = L.Icon.extend({
options: {iconSize:[24, 32],iconAnchor:[2, 28],popupAnchor:[15, -13]
}
});
var imgenIcon = new LeafEndIcon({iconUrl: img_path + "marker-end.png"});
var miejscaZlotow = null;
ileSpotkanRegion = function(region) {
var licz = 0;
for (const [key, value] of Object.entries(this.miejscaZlotow)) {
if(region == this.miejscaZlotow[key].gdzie) {
licz +=this.miejscaZlotow[key].spots.length;
}
}
return licz;
}
var self = this;
$.ajax({
type: "POST",
url: surl,
data: {"typ":{}},
cache: false,
dataType: "json",
success: function(data) {
if(data.error==false || data.error==0) {
zloty_markers = new Array();
self.miejscaZlotow = data.zloty;
if(show_spot_count) {
L.geoJson(plSE).bindTooltip("SE, Spotkań : " + self.ileSpotkanRegion('SE'), {
permanent: true,
direction: 'center'
}).addTo(mymap);
L.geoJson(plNE).bindTooltip("NE, Spotkań : " + self.ileSpotkanRegion('NE'), {
permanent: true,
direction: 'center'
}).addTo(mymap);
L.geoJson(plSW).bindTooltip("SW, Spotkań : " + self.ileSpotkanRegion('SW'), {
permanent: true,
direction: 'center'
}).addTo(mymap);
L.geoJson(plNW).bindTooltip("NW, Spotkań : " + self.ileSpotkanRegion('NW'), {
permanent: true,
direction: 'center'
}).addTo(mymap);
} else {
L.geoJson(plSE).addTo(mymap);
L.geoJson(plNE).addTo(mymap);
L.geoJson(plSW).addTo(mymap);
L.geoJson(plNW).addTo(mymap);
}
for (const [key, value] of Object.entries(self.miejscaZlotow)) {
var s = self.miejscaZlotow[key].gdzie + '-' + self.miejscaZlotow[key].coord[0] + ',' + self.miejscaZlotow[key].coord[1];
if(self.miejscaZlotow[key].hasOwnProperty('img')) {
s+='';
}
s+='