Skip to content

Commit

Permalink
added new layer for clearer region boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
josihoppe authored and henhuy committed Apr 18, 2024
1 parent 6d7d49f commit 139ea6d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def __getitem__(self, item): # noqa: D105, ANN001, ANN204
setup.MVTAPI("potentialarea_pv_roof", "map", "PotentialareaPVRoof"),
],
"static": [
setup.MVTAPI("region_boundaries", "map", "RegionBoundaries"),
setup.MVTAPI("landscape_protection_area", "map", "LandscapeProtectionArea"),
setup.MVTAPI("forest", "map", "Forest"),
setup.MVTAPI("special_protection_area", "map", "SpecialProtectionArea"),
Expand Down Expand Up @@ -359,6 +360,8 @@ def __getitem__(self, item): # noqa: D105, ANN001, ANN204
setup.ClusterAPI("storage", "map", "Storage", properties=["id", "unit_count"]),
]

MAP_ENGINE_LAYERS_AT_STARTUP = [("region_boundaries", "map", "RegionBoundaries")]

MAP_ENGINE_STYLES_FOLDER = "digiplan/static/config/"
MAP_ENGINE_ZOOM_LEVELS = {
"municipality": setup.Zoom(8, 14),
Expand Down
25 changes: 25 additions & 0 deletions digiplan/map/migrations/0045_regionboundaries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.25 on 2024-03-28 10:53

import django.contrib.gis.db.models.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('map', '0044_merge_20240318_1859'),
]

operations = [
migrations.CreateModel(
name='RegionBoundaries',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
],
options={
'verbose_name': 'RegionBoundaries',
'verbose_name_plural': 'RegionBoundaries',
},
),
]
17 changes: 17 additions & 0 deletions digiplan/map/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ def quantity_per_municipality_per_year(cls) -> pd.DataFrame:
return population_per_year


class RegionBoundaries(models.Model):
"""Region Boundaries model."""

geom = models.MultiPolygonField(srid=4326)

objects = models.Manager()
vector_tiles = StaticMVTManager(columns=[])

data_file = "bkg_vg250_region"
layer = "bkg_vg250_region"
mapping = {"geom": "MULTIPOLYGON"}

class Meta: # noqa: D106
verbose_name = _("RegionBoundaries")
verbose_name_plural = _("RegionBoundaries")


class RenewableModel(models.Model):
"""Base class for renewable cluster models."""

Expand Down
7 changes: 7 additions & 0 deletions digiplan/static/config/layer_styles.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
]
}
},
"region_boundaries": {
"type": "line",
"paint": {
"line-color": "rgb(250, 174, 29)",
"line-width": 3
}
},
"wind": {
"type": "symbol",
"filter": ["!", ["has", "point_count"]],
Expand Down
1 change: 1 addition & 0 deletions digiplan/utils/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
REGIONS = [models.Municipality]

MODELS = [
models.RegionBoundaries,
# Clusters
models.WindTurbine,
models.PVroof,
Expand Down

0 comments on commit 139ea6d

Please sign in to comment.