Skip to content

Commit 42c4510

Browse files
committed
Improve the pc --override-crs tests
1 parent 5679b07 commit 42c4510

File tree

1 file changed

+6
-73
lines changed

1 file changed

+6
-73
lines changed

tests/point_cloud/test_imports.py

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,11 +1197,13 @@ def test_import_with_crs_override(
11971197
repo = KartRepo(repo_path)
11981198
with chdir(repo_path):
11991199
# First, import a single tile to establish the dataset CRS
1200+
# This tile is actually in EPSG:2193 but we override it to EPSG:2994
12001201
r = cli_runner.invoke(
12011202
[
12021203
"point-cloud-import",
12031204
f"{auckland}/auckland_0_0.laz",
12041205
"--dataset-path=auckland",
1206+
"--override-crs=EPSG:2994",
12051207
"--convert-to-copc",
12061208
]
12071209
)
@@ -1211,15 +1213,16 @@ def test_import_with_crs_override(
12111213
r = cli_runner.invoke(["meta", "get", "auckland", "crs.wkt"])
12121214
assert r.exit_code == 0, r.stderr
12131215
original_crs = r.stdout.strip()
1216+
assert "2994" in original_crs
12141217

1215-
# Import another tile with --override-crs=EPSG:2193 to override its CRS
1218+
# Import another tile with --override-crs=EPSG:2994 to override its CRS
12161219
r = cli_runner.invoke(
12171220
[
12181221
"point-cloud-import",
12191222
f"{auckland}/auckland_0_1.laz",
12201223
"--dataset-path=auckland",
12211224
"--update-existing",
1222-
"--override-crs=EPSG:2193",
1225+
"--override-crs=EPSG:2994",
12231226
"--convert-to-copc",
12241227
]
12251228
)
@@ -1235,76 +1238,6 @@ def test_import_with_crs_override(
12351238
assert r.exit_code == 0, r.stderr
12361239
final_crs = r.stdout.strip()
12371240

1238-
# The CRS should be normalized EPSG:2193 or equivalent
1239-
assert "2193" in final_crs or "NZGD2000" in final_crs
1241+
assert "2994" in final_crs
12401242

12411243
check_lfs_hashes(repo, 2)
1242-
1243-
1244-
def test_import_without_crs_override_should_fail_on_conflict(
1245-
tmp_path,
1246-
chdir,
1247-
cli_runner,
1248-
data_archive_readonly,
1249-
requires_pdal,
1250-
requires_git_lfs,
1251-
):
1252-
"""Test that imports fail on CRS conflicts when --override-crs is not used."""
1253-
# This test would require creating test data with conflicting CRS
1254-
# For now, we'll skip this test as it requires specific test data
1255-
# with intentionally conflicting CRS definitions
1256-
pytest.skip("Requires test data with conflicting CRS - to be implemented")
1257-
1258-
1259-
def test_override_crs_with_wkt_file(
1260-
tmp_path,
1261-
chdir,
1262-
cli_runner,
1263-
data_archive_readonly,
1264-
check_lfs_hashes,
1265-
requires_pdal,
1266-
requires_git_lfs,
1267-
):
1268-
"""Test that --override-crs works with WKT file syntax."""
1269-
with data_archive_readonly("point-cloud/laz-auckland.tgz") as auckland:
1270-
repo_path = tmp_path / "point-cloud-repo"
1271-
r = cli_runner.invoke(["init", repo_path])
1272-
assert r.exit_code == 0, r.stderr
1273-
1274-
# Create a WKT file
1275-
wkt_file = tmp_path / "test_crs.wkt"
1276-
wkt_content = """PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
1277-
GEOGCS["NZGD2000",
1278-
DATUM["New Zealand Geodetic Datum 2000",
1279-
SPHEROID["GRS 1980",6378137,298.257222101]],
1280-
PRIMEM["Greenwich",0],
1281-
UNIT["degree",0.0174532925199433]],
1282-
PROJECTION["Transverse_Mercator"],
1283-
PARAMETER["latitude_of_origin",0],
1284-
PARAMETER["central_meridian",173],
1285-
PARAMETER["scale_factor",0.9996],
1286-
PARAMETER["false_easting",1600000],
1287-
PARAMETER["false_northing",10000000],
1288-
UNIT["metre",1]]"""
1289-
wkt_file.write_text(wkt_content)
1290-
1291-
repo = KartRepo(repo_path)
1292-
with chdir(repo_path):
1293-
# Import with WKT file override
1294-
r = cli_runner.invoke(
1295-
[
1296-
"point-cloud-import",
1297-
f"{auckland}/auckland_0_0.laz",
1298-
"--dataset-path=auckland",
1299-
f"--override-crs=@{wkt_file}",
1300-
"--convert-to-copc",
1301-
]
1302-
)
1303-
assert r.exit_code == 0, r.stderr
1304-
1305-
# Verify the import was successful
1306-
r = cli_runner.invoke(["data", "ls"])
1307-
assert r.exit_code == 0, r.stderr
1308-
assert "auckland" in r.stdout
1309-
1310-
check_lfs_hashes(repo, 1)

0 commit comments

Comments
 (0)