getPlacenames = function(scale) {
let where;
let wales = "NUTS1_CODE='UKL'";
if (scale < 270) {
where = wales + "AND POPL_2011>100000";
} else if (scale > 270 && scale < 1000) {
where = wales + "AND POPL_2011>50000";
} else if (scale > 1000) {
where = wales + "AND POPL_2011>10000";
} else if (scale > 1400) {
where = wales + "AND POPL_2011>1000";
}
let envelope = getCurrentViewExtent();
let baseURL =
"https://ec.europa.eu/regio/regiogis/gis/arcgis/rest/services/Urban/urban_centres_towns/MapServer/0/query?";
let URL =
baseURL +
"where=" +
where +
"&f=json&outFields=city_town_name,POPL_2011&resultRecordCount=200";
let uri = encodeURI(URL);
d3.json(uri).then(res => {
if (res.features.length > 0) {
addPlacenamesToScene(res.features);
}
});
}