Skip to content

Commit

Permalink
round output of reprojection
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed Sep 25, 2024
1 parent 564d829 commit a5b43f5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ jobs:
name: Compare output
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12

- name: Install Ubuntu dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends python3-gdal python3-pip python3-pytest unzip
sudo apt-get install -y -qq --no-install-recommends unzip
- name: Install Python dependencies
run: pip install -r requirements.txt
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: pytest-3
run: pytest

- name: Create output
run: |
Expand Down
4 changes: 3 additions & 1 deletion lib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
except ImportError:
import osr

osr.DontUseExceptions()

# Same as the contents of the *_edges.prj files
PROJCS_WKT = \
"""GEOGCS["GCS_North_American_1983",
Expand All @@ -27,4 +29,4 @@
def unproject(point):
"""Covert point to WGS84"""
projected = transformer.TransformPoint(point[0], point[1])
return (projected[0], projected[1])
return (round(projected[0], 5), round(projected[1], 5))
2 changes: 1 addition & 1 deletion tests/test_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from lib.project import unproject

def test_unproject():
assert(unproject([-76.521714, 36.330247])) == (36.330247, -76.521714)
assert(unproject([-76.521714, 36.330247])) == (36.33024, -76.52171)

0 comments on commit a5b43f5

Please sign in to comment.