Skip to content

Commit

Permalink
rm unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lastminutediorama committed Aug 19, 2024
1 parent dca5603 commit 5c13e64
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 29 deletions.
16 changes: 0 additions & 16 deletions src/planscape/planning/geometry.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import json
import logging
from django.conf import settings
from shapely import wkt
from shapely.ops import unary_union
from shapely.geometry import shape
from typing import Any, Dict, Union
from django.contrib.gis.geos import MultiPolygon, GEOSGeometry

Expand Down Expand Up @@ -56,19 +53,6 @@ def from_geojson(geometry: Union[Dict[str, Any] | GEOSGeometry]) -> GEOSGeometry
]


def get_acreage(geometry: GEOSGeometry):
epsg_5070_area = geometry.transform(settings.AREA_SRID, clone=True).area
acres = epsg_5070_area / settings.CONVERSION_SQM_ACRES
return acres


def is_inside(larger_geometry, smaller_geometry) -> bool:
larger_geom = geojson_to_geosgeometry(larger_geometry)
smaller_geom = geojson_to_geosgeometry(smaller_geometry)

return larger_geom.contains(smaller_geom)


def coerce_geometry(geometry: Union[Dict[str, Any] | GEOSGeometry]) -> GEOSGeometry:
"""This function takes in a GeoJSON
geometry and tries to coerce it to
Expand Down
2 changes: 1 addition & 1 deletion src/planscape/planning/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.conf import settings
from django.contrib.gis.geos import GEOSGeometry
from collaboration.services import get_role, get_permissions
from planning.geometry import coerce_geometry, get_acreage
from planning.geometry import coerce_geometry

from planning.models import (
PlanningArea,
Expand Down
2 changes: 1 addition & 1 deletion src/planscape/planning/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from fiona.crs import from_epsg
from rest_framework.serializers import ValidationError
from collaboration.permissions import PlanningAreaPermission, ScenarioPermission
from planning.geometry import coerce_geojson, coerce_geometry, get_acreage
from planning.geometry import coerce_geojson
from planning.models import (
PlanningArea,
PlanningAreaType,
Expand Down
7 changes: 0 additions & 7 deletions src/planscape/planning/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ def _load_geojson_fixture(filename):
return json.load(file)


def _load_wkt_fixture(filename):
current_dir = os.path.dirname(os.path.abspath(__file__))
fixture_path = os.path.join(current_dir, "../fixtures", filename)
with open(fixture_path, "r") as file:
return file.read()


def _create_test_user_set():
owner_user = User.objects.create(
username="area_owner",
Expand Down
1 change: 0 additions & 1 deletion src/planscape/planning/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from django.test import TestCase, TransactionTestCase
import fiona
from fiona.crs import to_string
from planning.geometry import is_inside
from planning.services import (
export_to_shapefile,
get_max_treatable_area,
Expand Down
1 change: 0 additions & 1 deletion src/planscape/planning/tests/test_v2_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
_create_scenario,
reset_permissions,
_load_geojson_fixture,
_load_wkt_fixture,
)
from planscape.tests.factories import UserFactory

Expand Down
1 change: 0 additions & 1 deletion src/planscape/planning/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
ScenarioPermission,
PlanningAreaNotePermission,
)
from planning.geometry import get_acreage
from planning.models import (
PlanningArea,
PlanningAreaNote,
Expand Down
1 change: 0 additions & 1 deletion src/planscape/planning/views_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
PlanningAreaOrderingFilter,
ScenarioOrderingFilter,
)
from planning.geometry import is_inside
from planning.models import PlanningArea, ProjectArea, Scenario, User
from planning.permissions import PlanningAreaViewPermission, ScenarioViewPermission
from planning.serializers import (
Expand Down

0 comments on commit 5c13e64

Please sign in to comment.