}
}
- function displayFeatureWarning(count, limit, add, cancel) {
+ function displayFeatureWarning(num_features, add, cancel) {
$("#browse_status").html(
$("<div class='p-3'>").append(
$("<div class='d-flex'>").append(
.attr("aria-label", I18n.t("javascripts.close"))
.click(cancel))),
$("<p class='alert alert-warning'>")
- .text(I18n.t("browse.start_rjs.feature_warning", { num_features: count, max_features: limit })),
+ .text(I18n.t("browse.start_rjs.feature_warning", { num_features })),
$("<input type='submit' class='btn btn-primary d-block mx-auto'>")
.val(I18n.t("browse.start_rjs.load_data"))
.click(add)));
/*
* Modern browsers are quite happy showing far more than 100 features in
- * the data browser, so increase the limit to 4000 by default, but keep
- * it restricted to 500 for IE8 and 100 for older IEs.
+ * the data browser, so increase the limit to 4000 by default.
*/
- var maxFeatures = 4000;
-
- /*@cc_on
- if (navigator.appVersion < 8) {
- maxFeatures = 100;
- } else if (navigator.appVersion < 9) {
- maxFeatures = 500;
- }
- @*/
+ const maxFeatures = 4000;
if (dataLoader) dataLoader.abort();
dataLoader = $.ajax({
url: url,
- success: function (xml) {
+ dataType: "json",
+ success: function (data) {
dataLayer.clearLayers();
- var features = dataLayer.buildFeatures(xml);
+ var features = dataLayer.buildFeatures(data);
function addFeatures() {
$("#browse_status").empty();
if (features.length < maxFeatures) {
addFeatures();
} else {
- displayFeatureWarning(features.length, maxFeatures, addFeatures, cancelAddFeatures);
+ displayFeatureWarning(features.length, addFeatures, cancelAddFeatures);
}
if (map._objectLayer) {
},
updateLayers: function (layerParam) {
- var layers = layerParam || "M",
- layersAdded = "";
+ var layers = layerParam || "M";
for (let i = this.baseLayers.length - 1; i >= 0; i--) {
if (layers.indexOf(this.baseLayers[i].options.code) === -1) {
}
for (let i = this.baseLayers.length - 1; i >= 0; i--) {
- if (layers.indexOf(this.baseLayers[i].options.code) >= 0) {
- this.addLayer(this.baseLayers[i]);
- layersAdded = layersAdded + this.baseLayers[i].options.code;
- } else if (i === 0 && layersAdded === "") {
+ if (layers.indexOf(this.baseLayers[i].options.code) >= 0 || i === 0) {
this.addLayer(this.baseLayers[i]);
+ return;
}
}
},
var map = this;
this._objectLoader = $.ajax({
url: OSM.apiUrl(object),
- dataType: "xml",
- success: function (xml) {
+ dataType: "json",
+ success: function (data) {
map._object = object;
map._objectLayer = new L.OSM.DataLayer(null, {
}
};
- map._objectLayer.addData(xml);
+ map._objectLayer.addData(data);
map._objectLayer.addTo(map);
if (callback) callback(map._objectLayer.getBounds());