Coverage for pygeodesy/epsg.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
I{European Petroleum Survey Group} (U{EPSG<https://www.EPSG-Registry.org>}) codes from and to U{UTM <https://WikiPedia.org/wiki/Universal_Transverse_Mercator_coordinate_system>} and U{UPS<https://WikiPedia.org/wiki/Universal_polar_stereographic_coordinate_system>} zones.
A pure Python implementation transcribed from I{Charles Karney}'s C++ class U{UTMUPS<https://GeographicLib.SourceForge.io/html/classGeographicLib_1_1UTMUPS.html>}, including coverage of UPS as zone C{0}. '''
_UTM_ZONE_MAX, UtmUps2Tuple, \ _UTMUPS_ZONE_INVALID
# _EPSG_INVALID = _UTMUPS_ZONE_INVALID
'''U{EPSG<https://www.EPSG-Registry.org>} class, a named C{int}. '''
'''New L{Epsg} (I{European Petroleum Survey Group}) code from a UTM/USP coordinate or other EPSG code.
@arg eisu: Other code (L{Epsg}, C{int}, C{str}, L{Utm} or L{Ups}).
@return: New L{Epsg}.
@raise TypeError: Invalid B{C{eisu}}.
@raise EPSGError: Invalid B{C{eisu}}. ''' self.name = eisu.name
else:
self.name = name
'''Get the (latitudinal) UTM/UPS Band (C{'A'|'B'|'C'|'D'..'W'|'X'|'Y'|'Z'} or C{""}). '''
'''Get the UTM/UPS hemisphere/-pole (C{'N'|'S'}). '''
'''Get the UTM/UPS original (L{Utm}, L{Ups}). '''
'''Get the UTM/UPS zone, band and hemisphere/-pole (C{str}). '''
'''Get the (longitudinal) UTM/UPS zone (C{int}, C{1..60} for UTM, C{0} for UPS). '''
'''EPSG encode, decode or other L{Epsg} issue. '''
'''Determine the UTM/USP zone and hemisphere from a given U{EPSG<https://www.EPSG-Registry.org>}.
@arg epsg: The EPSG (L{Epsg}, C{str} or C{scalar}).
@return: A L{UtmUps2Tuple}C{(zone, hemipole)}.
@raise EPSGError: Invalid B{C{epsg}}.
@note: Coverage of UPS as zone C{0} follows I{Karney}'s function U{UTMUPS::DecodeEPSG <https://GeographicLib.SourceForge.io/html/classGeographicLib_1_1UTMUPS.html>}. '''
else:
else: raise ValueError except (TypeError, ValueError) as x: raise EPSGError(epsg=epsg, txt=str(x))
'''Determine the U{EPSG<https://www.EPSG-Registry.org>} code for a given UTM/UPS zone number, hemisphere/pole and/or Band.
@arg zone: The (longitudinal) UTM zone (C{int}, 1..60) or UPS zone (C{int}, 0) or UTM zone with/-out (latitudinal) Band letter (C{str}, '01C'..'60X') or UPS zone with/-out (polar) Band letter (C{str}, '00A', '00B', '00Y' or '00Z'). @kwarg hemipole: UTM/UPS hemisphere or UPS projection top/center pole (C{str}, C{'N[orth]'} or C{'S[outh]'}). @kwarg band: Optional (latitudinal) UTM or (polar) UPS Band letter (C{str}).
@return: C{EPSG} code (L{Epsg}).
@raise EPSGError: Invalid B{C{zone}}, B{C{hemipole}} or B{C{band}}.
@note: Coverage of UPS as zone C{0} follows I{Karney}'s function U{UTMUPS::EncodeEPSG <https://GeographicLib.SourceForge.io/html/classGeographicLib_1_1UTMUPS.html>}. ''' raise ValueError except (TypeError, ValueError) as x: raise EPSGError(zone=zone, hemipole=hemipole, band=band, txt=str(x))
else: raise EPSGError(zone=zone)
# e._hemisphere = hp
# **) MIT License # # Copyright (C) 2016-2020 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |