-
Notifications
You must be signed in to change notification settings - Fork 220
Add query_geodetic_crs_from_datum #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
get_database_metadata, | ||
get_units_map, | ||
query_crs_info, | ||
query_geodetic_crs_from_datum, | ||
query_utm_crs_info, | ||
) | ||
from pyproj.enums import PJType | ||
|
@@ -268,3 +269,50 @@ def test_get_database_metadata(): | |
|
||
def test_get_database_metadata__invalid(): | ||
assert get_database_metadata("doesnotexist") is None | ||
|
||
|
||
def test_query_geodetic_crs_from_datum(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "GEOCENTRIC_CRS") | ||
assert len(crss) == 1 | ||
assert crss[0].to_authority()[1] == "6317" | ||
|
||
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.GEOCENTRIC_CRS) | ||
assert len(crss) == 1 | ||
assert crss[0].to_authority()[1] == "6317" | ||
|
||
crss = query_geodetic_crs_from_datum(None, "EPSG", "1116") | ||
assert len(crss) == 3 | ||
codes = [x.to_authority()[1] for x in crss] | ||
assert "6317" in codes | ||
assert "6318" in codes | ||
assert "6319" in codes | ||
|
||
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "6269", None) | ||
assert len(crss) == 1 | ||
assert crss[0].to_authority()[1] == "4269" | ||
|
||
crss = query_geodetic_crs_from_datum(None, "EPSG", "6269") | ||
assert len(crss) == 3 # EPSG, ESRI, OGC | ||
|
||
|
||
def test_query_geodetic_crs_from_datum_invalid(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
crss = query_geodetic_crs_from_datum(None, "EPSG", "11") | ||
assert len(crss) == 0 | ||
|
||
crss = query_geodetic_crs_from_datum(None, "EPSG", "32632") | ||
assert len(crss) == 0 | ||
|
||
crss = query_geodetic_crs_from_datum("foo-bar", "EPSG", "6269", None) | ||
assert len(crss) == 0 | ||
|
||
with pytest.raises(ValueError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend creating a separate test where |
||
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.PROJECTED_CRS) | ||
|
||
with pytest.raises(ValueError): | ||
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "invalid string") | ||
|
||
with pytest.raises(TypeError): | ||
query_geodetic_crs_from_datum("EPSG", "EPSG", None) | ||
|
||
with pytest.raises(TypeError): | ||
query_geodetic_crs_from_datum("EPSG", None, "1116") |
Uh oh!
There was an error while loading. Please reload this page.