Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Oct 22, 2024
1 parent a4b13f5 commit 0bb7f0b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions rio_tiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,17 +811,21 @@ def CRS_to_info(crs: CRS) -> Optional[Tuple[str, str, str]]:

def CRS_to_uri(crs: CRS) -> Optional[str]:
"""Convert CRS to URI."""
if authority_version_code := CRS_to_info(crs):
authority, version, code = authority_version_code
if crs_info := CRS_to_info(crs):
authority, version, code = crs_info

return f"http://www.opengis.net/def/crs/{authority}/{version}/{code}"

return None


def CRS_to_urn(crs: CRS) -> Optional[str]:
"""Convert CRS to URN."""
if authority_version_code := CRS_to_info(crs):
authority, version, code = authority_version_code
if crs_info := CRS_to_info(crs):
authority, version, code = crs_info
if version == "0":
version = ""

return f"urn:ogc:def:crs:{authority}:{version}:{code}"

return None

0 comments on commit 0bb7f0b

Please sign in to comment.