Commit c4dd935e authored by Elger Jonker's avatar Elger Jonker

[wip] Make the map snappier, more intuitive and cleaning/unifying the map code.


Former-commit-id: 537da674
parent 357f3293
This diff is collapsed.
......@@ -1537,6 +1537,10 @@ function views(autoload_default_map_data=true) {
selected_organization: -1,
features: null,
// keep track if we need to show everything, or can stay zoomed in:
previously_loaded_country: null,
previously_loaded_layer: null,
displayed_issue: ""
},
computed: {
......@@ -1630,7 +1634,15 @@ function views(autoload_default_map_data=true) {
console.log(url);
fetch(url).then(response => response.json()).then(data => {
this.loading = true;
failmap.plotdata(data);
// Don't need to zoom out when the filters change, only when the layer/country changes.
let fitBounds = false;
if (this.previously_loaded_country !== this.country || this.previously_loaded_layer !== this.layer)
fitBounds = true;
failmap.plotdata(data, fitBounds);
this.previously_loaded_country = this.country;
this.previously_loaded_layer = this.layer;
// make map features (organization data) available to other vues
// do not update this attribute if an empty list is returned as currently
......
......@@ -1457,14 +1457,17 @@ def map_potential(request, country: str = "NL", organization_type: str = "munici
"high_urls": 0,
"medium_urls": 0,
"low_urls": 0,
"origin": "add_bare_url_features"
"origin": "add_bare_url_features",
},
"geometry":
{
# the coordinate ID makes it easy to check if the geometry has changed shape/location.
"coordinate_id": coordinate.id,
"type": coordinate.geojsontype,
# Sometimes the data is a string, sometimes it's a list. The admin
# interface might influence this.
"coordinates": coordinate.area
"coordinates": coordinate.area,
}
}
......@@ -1566,7 +1569,8 @@ def get_map_data(country: str = "NL", organization_type: str = "municipality", d
map_organizationrating.total_urls,
map_organizationrating.high_urls,
map_organizationrating.medium_urls,
map_organizationrating.low_urls
map_organizationrating.low_urls,
coordinate_stack.stacked_coordinate_id
FROM map_organizationrating
INNER JOIN
(SELECT id as stacked_organization_id
......@@ -1683,6 +1687,9 @@ def get_map_data(country: str = "NL", organization_type: str = "municipality", d
},
"geometry":
{
# the coordinate ID makes it easy to check if the geometry has changed shape/location.
"coordinate_id": i[15],
"type": i[4],
# Sometimes the data is a string, sometimes it's a list. The admin
# interface might influence this.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment