From f7897ec6f3e963875270625c2092f9894db40b77 Mon Sep 17 00:00:00 2001 From: Anton Bakker Date: Thu, 30 Nov 2023 13:49:18 +0100 Subject: [PATCH] rename app/repo to coordinate-transformation-api --- .vscode/launch.json | 2 +- EXAMPLE_REQUESTS.md | 260 ------------------ README.md | 10 +- pyproject.toml | 18 +- .../__init__.py | 0 .../assets/__init__.py | 0 .../assets/logging.conf | 0 .../assets/openapi.yaml | 4 +- .../assets/static/__init__.py | 0 .../assets/static/favicon.ico | Bin .../cityjson/__init__.py | 0 .../cityjson/models.py | 2 +- .../constants.py | 0 .../crs_transform.py | 14 +- .../fastapi_rfc7807/README.md | 0 .../fastapi_rfc7807/__init__.py | 0 .../fastapi_rfc7807/middleware.py | 2 +- .../fastapi_rfc7807/schema.py | 0 .../limit_middleware/__init__.py | 0 .../limit_middleware/middleware.py | 0 .../main.py | 16 +- .../models.py | 0 .../settings.py | 0 .../types.py | 0 .../util.py | 18 +- tests/test_cityjson_transformation.py | 2 +- tests/test_geojson_bbox.py | 2 +- tests/test_geojson_transformation.py | 2 +- 28 files changed, 46 insertions(+), 306 deletions(-) delete mode 100644 EXAMPLE_REQUESTS.md rename src/{coordinates_transformation_api => coordinate_transformation_api}/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/assets/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/assets/logging.conf (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/assets/openapi.yaml (99%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/assets/static/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/assets/static/favicon.ico (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/cityjson/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/cityjson/models.py (99%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/constants.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/crs_transform.py (95%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/fastapi_rfc7807/README.md (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/fastapi_rfc7807/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/fastapi_rfc7807/middleware.py (99%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/fastapi_rfc7807/schema.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/limit_middleware/__init__.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/limit_middleware/middleware.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/main.py (97%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/models.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/settings.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/types.py (100%) rename src/{coordinates_transformation_api => coordinate_transformation_api}/util.py (95%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7ed15d7..5e167f8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "args": [ "--reload", "--port", "8000", - "coordinates_transformation_api.main:app", + "coordinate_transformation_api.main:app", ], "env": { "LOG_LEVEL": "DEBUG", diff --git a/EXAMPLE_REQUESTS.md b/EXAMPLE_REQUESTS.md deleted file mode 100644 index 478f6e7..0000000 --- a/EXAMPLE_REQUESTS.md +++ /dev/null @@ -1,260 +0,0 @@ -## Example operations - -> **TODO:** Clean up example operations/API calls and add documentation - -```bash -# Landingpage -curl "https://api.nsgi.nl/coordinatestransformation/v2/" -# Conformance -curl "https://api.nsgi.nl/coordinatestransformation/v2/conformance" -# OAS 3.0 Spec -curl "https://api.nsgi.nl/coordinatestransformation/v2/openapi" -``` - -```bash -# Transformation with GET operation -# Inputs through query parameters will return a GeoJSON respons -curl "https://api.nsgi.nl/coordinatestransformation/v2/transform?f=json&source-csr=EPSG:7415&target-crs=EPSG:7931&coordinates=194174.00,465887.33,42.1" -``` - -```bash -# Transformation with POST operation -# Input as POST body will return the same (if supported) object type. -# In this case GeoJSON as input will return GeoJSON as output -curl --request POST 'https://api.nsgi.nl/coordinatestransformation/v2/transform?f=json&source-csr=EPSG:7415&target-crs=EPSG:7931' ---header 'Content-Type: application/geo+json' ---data-raw '{ - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [194174.00, 465887.33] - }, - "properties": { - "name": "de Brug" - } -}' -``` - -```bash -# Transformatie with POST operation -# In this case CityJSON as input will return CityJSON as output -curl --request POST 'http://localhost:8000/transform?source-crs=EPSG:7415&target-crs=EPSG:7931' \ ---header 'Content-Type: application/city+json' \ ---data-raw '{ - "type": "CityJSON", - "version": "1.3", - "transform": { - "scale": [1.0, 1.0, 1.0], - "translate": [0.0, 0.0, 0.0] - }, - "CityObjects": {}, - "vertices": [] -}' -``` - -```bash -# The source-crs is optional with POST operations, but if not present then it should be defined in the object. -curl --request POST 'http://api.nsgi.nl/coordinatestransformation/v2?f=json&target-crs=EPSG:7931' ---header 'Content-Type: application/city+json' ---data-raw '{ - "type": "CityJSON", - "version": "1.1", - "transform": { - "scale": [1.0, 1.0, 1.0], - "translate": [0.0, 0.0, 0.0] - }, - "metadata": { - "referenceSystem": "https://www.opengis.net/def/crs/EPSG/0/7415" - }, - "CityObjects": {}, - "vertices": [] -}' -``` - ---- - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG:28992&target-crs=EPSG:4326' -H 'Content-Type: application/json' -d @feature-geometry-collection.json -``` - - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG%3A28992&target-crs=EPSG%3A28992' \ - -H 'Content-Type: application/json' \ - -d '{"type":"Feature","crs":"foo","properties": {},"geometry":{"type":"Point","coordinates":[633092.3577539952,6849959.336556375]}}' | jq -``` - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG%3A3857&target-crs=EPSG%3A28992' \ - -H 'Content-Type: application/json' \ - -d '{"type":"Feature","properties": {},"geometry":{"type":"Point","coordinates":[633092.3577539952,6849959.336556375]},"crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG::3857"}}}' | jq -``` - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG%3A28992&target-crs=EPSG%3A4326' \ - -H 'Content-Type: application/json' \ - -d '{"type":"Feature","properties": {},"geometry":{"type":"MultiPoint","coordinates":[[160000,455000],[160100,455000]] -}}' | jq -``` - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG%3A28992&target-crs=EPSG%3A4326' \ - -H 'Content-Type: application/json' \ - -d '{"type":"Feature","properties": {},"geometry":{"type":"MultiLineString","coordinates":[[[170000,455000],[170100,455000]],[[160000,455000],[160100,455000]]] -}}' | jq -``` - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=EPSG%3A4326&target-crs=EPSG%3A3857' \ - -H 'Content-Type: application/json' \ - -d '{ "type": "Feature", "properties": { "name": "Parc de la Colline" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -72.357206347890767, 47.72858763003908 ], [ -71.86027854004486, 47.527648291638172 ], [ -72.37075892446839, 47.539848426151735 ], [ -72.357206347890767, 47.72858763003908 ] ] ], [ [ [ -72.357206347890767, 47.72858763003908 ], [ -71.86027854004486, 47.527648291638172 ], [ -72.37075892446839, 47.539848426151735 ], [ -72.357206347890767, 47.72858763003908 ] ] ]] } }' | jq -``` - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=OGC:CRS84&target-crs=EPSG:4326' \ - -H 'Content-Type: application/json' \ - -d @example/polygon.json -``` - - -```sh -curl -X 'POST' 'http://localhost:8000/transform?target-crs=EPSG:4326' \ - -H 'Content-Type: application/json' \ - -d @tests/data/geometry.json -``` - - - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=OGC:CRS84&target-crs=EPSG:28992' \ - -H 'Content-Type: application/json' \ - -d '{ - "type": "FeatureCollection", - "features": [{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "GeometryCollection", - "geometries": [ - { - "type": "Point", - "coordinates": [ - 61.34765625, - 48.63290858589535 - ] - }, - { - "type": "Polygon", - "coordinates": [ - [ - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ] - ] - ] - } - ] - } - }] -}' | jq -``` - - - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=OGC:CRS84&target-crs=EPSG:28992' \ - -H 'Content-Type: application/json' \ - -d '{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "GeometryCollection", - "geometries": [ - { - "type": "Point", - "coordinates": [ - 61.34765625, - 48.63290858589535 - ] - }, - { - "type": "Polygon", - "coordinates": [ - [ - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ] - ] - ] - } - ] - } - }' | jq -``` - - -```sh -curl -X 'POST' 'http://localhost:8000/transform?source-crs=OGC:CRS84&target-crs=EPSG:28992' \ - -H 'Content-Type: application/json' \ - -d '{ - "type": "GeometryCollection", - "geometries": [ - { - "type": "Point", - "coordinates": [ - 61.34765625, - 48.63290858589535 - ] - }, - { - "type": "Polygon", - "coordinates": [ - [ - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ], - [ - 59.94140624999999, - 50.65294336725709 - ] - ] - ] - } - ] - }' | jq - ``` diff --git a/README.md b/README.md index 11a1d9c..cd13624 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Coordinates transformation API +# Coordinate Transformation API -RESTful coordinates transformation API offering NSGI approved transformations +RESTful Coordinate Transformation API offering NSGI approved transformations for the Netherlands. Build on top of pyproj and FastAPI. ## Assumptions @@ -79,7 +79,7 @@ mypy --install-types Check test coverage (install `coverage` with `pip install coverage`): ```sh -coverage run --source=src/coordinates_transformation_api -m pytest -v tests && coverage report -m +coverage run --source=src/coordinate_transformation_api -m pytest -v tests && coverage report -m ``` ## Install @@ -99,13 +99,13 @@ ct-api ### Build container ```bash -docker build -t nsgi/coordinatestransformation-api . +docker build -t nsgi/coordinate-transformation-api . ``` ### Run container ```bash -docker run --rm -d -p 8000:8000 --name ct-api nsgi/coordinatestransformation-api +docker run --rm -d -p 8000:8000 --name ct-api nsgi/coordinate-transformation-api ``` ## CityJSON diff --git a/pyproject.toml b/pyproject.toml index a9cb97a..645dcca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] -name = "coordinates-transformation-api" -description = "Coordinates transformation API of the Nederlandse Samenwerking Geodetische Infrastructuur (NSGI)" +name = "coordinate-transformation-api" +description = "Coordinate Transformation API of the Nederlandse Samenwerking Geodetische Infrastructuur (NSGI)" keywords = ["NSGI", "pyproj", "fastapi", "coordinates", "geo"] license = { text = "MIT" } classifiers = [ @@ -17,7 +17,7 @@ dependencies = [ "pyproj == 3.6.0", "pydantic-settings == 2.0.2", "email-validator == 2.0.0", - "geodense ~= 0.0.1a4", + "geodense ~= 0.0.1a5", ] requires-python = ">=3.11.4" dynamic = ["version"] @@ -37,7 +37,7 @@ requires = ["setuptools>=61.0", "setuptools-git-versioning<2"] build-backend = "setuptools.build_meta" [project.scripts] -ct-api = "coordinates_transformation_api.main:main" +ct-api = "coordinate_transformation_api.main:main" [tool.setuptools-git-versioning] enabled = true @@ -45,12 +45,12 @@ enabled = true [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) -include = ["coordinates_transformation_api*"] # package names should match these glob patterns (["*"] by default) +include = ["coordinate_transformation_api*"] # package names should match these glob patterns (["*"] by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.package-data] -"coordinates_transformation_api.assets" = ["*"] -"coordinates_transformation_api.assets.static" = ["*"] +"coordinate_transformation_api.assets" = ["*"] +"coordinate_transformation_api.assets.static" = ["*"] [tool.ruff] # see https://beta.ruff.rs/docs/rules/ @@ -138,11 +138,11 @@ target-version = "py39" "ANN" # no type annotation required ] -"src/coordinates_transformation_api/cityjson/models.py" = [ +"src/coordinate_transformation_api/cityjson/models.py" = [ "N815", # non-snakecase variables allowed ] -"src/coordinates_transformation_api/util.py" = [ +"src/coordinate_transformation_api/util.py" = [ "ANN", ] diff --git a/src/coordinates_transformation_api/__init__.py b/src/coordinate_transformation_api/__init__.py similarity index 100% rename from src/coordinates_transformation_api/__init__.py rename to src/coordinate_transformation_api/__init__.py diff --git a/src/coordinates_transformation_api/assets/__init__.py b/src/coordinate_transformation_api/assets/__init__.py similarity index 100% rename from src/coordinates_transformation_api/assets/__init__.py rename to src/coordinate_transformation_api/assets/__init__.py diff --git a/src/coordinates_transformation_api/assets/logging.conf b/src/coordinate_transformation_api/assets/logging.conf similarity index 100% rename from src/coordinates_transformation_api/assets/logging.conf rename to src/coordinate_transformation_api/assets/logging.conf diff --git a/src/coordinates_transformation_api/assets/openapi.yaml b/src/coordinate_transformation_api/assets/openapi.yaml similarity index 99% rename from src/coordinates_transformation_api/assets/openapi.yaml rename to src/coordinate_transformation_api/assets/openapi.yaml index e1c8c31..0037889 100644 --- a/src/coordinates_transformation_api/assets/openapi.yaml +++ b/src/coordinate_transformation_api/assets/openapi.yaml @@ -1,10 +1,10 @@ --- openapi: "3.1.0" info: - title: NSGI Coordinates Transformation API + title: NSGI Coordinate Transformation API version: 2.0.0 description: > - The Coordinates Transformation API performs coordinate transformations on GeoJSON and CityJSON files using the official RDNAPTRANS™ + The Coordinate Transformation API performs coordinate transformations on GeoJSON and CityJSON files using the official RDNAPTRANS™ transformation procedure. contact: name: NSGI diff --git a/src/coordinates_transformation_api/assets/static/__init__.py b/src/coordinate_transformation_api/assets/static/__init__.py similarity index 100% rename from src/coordinates_transformation_api/assets/static/__init__.py rename to src/coordinate_transformation_api/assets/static/__init__.py diff --git a/src/coordinates_transformation_api/assets/static/favicon.ico b/src/coordinate_transformation_api/assets/static/favicon.ico similarity index 100% rename from src/coordinates_transformation_api/assets/static/favicon.ico rename to src/coordinate_transformation_api/assets/static/favicon.ico diff --git a/src/coordinates_transformation_api/cityjson/__init__.py b/src/coordinate_transformation_api/cityjson/__init__.py similarity index 100% rename from src/coordinates_transformation_api/cityjson/__init__.py rename to src/coordinate_transformation_api/cityjson/__init__.py diff --git a/src/coordinates_transformation_api/cityjson/models.py b/src/coordinate_transformation_api/cityjson/models.py similarity index 99% rename from src/coordinates_transformation_api/cityjson/models.py rename to src/coordinate_transformation_api/cityjson/models.py index ab40e36..b0962a5 100644 --- a/src/coordinates_transformation_api/cityjson/models.py +++ b/src/coordinate_transformation_api/cityjson/models.py @@ -14,7 +14,7 @@ from pydantic import AnyUrl, BaseModel, ConfigDict, EmailStr, Field, StringConstraints from pyproj import CRS -from coordinates_transformation_api.crs_transform import get_transform_crs_fun +from coordinate_transformation_api.crs_transform import get_transform_crs_fun CityJSONBoundary = Union[ list[list[list[int]]], diff --git a/src/coordinates_transformation_api/constants.py b/src/coordinate_transformation_api/constants.py similarity index 100% rename from src/coordinates_transformation_api/constants.py rename to src/coordinate_transformation_api/constants.py diff --git a/src/coordinates_transformation_api/crs_transform.py b/src/coordinate_transformation_api/crs_transform.py similarity index 95% rename from src/coordinates_transformation_api/crs_transform.py rename to src/coordinate_transformation_api/crs_transform.py index 677c665..7f34f80 100644 --- a/src/coordinates_transformation_api/crs_transform.py +++ b/src/coordinate_transformation_api/crs_transform.py @@ -18,9 +18,9 @@ from shapely import GeometryCollection as ShpGeometryCollection from shapely.geometry import shape -from coordinates_transformation_api.constants import DEFAULT_PRECISION -from coordinates_transformation_api.models import Crs as MyCrs -from coordinates_transformation_api.types import CoordinatesType +from coordinate_transformation_api.constants import DEFAULT_PRECISION +from coordinate_transformation_api.models import Crs as MyCrs +from coordinate_transformation_api.types import CoordinatesType def get_precision(target_crs_crs: MyCrs) -> int: @@ -78,7 +78,7 @@ def update_bbox( _result: list, _indices: list[int] | None = None, ) -> None: - coordinates = get_coordinates_from_geometry(geometry) + coordinates = get_coordinate_from_geometry(geometry) geometry.bbox = get_bbox_from_coordinates(coordinates) return update_bbox @@ -120,7 +120,7 @@ def coords_has_inf(coordinates: Any) -> bool: # noqa: ANN401 ) return next(gen, None) is not None - coords = get_coordinates_from_geometry(geometry) + coords = get_coordinate_from_geometry(geometry) result.append(coords_has_inf(coords)) # TODO: HANDLE result in calling code # if coords_has_inf(coordinates): @@ -160,7 +160,7 @@ def rec_fun( # noqa: C901 geojson_obj.bbox = get_bbox_from_coordinates(gc_coords) return gc_coords elif isinstance(geojson_obj, _GeometryBase): - geom_coords: list = get_coordinates_from_geometry(geojson_obj) + geom_coords: list = get_coordinate_from_geometry(geojson_obj) if geojson_obj.bbox is not None: geojson_obj.bbox = get_bbox_from_coordinates(geom_coords) return geom_coords @@ -197,7 +197,7 @@ def traverse_geojson_coordinates( ] -def get_coordinates_from_geometry( +def get_coordinate_from_geometry( item: _GeometryBase, ) -> list: geom = cast(_GeometryBase, item) diff --git a/src/coordinates_transformation_api/fastapi_rfc7807/README.md b/src/coordinate_transformation_api/fastapi_rfc7807/README.md similarity index 100% rename from src/coordinates_transformation_api/fastapi_rfc7807/README.md rename to src/coordinate_transformation_api/fastapi_rfc7807/README.md diff --git a/src/coordinates_transformation_api/fastapi_rfc7807/__init__.py b/src/coordinate_transformation_api/fastapi_rfc7807/__init__.py similarity index 100% rename from src/coordinates_transformation_api/fastapi_rfc7807/__init__.py rename to src/coordinate_transformation_api/fastapi_rfc7807/__init__.py diff --git a/src/coordinates_transformation_api/fastapi_rfc7807/middleware.py b/src/coordinate_transformation_api/fastapi_rfc7807/middleware.py similarity index 99% rename from src/coordinates_transformation_api/fastapi_rfc7807/middleware.py rename to src/coordinate_transformation_api/fastapi_rfc7807/middleware.py index 817fcbe..a81c00e 100644 --- a/src/coordinates_transformation_api/fastapi_rfc7807/middleware.py +++ b/src/coordinate_transformation_api/fastapi_rfc7807/middleware.py @@ -15,7 +15,7 @@ from starlette.responses import Response from starlette.types import ASGIApp, Message, Receive, Scope, Send -from coordinates_transformation_api.settings import app_settings +from coordinate_transformation_api.settings import app_settings PreHook = Callable[[Request, Exception], Union[Any, Awaitable[Any]]] PostHook = Callable[[Request, Response, Exception], Union[Any, Awaitable[Any]]] diff --git a/src/coordinates_transformation_api/fastapi_rfc7807/schema.py b/src/coordinate_transformation_api/fastapi_rfc7807/schema.py similarity index 100% rename from src/coordinates_transformation_api/fastapi_rfc7807/schema.py rename to src/coordinate_transformation_api/fastapi_rfc7807/schema.py diff --git a/src/coordinates_transformation_api/limit_middleware/__init__.py b/src/coordinate_transformation_api/limit_middleware/__init__.py similarity index 100% rename from src/coordinates_transformation_api/limit_middleware/__init__.py rename to src/coordinate_transformation_api/limit_middleware/__init__.py diff --git a/src/coordinates_transformation_api/limit_middleware/middleware.py b/src/coordinate_transformation_api/limit_middleware/middleware.py similarity index 100% rename from src/coordinates_transformation_api/limit_middleware/middleware.py rename to src/coordinate_transformation_api/limit_middleware/middleware.py diff --git a/src/coordinates_transformation_api/main.py b/src/coordinate_transformation_api/main.py similarity index 97% rename from src/coordinates_transformation_api/main.py rename to src/coordinate_transformation_api/main.py index fdd84a4..6d711e7 100644 --- a/src/coordinates_transformation_api/main.py +++ b/src/coordinate_transformation_api/main.py @@ -15,14 +15,14 @@ from geojson_pydantic import Feature from geojson_pydantic.geometries import Geometry, GeometryCollection -from coordinates_transformation_api import assets -from coordinates_transformation_api.cityjson.models import CityjsonV113 -from coordinates_transformation_api.fastapi_rfc7807 import middleware -from coordinates_transformation_api.limit_middleware.middleware import ( +from coordinate_transformation_api import assets +from coordinate_transformation_api.cityjson.models import CityjsonV113 +from coordinate_transformation_api.fastapi_rfc7807 import middleware +from coordinate_transformation_api.limit_middleware.middleware import ( ContentSizeLimitMiddleware, TimeoutMiddleware, ) -from coordinates_transformation_api.models import ( +from coordinate_transformation_api.models import ( Conformance, Crs, DensityCheckReport, @@ -30,8 +30,8 @@ Link, TransformGetAcceptHeaders, ) -from coordinates_transformation_api.settings import app_settings -from coordinates_transformation_api.util import ( +from coordinate_transformation_api.settings import app_settings +from coordinate_transformation_api.util import ( accept_html, convert_point_coords_to_wkt, crs_transform, @@ -468,7 +468,7 @@ async def post_transform( # noqa: ANN201, PLR0913 def main() -> None: uvicorn.run( - "coordinates_transformation_api.main:app", + "coordinate_transformation_api.main:app", workers=2, port=8000, host="0.0.0.0", # noqa: S104 diff --git a/src/coordinates_transformation_api/models.py b/src/coordinate_transformation_api/models.py similarity index 100% rename from src/coordinates_transformation_api/models.py rename to src/coordinate_transformation_api/models.py diff --git a/src/coordinates_transformation_api/settings.py b/src/coordinate_transformation_api/settings.py similarity index 100% rename from src/coordinates_transformation_api/settings.py rename to src/coordinate_transformation_api/settings.py diff --git a/src/coordinates_transformation_api/types.py b/src/coordinate_transformation_api/types.py similarity index 100% rename from src/coordinates_transformation_api/types.py rename to src/coordinate_transformation_api/types.py diff --git a/src/coordinates_transformation_api/util.py b/src/coordinate_transformation_api/util.py similarity index 95% rename from src/coordinates_transformation_api/util.py rename to src/coordinate_transformation_api/util.py index 5910e5e..5a9370a 100644 --- a/src/coordinates_transformation_api/util.py +++ b/src/coordinate_transformation_api/util.py @@ -25,10 +25,10 @@ from pyproj import CRS from shapely import STRtree, box -from coordinates_transformation_api import assets -from coordinates_transformation_api.cityjson.models import CityjsonV113 -from coordinates_transformation_api.constants import DENSIFY_CRS, DEVIATION_VALID_BBOX -from coordinates_transformation_api.crs_transform import ( +from coordinate_transformation_api import assets +from coordinate_transformation_api.cityjson.models import CityjsonV113 +from coordinate_transformation_api.constants import DENSIFY_CRS, DEVIATION_VALID_BBOX +from coordinate_transformation_api.crs_transform import ( get_crs_transform_fun, get_precision, get_shapely_objects, @@ -36,9 +36,9 @@ get_validate_json_coords_fun, update_bbox_geojson_object, ) -from coordinates_transformation_api.models import Crs as MyCrs -from coordinates_transformation_api.settings import app_settings -from coordinates_transformation_api.types import CoordinatesType +from coordinate_transformation_api.models import Crs as MyCrs +from coordinate_transformation_api.settings import app_settings +from coordinate_transformation_api.types import CoordinatesType logger = logging.getLogger(__name__) @@ -362,13 +362,13 @@ def transform_coordinates( coordinates: Any, source_crs: str, target_crs: str, epoch, target_crs_crs ) -> Any: precision = get_precision(target_crs_crs) - coordinates_list: CoordinatesType = list( + coordinate_list: CoordinatesType = list( float(x) for x in coordinates.split(",") ) # convert to list since we do not know dimensionality of coordinates transform_crs_fun = get_transform_crs_fun( source_crs, target_crs, precision=precision, epoch=epoch ) - transformed_coordinates = transform_crs_fun(coordinates_list) + transformed_coordinates = transform_crs_fun(coordinate_list) return transformed_coordinates diff --git a/tests/test_cityjson_transformation.py b/tests/test_cityjson_transformation.py index d0b2239..347c7d5 100644 --- a/tests/test_cityjson_transformation.py +++ b/tests/test_cityjson_transformation.py @@ -1,6 +1,6 @@ import json -from coordinates_transformation_api.cityjson.models import CityjsonV113 +from coordinate_transformation_api.cityjson.models import CityjsonV113 def test_cityjson_transformed(): diff --git a/tests/test_geojson_bbox.py b/tests/test_geojson_bbox.py index 76a1420..6cf5cf6 100644 --- a/tests/test_geojson_bbox.py +++ b/tests/test_geojson_bbox.py @@ -1,6 +1,6 @@ import json -from coordinates_transformation_api.util import ( +from coordinate_transformation_api.util import ( crs_transform, update_bbox_geojson_object, ) diff --git a/tests/test_geojson_transformation.py b/tests/test_geojson_transformation.py index baf7bde..61b3dfc 100644 --- a/tests/test_geojson_transformation.py +++ b/tests/test_geojson_transformation.py @@ -1,6 +1,6 @@ import json -from coordinates_transformation_api.util import crs_transform +from coordinate_transformation_api.util import crs_transform from geodense.geojson import CrsFeatureCollection from geojson_pydantic import Feature from geojson_pydantic.geometries import Geometry, GeometryCollection, parse_geometry_obj