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 -*-
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_MIN, _UTM_ZONE_MAX, \ _UTMUPS_ZONE_INVALID
# all public contants, classes and functions
# _EPSG_INVALID = _UTMUPS_ZONE_INVALID
'''European Petroleum Survey Group (EPSG) encode, decode or other L{Epsg} issue. '''
'''U{EPSG<https://www.EPSG-Registry.org>} class, a C{_NamedInt}. '''
'''New L{Epsg} European Petroleum Survey Group (EPSG) code from a UTM/USP coordinate or other EPSG code.
@param eisu: Other (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 = u.name
def band(self): '''Get the UTM/UPS Band (C{'A'|'B'|'C'|'D'..'W'|'X'|'Y'|'Z'} or C{""}). '''
def hemisphere(self): '''Get the UTM/UPS hemisphere (C{'N'|'S'}). '''
def utmups(self): '''Get the UTM/TMP original (L{Utm}, L{Ups}). '''
'''Get the UTM/TMP zone, band and hemisphere (C{str}). '''
def zone(self): '''Get the UTM/UPS zone (C{int}, C{1..60} for UTM, C{0} for UPS). '''
'''Determine the UTM/USP zone and hemisphere from a given U{EPSG<https://www.EPSG-Registry.org>}.
@param 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 Karney's function U{UTMUPS::DecodeEPSG <https://GeographicLib.SourceForge.io/html/classGeographicLib_1_1UTMUPS.html>}. '''
else:
else: raise ValueError except (TypeError, ValueError): raise EPSGError('%s invalid: %r' % ('epsg', epsg))
'''Determine the U{EPSG<https://www.EPSG-Registry.org>} code for a given UTM/UPS zone number, hemisphere/pole and/or Band.
@param 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'). @keyword hemipole: UTM/UPS hemisphere or UPS projection top/center pole (C{str}, C{'N[orth]'} or C{'S[outh]'}). @keyword 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 Karney's function U{UTMUPS::EncodeEPSG <https://GeographicLib.SourceForge.io/html/classGeographicLib_1_1UTMUPS.html>}. ''' raise ValueError except ValueError: raise EPSGError('%s, %s or %s invalid: %r' % ('zone', 'hemipole', 'band', (zone, hemipole, band)))
else: raise EPSGError('%s invalid: %r' % ('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. |