Skip to content

Commit

Permalink
Chloropleths of region/constituency/ward and member markers
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Mar 19, 2024
1 parent 306672a commit 97e463e
Show file tree
Hide file tree
Showing 15 changed files with 391 additions and 230 deletions.
4 changes: 2 additions & 2 deletions hub/graphql/types/model_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ def webhook_healthcheck(self: models.ExternalDataSource, info) -> bool:
return self.webhook_healthcheck()

@strawberry_django.field
def geojson_point_features(
def imported_data_geojson_points(
self: models.ExternalDataSource, info: Info
) -> List[PointFeature]:
data = self.get_import_data()
return [
PointFeature.from_geodjango(
point=generic_datum,
point=generic_datum.point,
id=generic_datum.data,
properties=generic_datum.json,
)
Expand Down
2 changes: 1 addition & 1 deletion hub/management/commands/import_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from utils import mapit
import requests


class Command(BaseCommand):
help = "Import historical European regions for high-level aggregation"

Expand Down Expand Up @@ -46,6 +45,7 @@ def handle(self, quiet: bool = False, *args, **options):
geom = GEOSGeometry(json.dumps(area['geometry']))
if isinstance(geom, Polygon):
geom = MultiPolygon([geom])
geom.srid = 27700
a.geometry = geom_str
a.polygon = geom
a.point = a.polygon.centroid
Expand Down
1 change: 1 addition & 0 deletions hub/management/commands/import_wards.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def handle(self, quiet: bool = False, *args, **options):
geom = GEOSGeometry(json.dumps(area['geometry']))
if isinstance(geom, Polygon):
geom = MultiPolygon([geom])
geom.srid = 27700
a.geometry = geom_str
a.polygon = geom
a.point = a.polygon.centroid
Expand Down
8 changes: 4 additions & 4 deletions hub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ class Meta:


class GenericData(CommonData):
point = PointField(blank=True, null=True)
polygon = MultiPolygonField(blank=True, null=True)
point = PointField(srid=4326, blank=True, null=True)
polygon = MultiPolygonField(srid=4326, blank=True, null=True)
postcode_data = JSONField(blank=True, null=True)

def get_postcode_data(self) -> Optional[PostcodesIOResult]:
Expand All @@ -675,8 +675,8 @@ class Area(models.Model):
name = models.CharField(max_length=200)
area_type = models.ForeignKey(AreaType, on_delete=models.CASCADE)
geometry = models.TextField(blank=True, null=True)
polygon = MultiPolygonField(blank=True, null=True)
point = PointField(blank=True, null=True)
polygon = MultiPolygonField(srid=4326, blank=True, null=True)
point = PointField(srid=4326, blank=True, null=True)
overlaps = models.ManyToManyField("self", through="AreaOverlap")

def __str__(self):
Expand Down
21 changes: 21 additions & 0 deletions nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"date-fns": "^3.5.0",
"graphiql": "^3.1.1",
"graphql": "^16.8.1",
"jotai": "^2.7.1",
"lucide-react": "^0.344.0",
"mapbox-gl": "^3.2.0",
"next": "14.1.0",
Expand Down
Binary file added nextjs/public/markers/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions nextjs/public/markers/default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nextjs/public/markers/selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions nextjs/public/markers/selected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions nextjs/src/__generated__/gql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97e463e

Please sign in to comment.