From 7ce74763a3ac24dd82cc590d0c646e15031eedc5 Mon Sep 17 00:00:00 2001 From: snowman2 Date: Tue, 12 Mar 2019 20:07:50 -0500 Subject: [PATCH 1/4] initial attempt at class based version of Transformer --- pyproj/__init__.py | 567 ++----------------------------------- pyproj/_proj.pyx | 241 ---------------- pyproj/_transformer.pxd | 7 + pyproj/_transformer.pyx | 205 ++++++++++++++ pyproj/proj.py | 389 +++++++++++++++++++++++++ pyproj/transformer.py | 352 +++++++++++++++++++++++ setup.py | 5 +- sphinx/api/index.rst | 1 + sphinx/api/proj.rst | 13 +- sphinx/api/transformer.rst | 19 ++ 10 files changed, 994 insertions(+), 805 deletions(-) create mode 100644 pyproj/_transformer.pxd create mode 100644 pyproj/_transformer.pyx create mode 100644 pyproj/proj.py create mode 100644 pyproj/transformer.py create mode 100644 sphinx/api/transformer.rst diff --git a/pyproj/__init__.py b/pyproj/__init__.py index 989137684..bd6db6f56 100644 --- a/pyproj/__init__.py +++ b/pyproj/__init__.py @@ -26,7 +26,7 @@ Download: http://python.org/pypi/pyproj -Requirements: Python 2.6, 2.7, 3.2 or higher version. +Requirements: Python 2.7 or 3.5+. Example scripts are in 'test' subdirectory of source distribution. The 'test()' function will run the examples in the docstrings. @@ -48,558 +48,22 @@ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ __version__ = "2.0.2" -__all__ = ["Proj", "Geod", "CRS", "transform", "itransform", "pj_ellps", "pj_list"] +__all__ = [ + "Proj", + "Geod", + "CRS", + "Transformer", + "transform", + "itransform", + "pj_ellps", + "pj_list", +] -import re -import sys -import warnings -from array import array -from itertools import chain, islice - -from pyproj import _proj -from pyproj.compat import cstrencode, pystrdecode from pyproj.crs import CRS from pyproj.exceptions import ProjError from pyproj.geod import Geod, geodesic_version_str, pj_ellps -from pyproj.utils import _convertback, _copytobuffer - -try: - from future_builtins import zip # python 2.6+ -except ImportError: - pass # python 3.x - - -# import numpy as np -proj_version_str = _proj.proj_version_str - -pj_list = { - "aea": "Albers Equal Area", - "aeqd": "Azimuthal Equidistant", - "affine": "Affine transformation", - "airy": "Airy", - "aitoff": "Aitoff", - "alsk": "Mod. Stererographics of Alaska", - "apian": "Apian Globular I", - "august": "August Epicycloidal", - "bacon": "Bacon Globular", - "bertin1953": "Bertin 1953", - "bipc": "Bipolar conic of western hemisphere", - "boggs": "Boggs Eumorphic", - "bonne": "Bonne (Werner lat_1=90)", - "calcofi": "Cal Coop Ocean Fish Invest Lines/Stations", - "cart": "Geodetic/cartesian conversions", - "cass": "Cassini", - "cc": "Central Cylindrical", - "ccon": "Central Conic", - "cea": "Equal Area Cylindrical", - "chamb": "Chamberlin Trimetric", - "collg": "Collignon", - "comill": "Compact Miller", - "crast": "Craster Parabolic (Putnins P4)", - "deformation": "Kinematic grid shift", - "denoy": "Denoyer Semi-Elliptical", - "eck1": "Eckert I", - "eck2": "Eckert II", - "eck3": "Eckert III", - "eck4": "Eckert IV", - "eck5": "Eckert V", - "eck6": "Eckert VI", - "eqc": "Equidistant Cylindrical (Plate Caree)", - "eqdc": "Equidistant Conic", - "euler": "Euler", - "etmerc": "Extended Transverse Mercator", - "fahey": "Fahey", - "fouc": "Foucaut", - "fouc_s": "Foucaut Sinusoidal", - "gall": "Gall (Gall Stereographic)", - "geoc": "Geocentric Latitude", - "geocent": "Geocentric", - "geogoffset": "Geographic Offset", - "geos": "Geostationary Satellite View", - "gins8": "Ginsburg VIII (TsNIIGAiK)", - "gn_sinu": "General Sinusoidal Series", - "gnom": "Gnomonic", - "goode": "Goode Homolosine", - "gs48": "Mod. Stererographics of 48 U.S.", - "gs50": "Mod. Stererographics of 50 U.S.", - "hammer": "Hammer & Eckert-Greifendorff", - "hatano": "Hatano Asymmetrical Equal Area", - "healpix": "HEALPix", - "rhealpix": "rHEALPix", - "helmert": "3- and 7-parameter Helmert shift", - "hgridshift": "Horizontal grid shift", - "horner": "Horner polynomial evaluation", - "igh": "Interrupted Goode Homolosine", - "imw_p": "International Map of the World Polyconic", - "isea": "Icosahedral Snyder Equal Area", - "kav5": "Kavraisky V", - "kav7": "Kavraisky VII", - "krovak": "Krovak", - "labrd": "Laborde", - "laea": "Lambert Azimuthal Equal Area", - "lagrng": "Lagrange", - "larr": "Larrivee", - "lask": "Laskowski", - "lonlat": "Lat/long (Geodetic)", - "latlon": "Lat/long (Geodetic alias)", - "latlong": "Lat/long (Geodetic alias)", - "longlat": "Lat/long (Geodetic alias)", - "lcc": "Lambert Conformal Conic", - "lcca": "Lambert Conformal Conic Alternative", - "leac": "Lambert Equal Area Conic", - "lee_os": "Lee Oblated Stereographic", - "loxim": "Loximuthal", - "lsat": "Space oblique for LANDSAT", - "mbt_s": "McBryde-Thomas Flat-Polar Sine", - "mbt_fps": "McBryde-Thomas Flat-Pole Sine (No. 2)", - "mbtfpp": "McBride-Thomas Flat-Polar Parabolic", - "mbtfpq": "McBryde-Thomas Flat-Polar Quartic", - "mbtfps": "McBryde-Thomas Flat-Polar Sinusoidal", - "merc": "Mercator", - "mil_os": "Miller Oblated Stereographic", - "mill": "Miller Cylindrical", - "misrsom": "Space oblique for MISR", - "moll": "Mollweide", - "molobadekas": "Molodensky-Badekas transform", - "molodensky": "Molodensky transform", - "murd1": "Murdoch I", - "murd2": "Murdoch II", - "murd3": "Murdoch III", - "natearth": "Natural Earth", - "natearth2": "Natural Earth 2", - "nell": "Nell", - "nell_h": "Nell-Hammer", - "nicol": "Nicolosi Globular", - "nsper": "Near-sided perspective", - "nzmg": "New Zealand Map Grid", - "ob_tran": "General Oblique Transformation", - "ocea": "Oblique Cylindrical Equal Area", - "oea": "Oblated Equal Area", - "omerc": "Oblique Mercator", - "ortel": "Ortelius Oval", - "ortho": "Orthographic", - "patterson": "Patterson Cylindrical", - "pconic": "Perspective Conic", - "pipeline": "Transformation pipeline manager", - "poly": "Polyconic (American)", - "pop": "Retrieve coordinate value from pipeline stack", - "putp1": "Putnins P1", - "putp2": "Putnins P2", - "putp3": "Putnins P3", - "putp3p": "Putnins P3'", - "putp4p": "Putnins P4'", - "putp5": "Putnins P5", - "putp5p": "Putnins P5'", - "putp6": "Putnins P6", - "putp6p": "Putnins P6'", - "qua_aut": "Quartic Authalic", - "robin": "Robinson", - "rouss": "Roussilhe Stereographic", - "rpoly": "Rectangular Polyconic", - "sch": "Spherical Cross-track Height", - "sinu": "Sinusoidal (Sanson-Flamsteed)", - "somerc": "Swiss. Obl. Mercator", - "stere": "Stereographic", - "sterea": "Oblique Stereographic Alternative", - "gstmerc": "Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)", - "tcc": "Transverse Central Cylindrical", - "tcea": "Transverse Cylindrical Equal Area", - "times": "Times", - "tissot": "Tissot Conic", - "tmerc": "Transverse Mercator", - "tpeqd": "Two Point Equidistant", - "tpers": "Tilted perspective", - "ups": "Universal Polar Stereographic", - "urm5": "Urmaev V", - "urmfps": "Urmaev Flat-Polar Sinusoidal", - "utm": "Universal Transverse Mercator (UTM)", - "vandg": "van der Grinten (I)", - "vandg2": "van der Grinten II", - "vandg3": "van der Grinten III", - "vandg4": "van der Grinten IV", - "vitk1": "Vitkovsky I", - "wag1": "Wagner I (Kavraisky VI)", - "wag2": "Wagner II", - "wag3": "Wagner III", - "wag4": "Wagner IV", - "wag5": "Wagner V", - "wag6": "Wagner VI", - "wag7": "Wagner VII", - "webmerc": "Web Mercator / Pseudo Mercator", - "weren": "Werenskiold I", - "wink1": "Winkel I", - "wink2": "Winkel II", - "wintri": "Winkel Tripel", -} - - -class Proj(_proj.Proj): - """ - performs cartographic transformations (converts from - longitude,latitude to native map projection x,y coordinates and - vice versa) using proj (https://github.com/OSGeo/proj.4/wiki). - - A Proj class instance is initialized with proj map projection - control parameter key/value pairs. The key/value pairs can - either be passed in a dictionary, or as keyword arguments, - or as a proj4 string (compatible with the proj command). See - http://www.remotesensing.org/geotiff/proj_list for examples of - key/value pairs defining different map projections. - - Calling a Proj class instance with the arguments lon, lat will - convert lon/lat (in degrees) to x/y native map projection - coordinates (in meters). If optional keyword 'inverse' is True - (default is False), the inverse transformation from x/y to - lon/lat is performed. If optional keyword 'errcheck' is True (default is - False) an exception is raised if the transformation is invalid. - If errcheck=False and the transformation is invalid, no - exception is raised and 1.e30 is returned. If the optional keyword - 'preserve_units' is True, the units in map projection coordinates - are not forced to be meters. - - Works with numpy and regular python array objects, python - sequences and scalars. - """ - - def __init__(self, projparams=None, preserve_units=True, **kwargs): - """ - initialize a Proj class instance. - - See the proj documentation (https://github.com/OSGeo/proj.4/wiki) - for more information about projection parameters. - - Parameters - ---------- - projparams: int, str, dict, pyproj.CRS - A proj.4 or WKT string, proj.4 dict, EPSG integer, or a pyproj.CRS instnace. - preserve_units: bool - If false, will ensure +units=m. - **kwargs: - proj.4 projection parameters. - - - Example usage: - - >>> from pyproj import Proj - >>> p = Proj(proj='utm',zone=10,ellps='WGS84', preserve_units=False) # use kwargs - >>> x,y = p(-120.108, 34.36116666) - >>> 'x=%9.3f y=%11.3f' % (x,y) - 'x=765975.641 y=3805993.134' - >>> 'lon=%8.3f lat=%5.3f' % p(x,y,inverse=True) - 'lon=-120.108 lat=34.361' - >>> # do 3 cities at a time in a tuple (Fresno, LA, SF) - >>> lons = (-119.72,-118.40,-122.38) - >>> lats = (36.77, 33.93, 37.62 ) - >>> x,y = p(lons, lats) - >>> 'x: %9.3f %9.3f %9.3f' % x - 'x: 792763.863 925321.537 554714.301' - >>> 'y: %9.3f %9.3f %9.3f' % y - 'y: 4074377.617 3763936.941 4163835.303' - >>> lons, lats = p(x, y, inverse=True) # inverse transform - >>> 'lons: %8.3f %8.3f %8.3f' % lons - 'lons: -119.720 -118.400 -122.380' - >>> 'lats: %8.3f %8.3f %8.3f' % lats - 'lats: 36.770 33.930 37.620' - >>> p2 = Proj('+proj=utm +zone=10 +ellps=WGS84', preserve_units=False) # use proj4 string - >>> x,y = p2(-120.108, 34.36116666) - >>> 'x=%9.3f y=%11.3f' % (x,y) - 'x=765975.641 y=3805993.134' - >>> p = Proj(init="epsg:32667", preserve_units=False) - >>> 'x=%12.3f y=%12.3f (meters)' % p(-114.057222, 51.045) - 'x=-1783506.250 y= 6193827.033 (meters)' - >>> p = Proj("+init=epsg:32667") - >>> 'x=%12.3f y=%12.3f (feet)' % p(-114.057222, 51.045) - 'x=-5851386.754 y=20320914.191 (feet)' - >>> # test data with radian inputs - >>> p1 = Proj(init="epsg:4214") - >>> x1, y1 = p1(116.366, 39.867) - >>> '{:.3f} {:.3f}'.format(x1, y1) - '2.031 0.696' - >>> x2, y2 = p1(x1, y1, inverse=True) - >>> '{:.3f} {:.3f}'.format(x2, y2) - '116.366 39.867' - """ - self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs) - # make sure units are meters if preserve_units is False. - if not preserve_units and self.crs.is_projected: - projstring = self.crs.to_proj4(4) - projstring = re.sub(r"\s\+units=[\w-]+", "", projstring) - projstring += " +units=m" - self.crs = CRS(projstring) - super(Proj, self).__init__( - cstrencode(self.crs.to_proj4().replace("+type=crs", "").strip()) - ) - - def __call__(self, *args, **kw): - # ,lon,lat,inverse=False,errcheck=False): - """ - Calling a Proj class instance with the arguments lon, lat will - convert lon/lat (in degrees) to x/y native map projection - coordinates (in meters). If optional keyword 'inverse' is True - (default is False), the inverse transformation from x/y to - lon/lat is performed. If optional keyword 'errcheck' is True (default is - False) an exception is raised if the transformation is invalid. - If errcheck=False and the transformation is invalid, no - exception is raised and 1.e30 is returned. - - Inputs should be doubles (they will be cast to doubles if they - are not, causing a slight performance hit). - - Works with numpy and regular python array objects, python - sequences and scalars, but is fastest for array objects. - """ - inverse = kw.get("inverse", False) - errcheck = kw.get("errcheck", False) - # if len(args) == 1: - # latlon = np.array(args[0], copy=True, - # order='C', dtype=float, ndmin=2) - # if inverse: - # _proj.Proj._invn(self, latlon, radians=radians, errcheck=errcheck) - # else: - # _proj.Proj._fwdn(self, latlon, radians=radians, errcheck=errcheck) - # return latlon - lon, lat = args - # process inputs, making copies that support buffer API. - inx, xisfloat, xislist, xistuple = _copytobuffer(lon) - iny, yisfloat, yislist, yistuple = _copytobuffer(lat) - # call proj4 functions. inx and iny modified in place. - if inverse: - self._inv(inx, iny, errcheck=errcheck) - else: - self._fwd(inx, iny, errcheck=errcheck) - # if inputs were lists, tuples or floats, convert back. - outx = _convertback(xisfloat, xislist, xistuple, inx) - outy = _convertback(yisfloat, yislist, xistuple, iny) - return outx, outy - - def is_latlong(self): - """ - Returns - ------- - bool: True if projection in geographic (lon/lat) coordinates. - """ - warnings.warn("'is_latlong()' is deprecated. Please use 'crs.is_geographic'.") - return self.crs.is_geographic - - def is_geocent(self): - """ - Returns - ------- - bool: True if projection in geocentric (x/y) coordinates - """ - warnings.warn("'is_geocent()' is deprecated. Please use 'crs.is_geocent'.") - return self.is_geocent - - def definition_string(self): - """Returns formal definition string for projection - - >>> Proj('+init=epsg:4326').definition_string() - 'proj=longlat datum=WGS84 no_defs ellps=WGS84 towgs84=0,0,0' - >>> - """ - return pystrdecode(self.definition) - - def to_latlong_def(self): - """return the definition string of the geographic (lat/lon) - coordinate version of the current projection""" - # This is a little hacky way of getting a latlong proj object - # Maybe instead of this function the __cinit__ function can take a - # Proj object and a type (where type = "geographic") as the libproj - # java wrapper - return self.crs.to_geodetic().to_proj4(4) - - # deprecated : using in transform raised a TypeError in release 1.9.5.1 - # reported in issue #53, resolved in #73. - def to_latlong(self): - """return a new Proj instance which is the geographic (lat/lon) - coordinate version of the current projection""" - return Proj(self.crs.to_geodetic()) - - -def transform(p1, p2, x, y, z=None, radians=False): - """ - x2, y2, z2 = transform(p1, p2, x1, y1, z1) - - Transform points between two coordinate systems defined by the - Proj instances p1 and p2. - - The points x1,y1,z1 in the coordinate system defined by p1 are - transformed to x2,y2,z2 in the coordinate system defined by p2. - - z1 is optional, if it is not set it is assumed to be zero (and - only x2 and y2 are returned). If the optional keyword - 'radians' is True (default is False), then all input and - output coordinates will be in radians instead of the default - of degrees for geographic input/output projections. - - In addition to converting between cartographic and geographic - projection coordinates, this function can take care of datum - shifts (which cannot be done using the __call__ method of the - Proj instances). It also allows for one of the coordinate - systems to be geographic (proj = 'latlong'). - - x,y and z can be numpy or regular python arrays, python - lists/tuples or scalars. Arrays are fastest. For projections in - geocentric coordinates, values of x and y are given in meters. - z is always meters. - - Example usage: - - >>> # projection 1: UTM zone 15, grs80 ellipse, NAD83 datum - >>> # (defined by epsg code 26915) - >>> p1 = Proj(init='epsg:26915', preserve_units=False) - >>> # projection 2: UTM zone 15, clrk66 ellipse, NAD27 datum - >>> p2 = Proj(init='epsg:26715', preserve_units=False) - >>> # find x,y of Jefferson City, MO. - >>> x1, y1 = p1(-92.199881,38.56694) - >>> # transform this point to projection 2 coordinates. - >>> x2, y2 = transform(p1,p2,x1,y1) - >>> '%9.3f %11.3f' % (x1,y1) - '569704.566 4269024.671' - >>> '%9.3f %11.3f' % (x2,y2) - '569722.342 4268814.028' - >>> '%8.3f %5.3f' % p2(x2,y2,inverse=True) - ' -92.200 38.567' - >>> # process 3 points at a time in a tuple - >>> lats = (38.83,39.32,38.75) # Columbia, KC and StL Missouri - >>> lons = (-92.22,-94.72,-90.37) - >>> x1, y1 = p1(lons,lats) - >>> x2, y2 = transform(p1,p2,x1,y1) - >>> xy = x1+y1 - >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy - '567703.344 351730.944 728553.093 4298200.739 4353698.725 4292319.005' - >>> xy = x2+y2 - >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy - '567721.149 351747.558 728569.133 4297989.112 4353489.645 4292106.305' - >>> lons, lats = p2(x2,y2,inverse=True) - >>> xy = lons+lats - >>> '%8.3f %8.3f %8.3f %5.3f %5.3f %5.3f' % xy - ' -92.220 -94.720 -90.370 38.830 39.320 38.750' - >>> # test datum shifting, installation of extra datum grid files. - >>> p1 = Proj(proj='latlong',datum='WGS84') - >>> x1 = -111.5; y1 = 45.25919444444 - >>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False) - >>> x2, y2 = transform(p1, p2, x1, y1) - >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) - '1402285.9 5076292.4' - >>> from pyproj import CRS - >>> c1 = CRS(proj='latlong',datum='WGS84') - >>> x1 = -111.5; y1 = 45.25919444444 - >>> c2 = CRS(proj="utm",zone=10,datum='NAD27') - >>> x2, y2 = transform(c1, c2, x1, y1) - >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) - '1402291.0 5076289.5' - >>> x3, y3 = transform("epsg:4326", "epsg:3857", 33, 98) - >>> "%.3f %.3f" % (x3, y3) - '10909310.098 3895303.963' - >>> pj = Proj(init="epsg:4214") - >>> pjx, pjy = pj(116.366, 39.867) - >>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True) - >>> "%.3f %.3f" % (xr, yr) - '2.031 0.696' - """ - # check that p1 and p2 are valid - if not isinstance(p1, Proj): - p1 = CRS.from_user_input(p1) - if not isinstance(p2, Proj): - p2 = CRS.from_user_input(p2) - - # process inputs, making copies that support buffer API. - inx, xisfloat, xislist, xistuple = _copytobuffer(x) - iny, yisfloat, yislist, yistuple = _copytobuffer(y) - if z is not None: - inz, zisfloat, zislist, zistuple = _copytobuffer(z) - else: - inz = None - # call pj_transform. inx,iny,inz buffers modified in place. - _proj._transform(p1, p2, inx, iny, inz, radians) - # if inputs were lists, tuples or floats, convert back. - outx = _convertback(xisfloat, xislist, xistuple, inx) - outy = _convertback(yisfloat, yislist, xistuple, iny) - if inz is not None: - outz = _convertback(zisfloat, zislist, zistuple, inz) - return outx, outy, outz - else: - return outx, outy - - -def itransform(p1, p2, points, switch=False, radians=False): - """ - points2 = transform(p1, p2, points1) - Iterator/generator version of the function pyproj.transform. - Transform points between two coordinate systems defined by the - Proj instances p1 and p2. This function can be used as an alternative - to pyproj.transform when there is a need to transform a big number of - coordinates lazily, for example when reading and processing from a file. - Points1 is an iterable/generator of coordinates x1,y1(,z1) or lon1,lat1(,z1) - in the coordinate system defined by p1. Points2 is an iterator that returns tuples - of x2,y2(,z2) or lon2,lat2(,z2) coordinates in the coordinate system defined by p2. - z are provided optionally. - - Points1 can be: - - a tuple/list of tuples/lists i.e. for 2d points: [(xi,yi),(xj,yj),....(xn,yn)] - - a Nx3 or Nx2 2d numpy array where N is the point number - - a generator of coordinates (xi,yi) for 2d points or (xi,yi,zi) for 3d - - If optional keyword 'switch' is True (default is False) then x, y or lon,lat coordinates - of points are switched to y, x or lat, lon. If the optional keyword 'radians' is True - (default is False), then all input and output coordinates will be in radians instead - of the default of degrees for geographic input/output projections. - - - Example usage: - - >>> # projection 1: WGS84 - >>> # (defined by epsg code 4326) - >>> p1 = Proj(init='epsg:4326', preserve_units=False) - >>> # projection 2: GGRS87 / Greek Grid - >>> p2 = Proj(init='epsg:2100', preserve_units=False) - >>> # Three points with coordinates lon, lat in p1 - >>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)] - >>> # transform this point to projection 2 coordinates. - >>> for pt in itransform(p1,p2,points): '%6.3f %7.3f' % pt - '411200.657 4498214.742' - '399210.500 4487264.963' - '458703.102 4523331.451' - >>> for pt in itransform(4326, 2100, points): '{:.3f} {:.3f}'.format(*pt) - '2221638.801 2637034.372' - '2212924.125 2619851.898' - '2238294.779 2703763.736' - >>> pj = Proj(init="epsg:4214") - >>> pjx, pjy = pj(116.366, 39.867) - >>> for pt in itransform(pj, Proj(4326), [(pjx, pjy)]): '{:.3f} {:.3f}'.format(*pt) - '2.031 0.696' - """ - if not isinstance(p1, Proj): - p1 = CRS.from_user_input(p1) - if not isinstance(p2, Proj): - p2 = CRS.from_user_input(p2) - - it = iter(points) # point iterator - # get first point to check stride - try: - fst_pt = next(it) - except StopIteration: - raise ValueError("iterable must contain at least one point") - - stride = len(fst_pt) - if stride not in (2, 3): - raise ValueError("points can contain up to 3 coordinates") - - # create a coordinate sequence generator etc. x1,y1,z1,x2,y2,z2,.... - # chain so the generator returns the first point that was already acquired - coord_gen = chain(fst_pt, (coords[c] for coords in it for c in range(stride))) - - while True: - # create a temporary buffer storage for the next 64 points (64*stride*8 bytes) - buff = array("d", islice(coord_gen, 0, 64 * stride)) - if len(buff) == 0: - break - - _proj._transform_sequence(p1, p2, stride, buff, switch, radians) - - for pt in zip(*([iter(buff)] * stride)): - yield pt +from pyproj.proj import Proj, pj_list, proj_version_str +from pyproj.transformer import Transformer, itransform, transform def test(**kwargs): @@ -608,9 +72,12 @@ def test(**kwargs): import pyproj verbose = kwargs.get("verbose") - failure_count, test_count = doctest.testmod(pyproj, verbose=verbose) + failure_count, test_count = doctest.testmod(pyproj.proj, verbose=verbose) failure_count_crs, test_count_crs = doctest.testmod(pyproj.crs, verbose=verbose) failure_count_geod, test_count_geod = doctest.testmod(pyproj.geod, verbose=verbose) + failure_count_transform, test_count_transform = doctest.testmod( + pyproj.transformer, verbose=verbose + ) return failure_count + failure_count_crs + failure_count_geod diff --git a/pyproj/_proj.pyx b/pyproj/_proj.pyx index 5b124bed8..b2cf7739c 100644 --- a/pyproj/_proj.pyx +++ b/pyproj/_proj.pyx @@ -1,8 +1,5 @@ -# cimport c_numpy -# c_numpy.import_array() include "base.pxi" -from pyproj.crs import CRS from pyproj.compat import cstrencode, pystrdecode from pyproj.datadir import get_data_dir from pyproj.exceptions import ProjError @@ -175,243 +172,5 @@ cdef class Proj: xdatab[i] = projlonlatout.uv.u ydatab[i] = projlonlatout.uv.v -# def _fwdn(self, c_numpy.ndarray lonlat, radians=False, errcheck=False): -# """ -# forward transformation - lons,lats to x,y (done in place). -# Uses ndarray of shape ...,2. -# if radians=True, lons/lats are radians instead of degrees. -# if errcheck=True, an exception is raised if the forward -# transformation is invalid. -# if errcheck=False and the forward transformation is -# invalid, no exception is -# raised and 1.e30 is returned. -# """ -# cdef PJ_UV projxyout, projlonlatin -# cdef PJ_UV *llptr -# cdef int err -# cdef Py_ssize_t npts, i -# npts = c_numpy.PyArray_SIZE(lonlat)//2 -# llptr = lonlat.data -# for i from 0 <= i < npts: -# if radians: -# projlonlatin = llptr[i] -# else: -# projlonlatin.u = _DG2RAD*llptr[i].u -# projlonlatin.v = _DG2RAD*llptr[i].v -# projxyout = pj_fwd(projlonlatin,self.projpj) -# -# if errcheck: -# err = proj_context_errno(self.projctx) -# if err != 0: -# raise ProjError(proj_errno_string(err)) -# # since HUGE_VAL can be 'inf', -# # change it to a real (but very large) number. -# if projxyout.u == HUGE_VAL: -# llptr[i].u = 1.e30 -# else: -# llptr[i].u = projxyout.u -# if projxyout.v == HUGE_VAL: -# llptr[i].u = 1.e30 -# else: -# llptr[i].v = projxyout.v -# -# def _invn(self, c_numpy.ndarray xy, radians=False, errcheck=False): -# """ -# inverse transformation - x,y to lons,lats (done in place). -# Uses ndarray of shape ...,2. -# if radians=True, lons/lats are radians instead of degrees. -# if errcheck=True, an exception is raised if the inverse transformation is invalid. -# if errcheck=False and the inverse transformation is invalid, no exception is -# raised and 1.e30 is returned. -# """ -# cdef PJ_UV projxyin, projlonlatout -# cdef PJ_UV *llptr -# cdef Py_ssize_t npts, i -# npts = c_numpy.PyArray_SIZE(xy)//2 -# llptr = xy.data -# -# for i from 0 <= i < npts: -# projxyin = llptr[i] -# projlonlatout = pj_inv(projxyin, self.projpj) -# if errcheck: -# err = proj_context_errno(self.projctx) -# if err != 0: -# raise ProjError(proj_errno_string(err)) -# # since HUGE_VAL can be 'inf', -# # change it to a real (but very large) number. -# if projlonlatout.u == HUGE_VAL: -# llptr[i].u = 1.e30 -# elif radians: -# llptr[i].u = projlonlatout.u -# else: -# llptr[i].u = _RAD2DG*projlonlatout.u -# if projlonlatout.v == HUGE_VAL: -# llptr[i].v = 1.e30 -# elif radians: -# llptr[i].v = projlonlatout.v -# else: -# llptr[i].v = _RAD2DG*projlonlatout.v - def __repr__(self): return "Proj('{srs}', preserve_units=True)".format(srs=self.srs) - -cdef class TransProj: - def __cinit__(self): - self.projpj = NULL - self.projctx = NULL - - def __init__(self, p1, p2): - # set up the context - self.projctx = proj_context_create() - py_data_dir = cstrencode(get_data_dir()) - cdef const char* data_dir = py_data_dir - proj_context_set_search_paths(self.projctx, 1, &data_dir) - - self.projpj = proj_create_crs_to_crs( - self.projctx, - TransProj.definition_from_object(p1), - TransProj.definition_from_object(p2), - NULL) - if self.projpj is NULL: - raise ProjError("Error creating CRS to CRS.") - - def __dealloc__(self): - """destroy projection definition""" - if self.projpj is not NULL: - proj_destroy(self.projpj) - if self.projctx is not NULL: - proj_context_destroy(self.projctx) - - @staticmethod - def definition_from_object(in_proj): - """ - Parameters - ---------- - in_proj: :obj:`pyproj.Proj` or :obj:`pyproj.CRS` - - Returns - ------- - char*: Definition string for `proj_create_crs_to_crs`. - - """ - if isinstance(in_proj, Proj): - return in_proj.definition - return cstrencode(CRS.from_user_input(in_proj).to_wkt()) - - -def is_geographic(proj): - if hasattr(proj, "crs"): - proj = proj.crs - return proj.is_geographic - - -def _transform(p1, p2, inx, iny, inz, radians): - pj_trans = TransProj(p1, p2) - # private function to call pj_transform - cdef void *xdata - cdef void *ydata - cdef void *zdata - cdef double *xx - cdef double *yy - cdef double *zz - cdef Py_ssize_t buflenx, bufleny, buflenz, npts, i - cdef int err - if PyObject_AsWriteBuffer(inx, &xdata, &buflenx) <> 0: - raise ProjError - if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0: - raise ProjError - if inz is not None: - if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0: - raise ProjError - else: - buflenz = bufleny - if not (buflenx == bufleny == buflenz): - raise ProjError('x,y and z must be same size') - xx = xdata - yy = ydata - if inz is not None: - zz = zdata - else: - zz = NULL - npts = buflenx//8 - - if radians and is_geographic(p1): - for i from 0 <= i < npts: - xx[i] = xx[i]*_RAD2DG - yy[i] = yy[i]*_RAD2DG - - proj_trans_generic( - pj_trans.projpj, - PJ_FWD, - xx, _DOUBLESIZE, npts, - yy, _DOUBLESIZE, npts, - zz, _DOUBLESIZE, npts, - NULL, 0, 0, - ) - cdef int errno = proj_errno(pj_trans.projpj) - if errno: - raise ProjError("proj_trans_generic error: {}".format( - pystrdecode(proj_errno_string(errno)))) - - if radians and is_geographic(p2): - for i from 0 <= i < npts: - xx[i] = xx[i]*_DG2RAD - yy[i] = yy[i]*_DG2RAD - -def _transform_sequence(p1, p2, Py_ssize_t stride, inseq, bint switch, radians): - pj_trans = TransProj(p1, p2) - # private function to itransform function - cdef: - void *buffer - double *coords - double *x - double *y - double *z - Py_ssize_t buflen, npts, i, j - int err - - if stride < 2: - raise ProjError("coordinates must contain at least 2 values") - if PyObject_AsWriteBuffer(inseq, &buffer, &buflen) <> 0: - raise ProjError("object does not provide the python buffer writeable interface") - - coords = buffer - npts = buflen // (stride * _DOUBLESIZE) - - if radians and is_geographic(p1): - for i from 0 <= i < npts: - j = stride*i - coords[j] *= _RAD2DG - coords[j+1] *= _RAD2DG - - if not switch: - x = coords - y = coords + 1 - else: - x = coords + 1 - y = coords - - if stride == 2: - z = NULL - else: - z = coords + 2 - - proj_trans_generic ( - pj_trans.projpj, - PJ_FWD, - x, stride*_DOUBLESIZE, npts, - y, stride*_DOUBLESIZE, npts, - z, stride*_DOUBLESIZE, npts, - NULL, 0, 0, - ) - - cdef int errno = proj_errno(pj_trans.projpj) - if errno: - raise ProjError("proj_trans_generic error: {}".format( - proj_errno_string(errno))) - - if radians and is_geographic(p2): - for i from 0 <= i < npts: - j = stride*i - coords[j] *= _DG2RAD - coords[j+1] *= _DG2RAD diff --git a/pyproj/_transformer.pxd b/pyproj/_transformer.pxd new file mode 100644 index 000000000..b84a22a96 --- /dev/null +++ b/pyproj/_transformer.pxd @@ -0,0 +1,7 @@ +include "proj.pxi" + +cdef class _Transformer: + cdef PJ * projpj + cdef PJ_CONTEXT * projctx + cdef public object from_geographic + cdef public object to_geographic \ No newline at end of file diff --git a/pyproj/_transformer.pyx b/pyproj/_transformer.pyx new file mode 100644 index 000000000..1b457a2ae --- /dev/null +++ b/pyproj/_transformer.pyx @@ -0,0 +1,205 @@ +include "base.pxi" + +from pyproj.crs import CRS +from pyproj.proj import Proj +from pyproj.compat import cstrencode, pystrdecode +from pyproj.datadir import get_data_dir +from pyproj.exceptions import ProjError + +cdef class _Transformer: + def __cinit__(self): + self.projpj = NULL + self.projctx = NULL + self.from_geographic = False + self.to_geographic = False + + def __init__(self): + # set up the context + self.projctx = proj_context_create() + py_data_dir = cstrencode(get_data_dir()) + cdef const char* data_dir = py_data_dir + proj_context_set_search_paths(self.projctx, 1, &data_dir) + + def __dealloc__(self): + """destroy projection definition""" + if self.projpj is not NULL: + proj_destroy(self.projpj) + if self.projctx is not NULL: + proj_context_destroy(self.projctx) + + @staticmethod + def _init_crs_to_crs(proj_from, proj_to): + cdef _Transformer transformer = _Transformer() + transformer.projpj = proj_create_crs_to_crs( + transformer.projctx, + _Transformer._definition_from_object(proj_from), + _Transformer._definition_from_object(proj_to), + NULL) + if transformer.projpj is NULL: + raise ProjError("Error creating CRS to CRS.") + transformer.from_geographic = _Transformer._is_geographic(proj_from) + transformer.to_geographic = _Transformer._is_geographic(proj_to) + return transformer + + @staticmethod + def _is_geographic(proj): + if hasattr(proj, "crs"): + return proj.crs.is_geographic + return proj.is_geographic + + @staticmethod + def from_proj(proj_from, proj_to): + if not isinstance(proj_from, Proj): + proj_from = Proj(proj_from) + if not isinstance(proj_to, Proj): + proj_to = Proj(proj_to) + return _Transformer._init_crs_to_crs(proj_from, proj_to) + + @staticmethod + def from_crs(crs_from, crs_to): + if not isinstance(crs_from, CRS): + crs_from = CRS.from_user_input(crs_from) + if not isinstance(crs_to, CRS): + crs_to = CRS.from_user_input(crs_to) + return _Transformer._init_crs_to_crs(crs_from, crs_to) + + @staticmethod + def from_pipeline(const char *proj_pipeline): + cdef _Transformer transformer = _Transformer() + + # initialize projection + transformer.projpj = proj_create(transformer.projctx, proj_pipeline) + if transformer.projpj is NULL: + raise ProjError("Invalid projection {}.".format(proj_pipeline)) + + # disable radians as it should be handled in the pipeline + transformer.from_geographic = False + transformer.to_geographic = False + return transformer + + + + @staticmethod + def _definition_from_object(in_proj): + """ + Parameters + ---------- + in_proj: :obj:`pyproj.Proj` or :obj:`pyproj.CRS` + + Returns + ------- + char*: Definition string for `proj_create_crs_to_crs`. + + """ + if isinstance(in_proj, Proj): + return in_proj.definition + return cstrencode(CRS.from_user_input(in_proj).to_wkt()) + + def _transform(self, inx, iny, inz, radians): + # private function to call pj_transform + cdef void *xdata + cdef void *ydata + cdef void *zdata + cdef double *xx + cdef double *yy + cdef double *zz + cdef Py_ssize_t buflenx, bufleny, buflenz, npts, i + cdef int err + if PyObject_AsWriteBuffer(inx, &xdata, &buflenx) <> 0: + raise ProjError + if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0: + raise ProjError + if inz is not None: + if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0: + raise ProjError + else: + buflenz = bufleny + if not (buflenx == bufleny == buflenz): + raise ProjError('x,y and z must be same size') + xx = xdata + yy = ydata + if inz is not None: + zz = zdata + else: + zz = NULL + npts = buflenx//8 + + if radians and self.from_geographic: + for i from 0 <= i < npts: + xx[i] = xx[i]*_RAD2DG + yy[i] = yy[i]*_RAD2DG + + proj_trans_generic( + self.projpj, + PJ_FWD, + xx, _DOUBLESIZE, npts, + yy, _DOUBLESIZE, npts, + zz, _DOUBLESIZE, npts, + NULL, 0, 0, + ) + cdef int errno = proj_errno(self.projpj) + if errno: + raise ProjError("proj_trans_generic error: {}".format( + pystrdecode(proj_errno_string(errno)))) + + if radians and self.to_geographic: + for i from 0 <= i < npts: + xx[i] = xx[i]*_DG2RAD + yy[i] = yy[i]*_DG2RAD + + def _transform_sequence(self, Py_ssize_t stride, inseq, bint switch, radians): + # private function to itransform function + cdef: + void *buffer + double *coords + double *x + double *y + double *z + Py_ssize_t buflen, npts, i, j + int err + + if stride < 2: + raise ProjError("coordinates must contain at least 2 values") + if PyObject_AsWriteBuffer(inseq, &buffer, &buflen) <> 0: + raise ProjError("object does not provide the python buffer writeable interface") + + coords = buffer + npts = buflen // (stride * _DOUBLESIZE) + + if radians and self.from_geographic: + for i from 0 <= i < npts: + j = stride*i + coords[j] *= _RAD2DG + coords[j+1] *= _RAD2DG + + if not switch: + x = coords + y = coords + 1 + else: + x = coords + 1 + y = coords + + if stride == 2: + z = NULL + else: + z = coords + 2 + + proj_trans_generic ( + self.projpj, + PJ_FWD, + x, stride*_DOUBLESIZE, npts, + y, stride*_DOUBLESIZE, npts, + z, stride*_DOUBLESIZE, npts, + NULL, 0, 0, + ) + + cdef int errno = proj_errno(self.projpj) + if errno: + raise ProjError("proj_trans_generic error: {}".format( + proj_errno_string(errno))) + + if radians and self.to_geographic: + for i from 0 <= i < npts: + j = stride*i + coords[j] *= _DG2RAD + coords[j+1] *= _DG2RAD diff --git a/pyproj/proj.py b/pyproj/proj.py new file mode 100644 index 000000000..d37b12d5a --- /dev/null +++ b/pyproj/proj.py @@ -0,0 +1,389 @@ +# -*- coding: utf-8 -*- +""" +Cython wrapper to provide python interfaces to +PROJ.4 (https://github.com/OSGeo/proj.4/wiki) functions. + +Performs cartographic transformations and geodetic computations. + +The Proj class can convert from geographic (longitude,latitude) +to native map projection (x,y) coordinates and vice versa, or +from one map projection coordinate system directly to another. +The module variable pj_list is a dictionary containing all the +available projections and their descriptions. + +Input coordinates can be given as python arrays, lists/tuples, +scalars or numpy/Numeric/numarray arrays. Optimized for objects +that support the Python buffer protocol (regular python and +numpy array objects). + +Download: http://python.org/pypi/pyproj + +Contact: Jeffrey Whitaker >> from pyproj import Proj + >>> p = Proj(proj='utm',zone=10,ellps='WGS84', preserve_units=False) # use kwargs + >>> x,y = p(-120.108, 34.36116666) + >>> 'x=%9.3f y=%11.3f' % (x,y) + 'x=765975.641 y=3805993.134' + >>> 'lon=%8.3f lat=%5.3f' % p(x,y,inverse=True) + 'lon=-120.108 lat=34.361' + >>> # do 3 cities at a time in a tuple (Fresno, LA, SF) + >>> lons = (-119.72,-118.40,-122.38) + >>> lats = (36.77, 33.93, 37.62 ) + >>> x,y = p(lons, lats) + >>> 'x: %9.3f %9.3f %9.3f' % x + 'x: 792763.863 925321.537 554714.301' + >>> 'y: %9.3f %9.3f %9.3f' % y + 'y: 4074377.617 3763936.941 4163835.303' + >>> lons, lats = p(x, y, inverse=True) # inverse transform + >>> 'lons: %8.3f %8.3f %8.3f' % lons + 'lons: -119.720 -118.400 -122.380' + >>> 'lats: %8.3f %8.3f %8.3f' % lats + 'lats: 36.770 33.930 37.620' + >>> p2 = Proj('+proj=utm +zone=10 +ellps=WGS84', preserve_units=False) # use proj4 string + >>> x,y = p2(-120.108, 34.36116666) + >>> 'x=%9.3f y=%11.3f' % (x,y) + 'x=765975.641 y=3805993.134' + >>> p = Proj(init="epsg:32667", preserve_units=False) + >>> 'x=%12.3f y=%12.3f (meters)' % p(-114.057222, 51.045) + 'x=-1783506.250 y= 6193827.033 (meters)' + >>> p = Proj("+init=epsg:32667") + >>> 'x=%12.3f y=%12.3f (feet)' % p(-114.057222, 51.045) + 'x=-5851386.754 y=20320914.191 (feet)' + >>> # test data with radian inputs + >>> p1 = Proj(init="epsg:4214") + >>> x1, y1 = p1(116.366, 39.867) + >>> '{:.3f} {:.3f}'.format(x1, y1) + '2.031 0.696' + >>> x2, y2 = p1(x1, y1, inverse=True) + >>> '{:.3f} {:.3f}'.format(x2, y2) + '116.366 39.867' + """ + self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs) + # make sure units are meters if preserve_units is False. + if not preserve_units and self.crs.is_projected: + projstring = self.crs.to_proj4(4) + projstring = re.sub(r"\s\+units=[\w-]+", "", projstring) + projstring += " +units=m" + self.crs = CRS(projstring) + super(Proj, self).__init__( + cstrencode(self.crs.to_proj4().replace("+type=crs", "").strip()) + ) + + def __call__(self, *args, **kw): + # ,lon,lat,inverse=False,errcheck=False): + """ + Calling a Proj class instance with the arguments lon, lat will + convert lon/lat (in degrees) to x/y native map projection + coordinates (in meters). If optional keyword 'inverse' is True + (default is False), the inverse transformation from x/y to + lon/lat is performed. If optional keyword 'errcheck' is True (default is + False) an exception is raised if the transformation is invalid. + If errcheck=False and the transformation is invalid, no + exception is raised and 1.e30 is returned. + + Inputs should be doubles (they will be cast to doubles if they + are not, causing a slight performance hit). + + Works with numpy and regular python array objects, python + sequences and scalars, but is fastest for array objects. + """ + inverse = kw.get("inverse", False) + errcheck = kw.get("errcheck", False) + # if len(args) == 1: + # latlon = np.array(args[0], copy=True, + # order='C', dtype=float, ndmin=2) + # if inverse: + # _proj.Proj._invn(self, latlon, radians=radians, errcheck=errcheck) + # else: + # _proj.Proj._fwdn(self, latlon, radians=radians, errcheck=errcheck) + # return latlon + lon, lat = args + # process inputs, making copies that support buffer API. + inx, xisfloat, xislist, xistuple = _copytobuffer(lon) + iny, yisfloat, yislist, yistuple = _copytobuffer(lat) + # call proj4 functions. inx and iny modified in place. + if inverse: + self._inv(inx, iny, errcheck=errcheck) + else: + self._fwd(inx, iny, errcheck=errcheck) + # if inputs were lists, tuples or floats, convert back. + outx = _convertback(xisfloat, xislist, xistuple, inx) + outy = _convertback(yisfloat, yislist, xistuple, iny) + return outx, outy + + def is_latlong(self): + """ + Returns + ------- + bool: True if projection in geographic (lon/lat) coordinates. + """ + warnings.warn("'is_latlong()' is deprecated. Please use 'crs.is_geographic'.") + return self.crs.is_geographic + + def is_geocent(self): + """ + Returns + ------- + bool: True if projection in geocentric (x/y) coordinates + """ + warnings.warn("'is_geocent()' is deprecated. Please use 'crs.is_geocent'.") + return self.is_geocent + + def definition_string(self): + """Returns formal definition string for projection + + >>> Proj('+init=epsg:4326').definition_string() + 'proj=longlat datum=WGS84 no_defs ellps=WGS84 towgs84=0,0,0' + >>> + """ + return pystrdecode(self.definition) + + def to_latlong_def(self): + """return the definition string of the geographic (lat/lon) + coordinate version of the current projection""" + # This is a little hacky way of getting a latlong proj object + # Maybe instead of this function the __cinit__ function can take a + # Proj object and a type (where type = "geographic") as the libproj + # java wrapper + return self.crs.to_geodetic().to_proj4(4) + + # deprecated : using in transform raised a TypeError in release 1.9.5.1 + # reported in issue #53, resolved in #73. + def to_latlong(self): + """return a new Proj instance which is the geographic (lat/lon) + coordinate version of the current projection""" + return Proj(self.crs.to_geodetic()) diff --git a/pyproj/transformer.py b/pyproj/transformer.py new file mode 100644 index 000000000..38ff1a6ef --- /dev/null +++ b/pyproj/transformer.py @@ -0,0 +1,352 @@ +# -*- coding: utf-8 -*- +""" +The transformer module is for performing cartographic transformations. + +Copyright (c) 2019 pyproj Contributors. + +Permission to use, copy, modify, and distribute this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both the copyright notice and this permission +notice appear in supporting documentation. THE AUTHOR DISCLAIMS +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT +SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.""" + +from array import array +from itertools import chain, islice + +from pyproj._transformer import _Transformer +from pyproj.compat import cstrencode +from pyproj.utils import _convertback, _copytobuffer + +try: + from future_builtins import zip # python 2.6+ +except ImportError: + pass # python 3.x + + +class Transformer(object): + """ + The Transformer class is for facilitating re-using + transforms without needing to re-create them. The goal + is to make repeated transforms faster. + + Additionally, it provides multiple methods for initialization. + """ + + @staticmethod + def from_proj(proj_from, proj_to): + """Make a Transformer from a :obj:`pyproj.Proj` or input used to create one. + + Parameters + ---------- + proj_from: :obj:`pyproj.Proj` or input used to create one + Projection of input data. + proj_from: :obj:`pyproj.Proj` or input used to create one + Projection of output data. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + + transformer = Transformer() + transformer._transformer = _Transformer.from_proj(proj_from, proj_to) + return transformer + + @staticmethod + def from_crs(crs_from, crs_to): + """Make a Transformer from a :obj:`pyproj.CRS` or input used to create one. + + Parameters + ---------- + proj_from: :obj:`pyproj.CRS` or input used to create one + Projection of input data. + proj_from: :obj:`pyproj.CRS` or input used to create one + Projection of output data. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + transformer = Transformer() + transformer._transformer = _Transformer.from_crs(crs_from, crs_to) + return transformer + + @staticmethod + def from_pipeline(proj_pipeline): + """Make a Transformer from a PROJ pipeline string. + + https://proj4.org/operations/pipeline.html + + Parameters + ---------- + proj_pipeline: str + Projection pipeline string. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + transformer = Transformer() + transformer._transformer = _Transformer.from_pipeline(cstrencode(proj_pipeline)) + return transformer + + def transform(self, xx, yy, zz=None, radians=False): + """ + Transform points between two coordinate systems. + + Parameters + ---------- + xx: scalar or array (numpy or python) + Input x coordinate(s). + yy: scalar or array (numpy or python) + Input y coordinate(s). + zz: scalar or array (numpy or python), optional + Input z coordinate(s). + radians: boolean, optional + If True, will expect input data to be in radians and will return radians + if the projection is geographic. Default is False (degrees). + + + Example: + + >>> from pyproj import Transformer + >>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857") + >>> x3, y3 = transformer.transform(33, 98) + >>> "%.3f %.3f" % (x3, y3) + '10909310.098 3895303.963' + >>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg" + >>> pipe_trans = Transformer.from_pipeline(pipeline_str) + >>> xt, yt = pipe_trans.transform(2.1, 0.001) + >>> "%.3f %.3f" % (xt, yt) + '120.321 0.057' + >>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326') + >>> xpj, ypj, zpj = transproj.transform(-2704026.010, -4253051.810, 3895878.820, radians=True) + >>> "%.3f %.3f %.3f" % (xpj, ypj, zpj) + '-2.137 0.661 -20.531' + >>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}) + >>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True) + >>> "%.3f %.3f %.3f" % (xpjr, ypjr, zpjr) + '-2704026.010 -4253051.810 3895878.820' + + """ + # process inputs, making copies that support buffer API. + inx, xisfloat, xislist, xistuple = _copytobuffer(xx) + iny, yisfloat, yislist, yistuple = _copytobuffer(yy) + if zz is not None: + inz, zisfloat, zislist, zistuple = _copytobuffer(zz) + else: + inz = None + # call pj_transform. inx,iny,inz buffers modified in place. + self._transformer._transform(inx, iny, inz, radians) + # if inputs were lists, tuples or floats, convert back. + outx = _convertback(xisfloat, xislist, xistuple, inx) + outy = _convertback(yisfloat, yislist, xistuple, iny) + if inz is not None: + outz = _convertback(zisfloat, zislist, zistuple, inz) + return outx, outy, outz + else: + return outx, outy + + def itransform(self, points, switch=False, radians=False): + """ + Iterator/generator version of the function pyproj.Transformer.transform. + + + Parameters + ---------- + points: list + List of point tuples. + switch: boolean, optional + If True x, y or lon,lat coordinates of points are switched to y, x + or lat, lon. Default is False. + radians: boolean, optional + If True, will expect input data to be in radians and will return radians + if the projection is geographic. Default is False (degrees). + + + Example: + + >>> from pyproj import Transformer + >>> transformer = Transformer.from_crs(4326, 2100) + >>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)] + >>> for pt in transformer.itransform(points): '{:.3f} {:.3f}'.format(*pt) + '2221638.801 2637034.372' + '2212924.125 2619851.898' + '2238294.779 2703763.736' + >>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg" + >>> pipe_trans = Transformer.from_pipeline(pipeline_str) + >>> for pt in pipe_trans.itransform([(2.1, 0.001)]): '{:.3f} {:.3f}'.format(*pt) + '120.321 0.057' + >>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326') + >>> for pt in transproj.itransform([(-2704026.010, -4253051.810, 3895878.820)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt) + '-2.137 0.661 -20.531' + >>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}) + >>> for pt in transprojr.itransform([(-2.137, 0.661, -20.531)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt) + '-2704214.394 -4254414.478 3894270.731' + + """ + it = iter(points) # point iterator + # get first point to check stride + try: + fst_pt = next(it) + except StopIteration: + raise ValueError("iterable must contain at least one point") + + stride = len(fst_pt) + if stride not in (2, 3): + raise ValueError("points can contain up to 3 coordinates") + + # create a coordinate sequence generator etc. x1,y1,z1,x2,y2,z2,.... + # chain so the generator returns the first point that was already acquired + coord_gen = chain(fst_pt, (coords[c] for coords in it for c in range(stride))) + + while True: + # create a temporary buffer storage for the next 64 points (64*stride*8 bytes) + buff = array("d", islice(coord_gen, 0, 64 * stride)) + if len(buff) == 0: + break + + self._transformer._transform_sequence(stride, buff, switch, radians) + + for pt in zip(*([iter(buff)] * stride)): + yield pt + + +def transform(p1, p2, x, y, z=None, radians=False): + """ + x2, y2, z2 = transform(p1, p2, x1, y1, z1) + + Transform points between two coordinate systems defined by the + Proj instances p1 and p2. + + The points x1,y1,z1 in the coordinate system defined by p1 are + transformed to x2,y2,z2 in the coordinate system defined by p2. + + z1 is optional, if it is not set it is assumed to be zero (and + only x2 and y2 are returned). If the optional keyword + 'radians' is True (default is False), then all input and + output coordinates will be in radians instead of the default + of degrees for geographic input/output projections. + + In addition to converting between cartographic and geographic + projection coordinates, this function can take care of datum + shifts (which cannot be done using the __call__ method of the + Proj instances). It also allows for one of the coordinate + systems to be geographic (proj = 'latlong'). + + x,y and z can be numpy or regular python arrays, python + lists/tuples or scalars. Arrays are fastest. For projections in + geocentric coordinates, values of x and y are given in meters. + z is always meters. + + Example usage: + + >>> from pyproj import Proj, transform + >>> # projection 1: UTM zone 15, grs80 ellipse, NAD83 datum + >>> # (defined by epsg code 26915) + >>> p1 = Proj(init='epsg:26915', preserve_units=False) + >>> # projection 2: UTM zone 15, clrk66 ellipse, NAD27 datum + >>> p2 = Proj(init='epsg:26715', preserve_units=False) + >>> # find x,y of Jefferson City, MO. + >>> x1, y1 = p1(-92.199881,38.56694) + >>> # transform this point to projection 2 coordinates. + >>> x2, y2 = transform(p1,p2,x1,y1) + >>> '%9.3f %11.3f' % (x1,y1) + '569704.566 4269024.671' + >>> '%9.3f %11.3f' % (x2,y2) + '569722.342 4268814.028' + >>> '%8.3f %5.3f' % p2(x2,y2,inverse=True) + ' -92.200 38.567' + >>> # process 3 points at a time in a tuple + >>> lats = (38.83,39.32,38.75) # Columbia, KC and StL Missouri + >>> lons = (-92.22,-94.72,-90.37) + >>> x1, y1 = p1(lons,lats) + >>> x2, y2 = transform(p1,p2,x1,y1) + >>> xy = x1+y1 + >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy + '567703.344 351730.944 728553.093 4298200.739 4353698.725 4292319.005' + >>> xy = x2+y2 + >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy + '567721.149 351747.558 728569.133 4297989.112 4353489.645 4292106.305' + >>> lons, lats = p2(x2,y2,inverse=True) + >>> xy = lons+lats + >>> '%8.3f %8.3f %8.3f %5.3f %5.3f %5.3f' % xy + ' -92.220 -94.720 -90.370 38.830 39.320 38.750' + >>> # test datum shifting, installation of extra datum grid files. + >>> p1 = Proj(proj='latlong',datum='WGS84') + >>> x1 = -111.5; y1 = 45.25919444444 + >>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False) + >>> x2, y2 = transform(p1, p2, x1, y1) + >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) + '1402285.9 5076292.4' + >>> from pyproj import CRS + >>> c1 = CRS(proj='latlong',datum='WGS84') + >>> x1 = -111.5; y1 = 45.25919444444 + >>> c2 = CRS(proj="utm",zone=10,datum='NAD27') + >>> x2, y2 = transform(c1, c2, x1, y1) + >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) + '1402285.9 5076292.4' + >>> pj = Proj(init="epsg:4214") + >>> pjx, pjy = pj(116.366, 39.867) + >>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True) + >>> "%.3f %.3f" % (xr, yr) + '2.031 0.696' + """ + return Transformer.from_proj(p1, p2).transform(x, y, z, radians) + + +def itransform(p1, p2, points, switch=False, radians=False): + """ + points2 = itransform(p1, p2, points1) + Iterator/generator version of the function pyproj.transform. + Transform points between two coordinate systems defined by the + Proj instances p1 and p2. This function can be used as an alternative + to pyproj.transform when there is a need to transform a big number of + coordinates lazily, for example when reading and processing from a file. + Points1 is an iterable/generator of coordinates x1,y1(,z1) or lon1,lat1(,z1) + in the coordinate system defined by p1. Points2 is an iterator that returns tuples + of x2,y2(,z2) or lon2,lat2(,z2) coordinates in the coordinate system defined by p2. + z are provided optionally. + + Points1 can be: + - a tuple/list of tuples/lists i.e. for 2d points: [(xi,yi),(xj,yj),....(xn,yn)] + - a Nx3 or Nx2 2d numpy array where N is the point number + - a generator of coordinates (xi,yi) for 2d points or (xi,yi,zi) for 3d + + If optional keyword 'switch' is True (default is False) then x, y or lon,lat coordinates + of points are switched to y, x or lat, lon. If the optional keyword 'radians' is True + (default is False), then all input and output coordinates will be in radians instead + of the default of degrees for geographic input/output projections. + + + Example usage: + + >>> from pyproj import Proj, itransform + >>> # projection 1: WGS84 + >>> # (defined by epsg code 4326) + >>> p1 = Proj(init='epsg:4326', preserve_units=False) + >>> # projection 2: GGRS87 / Greek Grid + >>> p2 = Proj(init='epsg:2100', preserve_units=False) + >>> # Three points with coordinates lon, lat in p1 + >>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)] + >>> # transform this point to projection 2 coordinates. + >>> for pt in itransform(p1,p2,points): '%6.3f %7.3f' % pt + '411200.657 4498214.742' + '399210.500 4487264.963' + '458703.102 4523331.451' + >>> pj = Proj(init="epsg:4214") + >>> pjx, pjy = pj(116.366, 39.867) + >>> for pt in itransform(pj, Proj(4326), [(pjx, pjy)], radians=True): '{:.3f} {:.3f}'.format(*pt) + '2.031 0.696' + """ + return Transformer.from_proj(p1, p2).itransform(points, switch, radians) diff --git a/setup.py b/setup.py index c4bf6a82c..88e36ec70 100644 --- a/setup.py +++ b/setup.py @@ -81,7 +81,6 @@ def check_proj_version(proj_dir): cythonize_options["compiler_directives"] = {"linetrace": True} cythonize_options["annotate"] = True - proj_libdir = os.environ.get("PROJ_LIBDIR") libdirs = [] if proj_libdir is None: @@ -102,7 +101,6 @@ def check_proj_version(proj_dir): ): package_data["pyproj"].append(os.path.join(BASE_INTERNAL_PROJ_DIR, "lib", "*")) - proj_incdir = os.environ.get("PROJ_INCDIR") incdirs = [] if proj_incdir is None: @@ -135,6 +133,9 @@ def check_proj_version(proj_dir): Extension("pyproj._proj", ["pyproj/_proj.pyx"], **ext_options), Extension("pyproj._geod", ["pyproj/_geod.pyx"], **ext_options), Extension("pyproj._crs", ["pyproj/_crs.pyx"], **ext_options), + Extension( + "pyproj._transformer", ["pyproj/_transformer.pyx"], **ext_options + ), ], quiet=True, **cythonize_options diff --git a/sphinx/api/index.rst b/sphinx/api/index.rst index 77803db1e..97c221a40 100644 --- a/sphinx/api/index.rst +++ b/sphinx/api/index.rst @@ -8,4 +8,5 @@ API Documentation proj crs geod + transformer datadir diff --git a/sphinx/api/proj.rst b/sphinx/api/proj.rst index ffc7975a5..3a2b85e96 100644 --- a/sphinx/api/proj.rst +++ b/sphinx/api/proj.rst @@ -5,19 +5,8 @@ Proj pyproj.Proj ----------- -.. autoclass:: pyproj.Proj +.. autoclass:: pyproj.proj.Proj :members: :inherited-members: :special-members: __init__, __call__ :show-inheritance: - -pyproj.transform ----------------- - -.. autofunction:: pyproj.transform - - -pyproj.itransform ------------------ - -.. autofunction:: pyproj.itransform diff --git a/sphinx/api/transformer.rst b/sphinx/api/transformer.rst new file mode 100644 index 000000000..cf80d3619 --- /dev/null +++ b/sphinx/api/transformer.rst @@ -0,0 +1,19 @@ +Transformer +=========== + +pyproj.Transformer +------------------ + +.. autoclass:: pyproj.transformer.Transformer + :members: + +pyproj.transform +---------------- + +.. autofunction:: pyproj.transformer.transform + + +pyproj.itransform +----------------- + +.. autofunction:: pyproj.transformer.itransform \ No newline at end of file From 044f8facc90fbc7a2ba0c054b56d4a31de807004 Mon Sep 17 00:00:00 2001 From: snowman2 Date: Wed, 13 Mar 2019 16:35:58 -0500 Subject: [PATCH 2/4] fix for issue #191 --- pyproj/_transformer.pyx | 6 ++---- pyproj/transformer.py | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pyproj/_transformer.pyx b/pyproj/_transformer.pyx index 1b457a2ae..17289b952 100644 --- a/pyproj/_transformer.pyx +++ b/pyproj/_transformer.pyx @@ -77,8 +77,6 @@ cdef class _Transformer: transformer.to_geographic = False return transformer - - @staticmethod def _definition_from_object(in_proj): """ @@ -92,8 +90,8 @@ cdef class _Transformer: """ if isinstance(in_proj, Proj): - return in_proj.definition - return cstrencode(CRS.from_user_input(in_proj).to_wkt()) + return cstrencode(in_proj.srs) + return cstrencode(in_proj.to_wkt()) def _transform(self, inx, iny, inz, radians): # private function to call pj_transform diff --git a/pyproj/transformer.py b/pyproj/transformer.py index 38ff1a6ef..574f30897 100644 --- a/pyproj/transformer.py +++ b/pyproj/transformer.py @@ -288,14 +288,14 @@ def transform(p1, p2, x, y, z=None, radians=False): >>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False) >>> x2, y2 = transform(p1, p2, x1, y1) >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) - '1402285.9 5076292.4' + '1402291.0 5076289.5' >>> from pyproj import CRS >>> c1 = CRS(proj='latlong',datum='WGS84') >>> x1 = -111.5; y1 = 45.25919444444 >>> c2 = CRS(proj="utm",zone=10,datum='NAD27') >>> x2, y2 = transform(c1, c2, x1, y1) >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) - '1402285.9 5076292.4' + '1402291.0 5076289.5' >>> pj = Proj(init="epsg:4214") >>> pjx, pjy = pj(116.366, 39.867) >>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True) From b849f619f8b7217bc2388abfbfb8bfbab91a489e Mon Sep 17 00:00:00 2001 From: snowman2 Date: Wed, 13 Mar 2019 19:12:35 -0500 Subject: [PATCH 3/4] bump version 2.1.0 & update history.rst --- pyproj/__init__.py | 2 +- sphinx/history.rst | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproj/__init__.py b/pyproj/__init__.py index bd6db6f56..6a776e980 100644 --- a/pyproj/__init__.py +++ b/pyproj/__init__.py @@ -47,7 +47,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -__version__ = "2.0.2" +__version__ = "2.1.0" __all__ = [ "Proj", "Geod", diff --git a/sphinx/history.rst b/sphinx/history.rst index 9aa8e7ab4..8a781ad90 100644 --- a/sphinx/history.rst +++ b/sphinx/history.rst @@ -1,5 +1,12 @@ Change Log ========== + +2.1.0 +~~~~~ +* Added :class:`pyproj.Transformer` to make repetitive transformations more efficient (#187) +* Added fix for using local datumgrids with transform (issue #191) +* Added :class:`pyproj.Transformer.from_pipeline` to support pipeline transformations. + 2.0.2 ~~~~~ * add filter for boolean values in dict2string so "no_rot=True" works (issue #183). From ef4b227d17fea8c096dc784f3bfdfa403e69e094 Mon Sep 17 00:00:00 2001 From: snowman2 Date: Wed, 13 Mar 2019 19:13:14 -0500 Subject: [PATCH 4/4] rebuild docs --- docs/html/.buildinfo | 2 +- docs/html/_modules/index.html | 18 +- docs/html/_modules/pyproj.html | 16 +- docs/html/_modules/pyproj/crs.html | 16 +- docs/html/_modules/pyproj/datadir.html | 16 +- docs/html/_modules/pyproj/geod.html | 16 +- docs/html/_modules/pyproj/proj.html | 466 +++++++++++++++++++++ docs/html/_modules/pyproj/transformer.html | 429 +++++++++++++++++++ docs/html/_sources/api/index.rst.txt | 1 + docs/html/_sources/api/proj.rst.txt | 13 +- docs/html/_sources/api/transformer.rst.txt | 19 + docs/html/_sources/history.rst.txt | 7 + docs/html/_static/basic.css | 74 +--- docs/html/_static/doctools.js | 5 +- docs/html/_static/documentation_options.js | 4 +- docs/html/_static/language_data.js | 297 +++++++++++++ docs/html/_static/searchtools.js | 54 +-- docs/html/_static/websupport.js | 2 +- docs/html/api/crs.html | 207 ++++----- docs/html/api/datadir.html | 63 +-- docs/html/api/geod.html | 26 +- docs/html/api/index.html | 24 +- docs/html/api/proj.html | 245 +++-------- docs/html/api/transformer.html | 407 ++++++++++++++++++ docs/html/genindex.html | 60 ++- docs/html/history.html | 243 ++++++----- docs/html/index.html | 22 +- docs/html/installation.html | 50 ++- docs/html/objects.inv | Bin 646 -> 712 bytes docs/html/search.html | 20 +- docs/html/searchindex.js | 2 +- 31 files changed, 2168 insertions(+), 656 deletions(-) create mode 100644 docs/html/_modules/pyproj/proj.html create mode 100644 docs/html/_modules/pyproj/transformer.html create mode 100644 docs/html/_sources/api/transformer.rst.txt create mode 100644 docs/html/_static/language_data.js create mode 100644 docs/html/api/transformer.html diff --git a/docs/html/.buildinfo b/docs/html/.buildinfo index dff2e3866..dc7b5656c 100644 --- a/docs/html/.buildinfo +++ b/docs/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 90a86dd0a8003157f7c0b4ae04c7e28d +config: dc4c6dd9056e51120300fe2569b099d4 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/html/_modules/index.html b/docs/html/_modules/index.html index 8ed796187..a1a6325c9 100644 --- a/docs/html/_modules/index.html +++ b/docs/html/_modules/index.html @@ -1,10 +1,12 @@ - + - - Overview: module code — pyproj 2.0.2 documentation + + + Overview: module code — pyproj 2.1.0 documentation @@ -21,7 +23,7 @@

Navigation

  • index
  • - + @@ -36,6 +38,8 @@

    All modules for which code is available

  • pyproj.crs
  • pyproj.datadir
  • pyproj.geod
  • +
  • pyproj.proj
  • +
  • pyproj.transformer
  • @@ -49,6 +53,8 @@

    Quick search

    @@ -63,12 +69,12 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/_modules/pyproj.html b/docs/html/_modules/pyproj.html index 44384c7cb..80e1a7f69 100644 --- a/docs/html/_modules/pyproj.html +++ b/docs/html/_modules/pyproj.html @@ -1,10 +1,12 @@ - + - - pyproj — pyproj 2.0.2 documentation + + + pyproj — pyproj 2.1.0 documentation @@ -21,7 +23,7 @@

    Navigation

  • index
  • - + @@ -664,6 +666,8 @@

    Quick search

    @@ -678,13 +682,13 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/_modules/pyproj/crs.html b/docs/html/_modules/pyproj/crs.html index 4aeb54aa9..f74b2172c 100644 --- a/docs/html/_modules/pyproj/crs.html +++ b/docs/html/_modules/pyproj/crs.html @@ -1,10 +1,12 @@ - + - - pyproj.crs — pyproj 2.0.2 documentation + + + pyproj.crs — pyproj 2.1.0 documentation @@ -21,7 +23,7 @@

    Navigation

  • index
  • - + @@ -326,6 +328,8 @@

    Quick search

    @@ -340,14 +344,14 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/_modules/pyproj/datadir.html b/docs/html/_modules/pyproj/datadir.html index f2c01efc3..f1aa39a18 100644 --- a/docs/html/_modules/pyproj/datadir.html +++ b/docs/html/_modules/pyproj/datadir.html @@ -1,10 +1,12 @@ - + - - pyproj.datadir — pyproj 2.0.2 documentation + + + pyproj.datadir — pyproj 2.1.0 documentation @@ -21,7 +23,7 @@

    Navigation

  • index
  • - + @@ -112,6 +114,8 @@

    Quick search

    @@ -126,14 +130,14 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/_modules/pyproj/geod.html b/docs/html/_modules/pyproj/geod.html index 3525715ec..53d49fe3f 100644 --- a/docs/html/_modules/pyproj/geod.html +++ b/docs/html/_modules/pyproj/geod.html @@ -1,10 +1,12 @@ - + - - pyproj.geod — pyproj 2.0.2 documentation + + + pyproj.geod — pyproj 2.1.0 documentation @@ -21,7 +23,7 @@

    Navigation

  • index
  • - + @@ -499,6 +501,8 @@

    Quick search

    @@ -513,14 +517,14 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/_modules/pyproj/proj.html b/docs/html/_modules/pyproj/proj.html new file mode 100644 index 000000000..e0890eae2 --- /dev/null +++ b/docs/html/_modules/pyproj/proj.html @@ -0,0 +1,466 @@ + + + + + + + + pyproj.proj — pyproj 2.1.0 documentation + + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for pyproj.proj

    +# -*- coding: utf-8 -*-
    +"""
    +Cython wrapper to provide python interfaces to
    +PROJ.4 (https://github.com/OSGeo/proj.4/wiki) functions.
    +
    +Performs cartographic transformations and geodetic computations.
    +
    +The Proj class can convert from geographic (longitude,latitude)
    +to native map projection (x,y) coordinates and vice versa, or
    +from one map projection coordinate system directly to another.
    +The module variable pj_list is a dictionary containing all the
    +available projections and their descriptions.
    +
    +Input coordinates can be given as python arrays, lists/tuples,
    +scalars or numpy/Numeric/numarray arrays. Optimized for objects
    +that support the Python buffer protocol (regular python and
    +numpy array objects).
    +
    +Download: http://python.org/pypi/pyproj
    +
    +Contact:  Jeffrey Whitaker <jeffrey.s.whitaker@noaa.gov
    +
    +copyright (c) 2006 by Jeffrey Whitaker.
    +
    +Permission to use, copy, modify, and distribute this software
    +and its documentation for any purpose and without fee is hereby
    +granted, provided that the above copyright notice appear in all
    +copies and that both the copyright notice and this permission
    +notice appear in supporting documentation. THE AUTHOR DISCLAIMS
    +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
    +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
    +SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
    +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """
    +import re
    +import warnings
    +
    +from pyproj import _proj
    +from pyproj.compat import cstrencode, pystrdecode
    +from pyproj.crs import CRS
    +from pyproj.utils import _convertback, _copytobuffer
    +
    +# import numpy as np
    +proj_version_str = _proj.proj_version_str
    +
    +pj_list = {
    +    "aea": "Albers Equal Area",
    +    "aeqd": "Azimuthal Equidistant",
    +    "affine": "Affine transformation",
    +    "airy": "Airy",
    +    "aitoff": "Aitoff",
    +    "alsk": "Mod. Stererographics of Alaska",
    +    "apian": "Apian Globular I",
    +    "august": "August Epicycloidal",
    +    "bacon": "Bacon Globular",
    +    "bertin1953": "Bertin 1953",
    +    "bipc": "Bipolar conic of western hemisphere",
    +    "boggs": "Boggs Eumorphic",
    +    "bonne": "Bonne (Werner lat_1=90)",
    +    "calcofi": "Cal Coop Ocean Fish Invest Lines/Stations",
    +    "cart": "Geodetic/cartesian conversions",
    +    "cass": "Cassini",
    +    "cc": "Central Cylindrical",
    +    "ccon": "Central Conic",
    +    "cea": "Equal Area Cylindrical",
    +    "chamb": "Chamberlin Trimetric",
    +    "collg": "Collignon",
    +    "comill": "Compact Miller",
    +    "crast": "Craster Parabolic (Putnins P4)",
    +    "deformation": "Kinematic grid shift",
    +    "denoy": "Denoyer Semi-Elliptical",
    +    "eck1": "Eckert I",
    +    "eck2": "Eckert II",
    +    "eck3": "Eckert III",
    +    "eck4": "Eckert IV",
    +    "eck5": "Eckert V",
    +    "eck6": "Eckert VI",
    +    "eqc": "Equidistant Cylindrical (Plate Caree)",
    +    "eqdc": "Equidistant Conic",
    +    "euler": "Euler",
    +    "etmerc": "Extended Transverse Mercator",
    +    "fahey": "Fahey",
    +    "fouc": "Foucaut",
    +    "fouc_s": "Foucaut Sinusoidal",
    +    "gall": "Gall (Gall Stereographic)",
    +    "geoc": "Geocentric Latitude",
    +    "geocent": "Geocentric",
    +    "geogoffset": "Geographic Offset",
    +    "geos": "Geostationary Satellite View",
    +    "gins8": "Ginsburg VIII (TsNIIGAiK)",
    +    "gn_sinu": "General Sinusoidal Series",
    +    "gnom": "Gnomonic",
    +    "goode": "Goode Homolosine",
    +    "gs48": "Mod. Stererographics of 48 U.S.",
    +    "gs50": "Mod. Stererographics of 50 U.S.",
    +    "hammer": "Hammer & Eckert-Greifendorff",
    +    "hatano": "Hatano Asymmetrical Equal Area",
    +    "healpix": "HEALPix",
    +    "rhealpix": "rHEALPix",
    +    "helmert": "3- and 7-parameter Helmert shift",
    +    "hgridshift": "Horizontal grid shift",
    +    "horner": "Horner polynomial evaluation",
    +    "igh": "Interrupted Goode Homolosine",
    +    "imw_p": "International Map of the World Polyconic",
    +    "isea": "Icosahedral Snyder Equal Area",
    +    "kav5": "Kavraisky V",
    +    "kav7": "Kavraisky VII",
    +    "krovak": "Krovak",
    +    "labrd": "Laborde",
    +    "laea": "Lambert Azimuthal Equal Area",
    +    "lagrng": "Lagrange",
    +    "larr": "Larrivee",
    +    "lask": "Laskowski",
    +    "lonlat": "Lat/long (Geodetic)",
    +    "latlon": "Lat/long (Geodetic alias)",
    +    "latlong": "Lat/long (Geodetic alias)",
    +    "longlat": "Lat/long (Geodetic alias)",
    +    "lcc": "Lambert Conformal Conic",
    +    "lcca": "Lambert Conformal Conic Alternative",
    +    "leac": "Lambert Equal Area Conic",
    +    "lee_os": "Lee Oblated Stereographic",
    +    "loxim": "Loximuthal",
    +    "lsat": "Space oblique for LANDSAT",
    +    "mbt_s": "McBryde-Thomas Flat-Polar Sine",
    +    "mbt_fps": "McBryde-Thomas Flat-Pole Sine (No. 2)",
    +    "mbtfpp": "McBride-Thomas Flat-Polar Parabolic",
    +    "mbtfpq": "McBryde-Thomas Flat-Polar Quartic",
    +    "mbtfps": "McBryde-Thomas Flat-Polar Sinusoidal",
    +    "merc": "Mercator",
    +    "mil_os": "Miller Oblated Stereographic",
    +    "mill": "Miller Cylindrical",
    +    "misrsom": "Space oblique for MISR",
    +    "moll": "Mollweide",
    +    "molobadekas": "Molodensky-Badekas transform",
    +    "molodensky": "Molodensky transform",
    +    "murd1": "Murdoch I",
    +    "murd2": "Murdoch II",
    +    "murd3": "Murdoch III",
    +    "natearth": "Natural Earth",
    +    "natearth2": "Natural Earth 2",
    +    "nell": "Nell",
    +    "nell_h": "Nell-Hammer",
    +    "nicol": "Nicolosi Globular",
    +    "nsper": "Near-sided perspective",
    +    "nzmg": "New Zealand Map Grid",
    +    "ob_tran": "General Oblique Transformation",
    +    "ocea": "Oblique Cylindrical Equal Area",
    +    "oea": "Oblated Equal Area",
    +    "omerc": "Oblique Mercator",
    +    "ortel": "Ortelius Oval",
    +    "ortho": "Orthographic",
    +    "patterson": "Patterson Cylindrical",
    +    "pconic": "Perspective Conic",
    +    "pipeline": "Transformation pipeline manager",
    +    "poly": "Polyconic (American)",
    +    "pop": "Retrieve coordinate value from pipeline stack",
    +    "putp1": "Putnins P1",
    +    "putp2": "Putnins P2",
    +    "putp3": "Putnins P3",
    +    "putp3p": "Putnins P3'",
    +    "putp4p": "Putnins P4'",
    +    "putp5": "Putnins P5",
    +    "putp5p": "Putnins P5'",
    +    "putp6": "Putnins P6",
    +    "putp6p": "Putnins P6'",
    +    "qua_aut": "Quartic Authalic",
    +    "robin": "Robinson",
    +    "rouss": "Roussilhe Stereographic",
    +    "rpoly": "Rectangular Polyconic",
    +    "sch": "Spherical Cross-track Height",
    +    "sinu": "Sinusoidal (Sanson-Flamsteed)",
    +    "somerc": "Swiss. Obl. Mercator",
    +    "stere": "Stereographic",
    +    "sterea": "Oblique Stereographic Alternative",
    +    "gstmerc": "Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)",
    +    "tcc": "Transverse Central Cylindrical",
    +    "tcea": "Transverse Cylindrical Equal Area",
    +    "times": "Times",
    +    "tissot": "Tissot Conic",
    +    "tmerc": "Transverse Mercator",
    +    "tpeqd": "Two Point Equidistant",
    +    "tpers": "Tilted perspective",
    +    "ups": "Universal Polar Stereographic",
    +    "urm5": "Urmaev V",
    +    "urmfps": "Urmaev Flat-Polar Sinusoidal",
    +    "utm": "Universal Transverse Mercator (UTM)",
    +    "vandg": "van der Grinten (I)",
    +    "vandg2": "van der Grinten II",
    +    "vandg3": "van der Grinten III",
    +    "vandg4": "van der Grinten IV",
    +    "vitk1": "Vitkovsky I",
    +    "wag1": "Wagner I (Kavraisky VI)",
    +    "wag2": "Wagner II",
    +    "wag3": "Wagner III",
    +    "wag4": "Wagner IV",
    +    "wag5": "Wagner V",
    +    "wag6": "Wagner VI",
    +    "wag7": "Wagner VII",
    +    "webmerc": "Web Mercator / Pseudo Mercator",
    +    "weren": "Werenskiold I",
    +    "wink1": "Winkel I",
    +    "wink2": "Winkel II",
    +    "wintri": "Winkel Tripel",
    +}
    +
    +
    +
    [docs]class Proj(_proj.Proj): + """ + performs cartographic transformations (converts from + longitude,latitude to native map projection x,y coordinates and + vice versa) using proj (https://github.com/OSGeo/proj.4/wiki). + + A Proj class instance is initialized with proj map projection + control parameter key/value pairs. The key/value pairs can + either be passed in a dictionary, or as keyword arguments, + or as a proj4 string (compatible with the proj command). See + http://www.remotesensing.org/geotiff/proj_list for examples of + key/value pairs defining different map projections. + + Calling a Proj class instance with the arguments lon, lat will + convert lon/lat (in degrees) to x/y native map projection + coordinates (in meters). If optional keyword 'inverse' is True + (default is False), the inverse transformation from x/y to + lon/lat is performed. If optional keyword 'errcheck' is True (default is + False) an exception is raised if the transformation is invalid. + If errcheck=False and the transformation is invalid, no + exception is raised and 1.e30 is returned. If the optional keyword + 'preserve_units' is True, the units in map projection coordinates + are not forced to be meters. + + Works with numpy and regular python array objects, python + sequences and scalars. + """ + +
    [docs] def __init__(self, projparams=None, preserve_units=True, **kwargs): + """ + initialize a Proj class instance. + + See the proj documentation (https://github.com/OSGeo/proj.4/wiki) + for more information about projection parameters. + + Parameters + ---------- + projparams: int, str, dict, pyproj.CRS + A proj.4 or WKT string, proj.4 dict, EPSG integer, or a pyproj.CRS instnace. + preserve_units: bool + If false, will ensure +units=m. + **kwargs: + proj.4 projection parameters. + + + Example usage: + + >>> from pyproj import Proj + >>> p = Proj(proj='utm',zone=10,ellps='WGS84', preserve_units=False) # use kwargs + >>> x,y = p(-120.108, 34.36116666) + >>> 'x=%9.3f y=%11.3f' % (x,y) + 'x=765975.641 y=3805993.134' + >>> 'lon=%8.3f lat=%5.3f' % p(x,y,inverse=True) + 'lon=-120.108 lat=34.361' + >>> # do 3 cities at a time in a tuple (Fresno, LA, SF) + >>> lons = (-119.72,-118.40,-122.38) + >>> lats = (36.77, 33.93, 37.62 ) + >>> x,y = p(lons, lats) + >>> 'x: %9.3f %9.3f %9.3f' % x + 'x: 792763.863 925321.537 554714.301' + >>> 'y: %9.3f %9.3f %9.3f' % y + 'y: 4074377.617 3763936.941 4163835.303' + >>> lons, lats = p(x, y, inverse=True) # inverse transform + >>> 'lons: %8.3f %8.3f %8.3f' % lons + 'lons: -119.720 -118.400 -122.380' + >>> 'lats: %8.3f %8.3f %8.3f' % lats + 'lats: 36.770 33.930 37.620' + >>> p2 = Proj('+proj=utm +zone=10 +ellps=WGS84', preserve_units=False) # use proj4 string + >>> x,y = p2(-120.108, 34.36116666) + >>> 'x=%9.3f y=%11.3f' % (x,y) + 'x=765975.641 y=3805993.134' + >>> p = Proj(init="epsg:32667", preserve_units=False) + >>> 'x=%12.3f y=%12.3f (meters)' % p(-114.057222, 51.045) + 'x=-1783506.250 y= 6193827.033 (meters)' + >>> p = Proj("+init=epsg:32667") + >>> 'x=%12.3f y=%12.3f (feet)' % p(-114.057222, 51.045) + 'x=-5851386.754 y=20320914.191 (feet)' + >>> # test data with radian inputs + >>> p1 = Proj(init="epsg:4214") + >>> x1, y1 = p1(116.366, 39.867) + >>> '{:.3f} {:.3f}'.format(x1, y1) + '2.031 0.696' + >>> x2, y2 = p1(x1, y1, inverse=True) + >>> '{:.3f} {:.3f}'.format(x2, y2) + '116.366 39.867' + """ + self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs) + # make sure units are meters if preserve_units is False. + if not preserve_units and self.crs.is_projected: + projstring = self.crs.to_proj4(4) + projstring = re.sub(r"\s\+units=[\w-]+", "", projstring) + projstring += " +units=m" + self.crs = CRS(projstring) + super(Proj, self).__init__( + cstrencode(self.crs.to_proj4().replace("+type=crs", "").strip()) + )
    + +
    [docs] def __call__(self, *args, **kw): + # ,lon,lat,inverse=False,errcheck=False): + """ + Calling a Proj class instance with the arguments lon, lat will + convert lon/lat (in degrees) to x/y native map projection + coordinates (in meters). If optional keyword 'inverse' is True + (default is False), the inverse transformation from x/y to + lon/lat is performed. If optional keyword 'errcheck' is True (default is + False) an exception is raised if the transformation is invalid. + If errcheck=False and the transformation is invalid, no + exception is raised and 1.e30 is returned. + + Inputs should be doubles (they will be cast to doubles if they + are not, causing a slight performance hit). + + Works with numpy and regular python array objects, python + sequences and scalars, but is fastest for array objects. + """ + inverse = kw.get("inverse", False) + errcheck = kw.get("errcheck", False) + # if len(args) == 1: + # latlon = np.array(args[0], copy=True, + # order='C', dtype=float, ndmin=2) + # if inverse: + # _proj.Proj._invn(self, latlon, radians=radians, errcheck=errcheck) + # else: + # _proj.Proj._fwdn(self, latlon, radians=radians, errcheck=errcheck) + # return latlon + lon, lat = args + # process inputs, making copies that support buffer API. + inx, xisfloat, xislist, xistuple = _copytobuffer(lon) + iny, yisfloat, yislist, yistuple = _copytobuffer(lat) + # call proj4 functions. inx and iny modified in place. + if inverse: + self._inv(inx, iny, errcheck=errcheck) + else: + self._fwd(inx, iny, errcheck=errcheck) + # if inputs were lists, tuples or floats, convert back. + outx = _convertback(xisfloat, xislist, xistuple, inx) + outy = _convertback(yisfloat, yislist, xistuple, iny) + return outx, outy
    + +
    [docs] def is_latlong(self): + """ + Returns + ------- + bool: True if projection in geographic (lon/lat) coordinates. + """ + warnings.warn("'is_latlong()' is deprecated. Please use 'crs.is_geographic'.") + return self.crs.is_geographic
    + +
    [docs] def is_geocent(self): + """ + Returns + ------- + bool: True if projection in geocentric (x/y) coordinates + """ + warnings.warn("'is_geocent()' is deprecated. Please use 'crs.is_geocent'.") + return self.is_geocent
    + +
    [docs] def definition_string(self): + """Returns formal definition string for projection + + >>> Proj('+init=epsg:4326').definition_string() + 'proj=longlat datum=WGS84 no_defs ellps=WGS84 towgs84=0,0,0' + >>> + """ + return pystrdecode(self.definition)
    + +
    [docs] def to_latlong_def(self): + """return the definition string of the geographic (lat/lon) + coordinate version of the current projection""" + # This is a little hacky way of getting a latlong proj object + # Maybe instead of this function the __cinit__ function can take a + # Proj object and a type (where type = "geographic") as the libproj + # java wrapper + return self.crs.to_geodetic().to_proj4(4)
    + + # deprecated : using in transform raised a TypeError in release 1.9.5.1 + # reported in issue #53, resolved in #73. +
    [docs] def to_latlong(self): + """return a new Proj instance which is the geographic (lat/lon) + coordinate version of the current projection""" + return Proj(self.crs.to_geodetic())
    +
    + +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/html/_modules/pyproj/transformer.html b/docs/html/_modules/pyproj/transformer.html new file mode 100644 index 000000000..34eeb42a6 --- /dev/null +++ b/docs/html/_modules/pyproj/transformer.html @@ -0,0 +1,429 @@ + + + + + + + + pyproj.transformer — pyproj 2.1.0 documentation + + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for pyproj.transformer

    +# -*- coding: utf-8 -*-
    +"""
    +The transformer module is for performing cartographic transformations.
    +
    +Copyright (c) 2019 pyproj Contributors.
    +
    +Permission to use, copy, modify, and distribute this software
    +and its documentation for any purpose and without fee is hereby
    +granted, provided that the above copyright notice appear in all
    +copies and that both the copyright notice and this permission
    +notice appear in supporting documentation. THE AUTHOR DISCLAIMS
    +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
    +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
    +SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
    +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
    +
    +from array import array
    +from itertools import chain, islice
    +
    +from pyproj._transformer import _Transformer
    +from pyproj.compat import cstrencode
    +from pyproj.utils import _convertback, _copytobuffer
    +
    +try:
    +    from future_builtins import zip  # python 2.6+
    +except ImportError:
    +    pass  # python 3.x
    +
    +
    +
    [docs]class Transformer(object): + """ + The Transformer class is for facilitating re-using + transforms without needing to re-create them. The goal + is to make repeated transforms faster. + + Additionally, it provides multiple methods for initialization. + """ + +
    [docs] @staticmethod + def from_proj(proj_from, proj_to): + """Make a Transformer from a :obj:`pyproj.Proj` or input used to create one. + + Parameters + ---------- + proj_from: :obj:`pyproj.Proj` or input used to create one + Projection of input data. + proj_from: :obj:`pyproj.Proj` or input used to create one + Projection of output data. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + + transformer = Transformer() + transformer._transformer = _Transformer.from_proj(proj_from, proj_to) + return transformer
    + +
    [docs] @staticmethod + def from_crs(crs_from, crs_to): + """Make a Transformer from a :obj:`pyproj.CRS` or input used to create one. + + Parameters + ---------- + proj_from: :obj:`pyproj.CRS` or input used to create one + Projection of input data. + proj_from: :obj:`pyproj.CRS` or input used to create one + Projection of output data. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + transformer = Transformer() + transformer._transformer = _Transformer.from_crs(crs_from, crs_to) + return transformer
    + +
    [docs] @staticmethod + def from_pipeline(proj_pipeline): + """Make a Transformer from a PROJ pipeline string. + + https://proj4.org/operations/pipeline.html + + Parameters + ---------- + proj_pipeline: str + Projection pipeline string. + + Returns + ------- + :obj:`pyproj.Transformer` + + """ + transformer = Transformer() + transformer._transformer = _Transformer.from_pipeline(cstrencode(proj_pipeline)) + return transformer
    + +
    [docs] def transform(self, xx, yy, zz=None, radians=False): + """ + Transform points between two coordinate systems. + + Parameters + ---------- + xx: scalar or array (numpy or python) + Input x coordinate(s). + yy: scalar or array (numpy or python) + Input y coordinate(s). + zz: scalar or array (numpy or python), optional + Input z coordinate(s). + radians: boolean, optional + If True, will expect input data to be in radians and will return radians + if the projection is geographic. Default is False (degrees). + + + Example: + + >>> from pyproj import Transformer + >>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857") + >>> x3, y3 = transformer.transform(33, 98) + >>> "%.3f %.3f" % (x3, y3) + '10909310.098 3895303.963' + >>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg" + >>> pipe_trans = Transformer.from_pipeline(pipeline_str) + >>> xt, yt = pipe_trans.transform(2.1, 0.001) + >>> "%.3f %.3f" % (xt, yt) + '120.321 0.057' + >>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326') + >>> xpj, ypj, zpj = transproj.transform(-2704026.010, -4253051.810, 3895878.820, radians=True) + >>> "%.3f %.3f %.3f" % (xpj, ypj, zpj) + '-2.137 0.661 -20.531' + >>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}) + >>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True) + >>> "%.3f %.3f %.3f" % (xpjr, ypjr, zpjr) + '-2704026.010 -4253051.810 3895878.820' + + """ + # process inputs, making copies that support buffer API. + inx, xisfloat, xislist, xistuple = _copytobuffer(xx) + iny, yisfloat, yislist, yistuple = _copytobuffer(yy) + if zz is not None: + inz, zisfloat, zislist, zistuple = _copytobuffer(zz) + else: + inz = None + # call pj_transform. inx,iny,inz buffers modified in place. + self._transformer._transform(inx, iny, inz, radians) + # if inputs were lists, tuples or floats, convert back. + outx = _convertback(xisfloat, xislist, xistuple, inx) + outy = _convertback(yisfloat, yislist, xistuple, iny) + if inz is not None: + outz = _convertback(zisfloat, zislist, zistuple, inz) + return outx, outy, outz + else: + return outx, outy
    + +
    [docs] def itransform(self, points, switch=False, radians=False): + """ + Iterator/generator version of the function pyproj.Transformer.transform. + + + Parameters + ---------- + points: list + List of point tuples. + switch: boolean, optional + If True x, y or lon,lat coordinates of points are switched to y, x + or lat, lon. Default is False. + radians: boolean, optional + If True, will expect input data to be in radians and will return radians + if the projection is geographic. Default is False (degrees). + + + Example: + + >>> from pyproj import Transformer + >>> transformer = Transformer.from_crs(4326, 2100) + >>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)] + >>> for pt in transformer.itransform(points): '{:.3f} {:.3f}'.format(*pt) + '2221638.801 2637034.372' + '2212924.125 2619851.898' + '2238294.779 2703763.736' + >>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg" + >>> pipe_trans = Transformer.from_pipeline(pipeline_str) + >>> for pt in pipe_trans.itransform([(2.1, 0.001)]): '{:.3f} {:.3f}'.format(*pt) + '120.321 0.057' + >>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326') + >>> for pt in transproj.itransform([(-2704026.010, -4253051.810, 3895878.820)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt) + '-2.137 0.661 -20.531' + >>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}) + >>> for pt in transprojr.itransform([(-2.137, 0.661, -20.531)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt) + '-2704214.394 -4254414.478 3894270.731' + + """ + it = iter(points) # point iterator + # get first point to check stride + try: + fst_pt = next(it) + except StopIteration: + raise ValueError("iterable must contain at least one point") + + stride = len(fst_pt) + if stride not in (2, 3): + raise ValueError("points can contain up to 3 coordinates") + + # create a coordinate sequence generator etc. x1,y1,z1,x2,y2,z2,.... + # chain so the generator returns the first point that was already acquired + coord_gen = chain(fst_pt, (coords[c] for coords in it for c in range(stride))) + + while True: + # create a temporary buffer storage for the next 64 points (64*stride*8 bytes) + buff = array("d", islice(coord_gen, 0, 64 * stride)) + if len(buff) == 0: + break + + self._transformer._transform_sequence(stride, buff, switch, radians) + + for pt in zip(*([iter(buff)] * stride)): + yield pt
    + + +
    [docs]def transform(p1, p2, x, y, z=None, radians=False): + """ + x2, y2, z2 = transform(p1, p2, x1, y1, z1) + + Transform points between two coordinate systems defined by the + Proj instances p1 and p2. + + The points x1,y1,z1 in the coordinate system defined by p1 are + transformed to x2,y2,z2 in the coordinate system defined by p2. + + z1 is optional, if it is not set it is assumed to be zero (and + only x2 and y2 are returned). If the optional keyword + 'radians' is True (default is False), then all input and + output coordinates will be in radians instead of the default + of degrees for geographic input/output projections. + + In addition to converting between cartographic and geographic + projection coordinates, this function can take care of datum + shifts (which cannot be done using the __call__ method of the + Proj instances). It also allows for one of the coordinate + systems to be geographic (proj = 'latlong'). + + x,y and z can be numpy or regular python arrays, python + lists/tuples or scalars. Arrays are fastest. For projections in + geocentric coordinates, values of x and y are given in meters. + z is always meters. + + Example usage: + + >>> from pyproj import Proj, transform + >>> # projection 1: UTM zone 15, grs80 ellipse, NAD83 datum + >>> # (defined by epsg code 26915) + >>> p1 = Proj(init='epsg:26915', preserve_units=False) + >>> # projection 2: UTM zone 15, clrk66 ellipse, NAD27 datum + >>> p2 = Proj(init='epsg:26715', preserve_units=False) + >>> # find x,y of Jefferson City, MO. + >>> x1, y1 = p1(-92.199881,38.56694) + >>> # transform this point to projection 2 coordinates. + >>> x2, y2 = transform(p1,p2,x1,y1) + >>> '%9.3f %11.3f' % (x1,y1) + '569704.566 4269024.671' + >>> '%9.3f %11.3f' % (x2,y2) + '569722.342 4268814.028' + >>> '%8.3f %5.3f' % p2(x2,y2,inverse=True) + ' -92.200 38.567' + >>> # process 3 points at a time in a tuple + >>> lats = (38.83,39.32,38.75) # Columbia, KC and StL Missouri + >>> lons = (-92.22,-94.72,-90.37) + >>> x1, y1 = p1(lons,lats) + >>> x2, y2 = transform(p1,p2,x1,y1) + >>> xy = x1+y1 + >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy + '567703.344 351730.944 728553.093 4298200.739 4353698.725 4292319.005' + >>> xy = x2+y2 + >>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy + '567721.149 351747.558 728569.133 4297989.112 4353489.645 4292106.305' + >>> lons, lats = p2(x2,y2,inverse=True) + >>> xy = lons+lats + >>> '%8.3f %8.3f %8.3f %5.3f %5.3f %5.3f' % xy + ' -92.220 -94.720 -90.370 38.830 39.320 38.750' + >>> # test datum shifting, installation of extra datum grid files. + >>> p1 = Proj(proj='latlong',datum='WGS84') + >>> x1 = -111.5; y1 = 45.25919444444 + >>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False) + >>> x2, y2 = transform(p1, p2, x1, y1) + >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) + '1402291.0 5076289.5' + >>> from pyproj import CRS + >>> c1 = CRS(proj='latlong',datum='WGS84') + >>> x1 = -111.5; y1 = 45.25919444444 + >>> c2 = CRS(proj="utm",zone=10,datum='NAD27') + >>> x2, y2 = transform(c1, c2, x1, y1) + >>> "%s %s" % (str(x2)[:9],str(y2)[:9]) + '1402291.0 5076289.5' + >>> pj = Proj(init="epsg:4214") + >>> pjx, pjy = pj(116.366, 39.867) + >>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True) + >>> "%.3f %.3f" % (xr, yr) + '2.031 0.696' + """ + return Transformer.from_proj(p1, p2).transform(x, y, z, radians)
    + + +
    [docs]def itransform(p1, p2, points, switch=False, radians=False): + """ + points2 = itransform(p1, p2, points1) + Iterator/generator version of the function pyproj.transform. + Transform points between two coordinate systems defined by the + Proj instances p1 and p2. This function can be used as an alternative + to pyproj.transform when there is a need to transform a big number of + coordinates lazily, for example when reading and processing from a file. + Points1 is an iterable/generator of coordinates x1,y1(,z1) or lon1,lat1(,z1) + in the coordinate system defined by p1. Points2 is an iterator that returns tuples + of x2,y2(,z2) or lon2,lat2(,z2) coordinates in the coordinate system defined by p2. + z are provided optionally. + + Points1 can be: + - a tuple/list of tuples/lists i.e. for 2d points: [(xi,yi),(xj,yj),....(xn,yn)] + - a Nx3 or Nx2 2d numpy array where N is the point number + - a generator of coordinates (xi,yi) for 2d points or (xi,yi,zi) for 3d + + If optional keyword 'switch' is True (default is False) then x, y or lon,lat coordinates + of points are switched to y, x or lat, lon. If the optional keyword 'radians' is True + (default is False), then all input and output coordinates will be in radians instead + of the default of degrees for geographic input/output projections. + + + Example usage: + + >>> from pyproj import Proj, itransform + >>> # projection 1: WGS84 + >>> # (defined by epsg code 4326) + >>> p1 = Proj(init='epsg:4326', preserve_units=False) + >>> # projection 2: GGRS87 / Greek Grid + >>> p2 = Proj(init='epsg:2100', preserve_units=False) + >>> # Three points with coordinates lon, lat in p1 + >>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)] + >>> # transform this point to projection 2 coordinates. + >>> for pt in itransform(p1,p2,points): '%6.3f %7.3f' % pt + '411200.657 4498214.742' + '399210.500 4487264.963' + '458703.102 4523331.451' + >>> pj = Proj(init="epsg:4214") + >>> pjx, pjy = pj(116.366, 39.867) + >>> for pt in itransform(pj, Proj(4326), [(pjx, pjy)], radians=True): '{:.3f} {:.3f}'.format(*pt) + '2.031 0.696' + """ + return Transformer.from_proj(p1, p2).itransform(points, switch, radians)
    +
    + +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/html/_sources/api/index.rst.txt b/docs/html/_sources/api/index.rst.txt index 77803db1e..97c221a40 100644 --- a/docs/html/_sources/api/index.rst.txt +++ b/docs/html/_sources/api/index.rst.txt @@ -8,4 +8,5 @@ API Documentation proj crs geod + transformer datadir diff --git a/docs/html/_sources/api/proj.rst.txt b/docs/html/_sources/api/proj.rst.txt index ffc7975a5..3a2b85e96 100644 --- a/docs/html/_sources/api/proj.rst.txt +++ b/docs/html/_sources/api/proj.rst.txt @@ -5,19 +5,8 @@ Proj pyproj.Proj ----------- -.. autoclass:: pyproj.Proj +.. autoclass:: pyproj.proj.Proj :members: :inherited-members: :special-members: __init__, __call__ :show-inheritance: - -pyproj.transform ----------------- - -.. autofunction:: pyproj.transform - - -pyproj.itransform ------------------ - -.. autofunction:: pyproj.itransform diff --git a/docs/html/_sources/api/transformer.rst.txt b/docs/html/_sources/api/transformer.rst.txt new file mode 100644 index 000000000..cf80d3619 --- /dev/null +++ b/docs/html/_sources/api/transformer.rst.txt @@ -0,0 +1,19 @@ +Transformer +=========== + +pyproj.Transformer +------------------ + +.. autoclass:: pyproj.transformer.Transformer + :members: + +pyproj.transform +---------------- + +.. autofunction:: pyproj.transformer.transform + + +pyproj.itransform +----------------- + +.. autofunction:: pyproj.transformer.itransform \ No newline at end of file diff --git a/docs/html/_sources/history.rst.txt b/docs/html/_sources/history.rst.txt index 9aa8e7ab4..8a781ad90 100644 --- a/docs/html/_sources/history.rst.txt +++ b/docs/html/_sources/history.rst.txt @@ -1,5 +1,12 @@ Change Log ========== + +2.1.0 +~~~~~ +* Added :class:`pyproj.Transformer` to make repetitive transformations more efficient (#187) +* Added fix for using local datumgrids with transform (issue #191) +* Added :class:`pyproj.Transformer.from_pipeline` to support pipeline transformations. + 2.0.2 ~~~~~ * add filter for boolean values in dict2string so "no_rot=True" works (issue #183). diff --git a/docs/html/_static/basic.css b/docs/html/_static/basic.css index 53acd096a..0807176ec 100644 --- a/docs/html/_static/basic.css +++ b/docs/html/_static/basic.css @@ -231,16 +231,6 @@ a.headerlink { visibility: hidden; } -a.brackets:before, -span.brackets > a:before{ - content: "["; -} - -a.brackets:after, -span.brackets > a:after { - content: "]"; -} - h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, @@ -401,16 +391,6 @@ table.citation td { border-bottom: none; } -th > p:first-child, -td > p:first-child { - margin-top: 0px; -} - -th > p:last-child, -td > p:last-child { - margin-bottom: 0px; -} - /* -- figures --------------------------------------------------------------- */ div.figure { @@ -480,57 +460,11 @@ ol.upperroman { list-style: upper-roman; } -li > p:first-child { - margin-top: 0px; -} - -li > p:last-child { - margin-bottom: 0px; -} - -dl.footnote > dt, -dl.citation > dt { - float: left; -} - -dl.footnote > dd, -dl.citation > dd { - margin-bottom: 0em; -} - -dl.footnote > dd:after, -dl.citation > dd:after { - content: ""; - clear: both; -} - -dl.field-list { - display: flex; - flex-wrap: wrap; -} - -dl.field-list > dt { - flex-basis: 20%; - font-weight: bold; - word-break: break-word; -} - -dl.field-list > dt:after { - content: ":"; -} - -dl.field-list > dd { - flex-basis: 70%; - padding-left: 1em; - margin-left: 0em; - margin-bottom: 0em; -} - dl { margin-bottom: 15px; } -dd > p:first-child { +dd p { margin-top: 0px; } @@ -603,12 +537,6 @@ dl.glossary dt { font-style: oblique; } -.classifier:before { - font-style: normal; - margin: 0.5em; - content: ":"; -} - abbr, acronym { border-bottom: dotted 1px; cursor: help; diff --git a/docs/html/_static/doctools.js b/docs/html/_static/doctools.js index b33f87fcb..344db17dd 100644 --- a/docs/html/_static/doctools.js +++ b/docs/html/_static/doctools.js @@ -87,13 +87,14 @@ jQuery.fn.highlightText = function(text, className) { node.nextSibling)); node.nodeValue = val.substr(0, pos); if (isInSVG) { + var bbox = span.getBBox(); var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); - var bbox = node.parentElement.getBBox(); - rect.x.baseVal.value = bbox.x; + rect.x.baseVal.value = bbox.x; rect.y.baseVal.value = bbox.y; rect.width.baseVal.value = bbox.width; rect.height.baseVal.value = bbox.height; rect.setAttribute('class', className); + var parentOfText = node.parentNode.parentNode; addItems.push({ "parent": node.parentNode, "target": rect}); diff --git a/docs/html/_static/documentation_options.js b/docs/html/_static/documentation_options.js index b3bc21107..398dfe67c 100644 --- a/docs/html/_static/documentation_options.js +++ b/docs/html/_static/documentation_options.js @@ -1,10 +1,10 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '2.0.2', + VERSION: '2.1.0', LANGUAGE: 'None', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt', - NAVIGATION_WITH_KEYS: false + NAVIGATION_WITH_KEYS: false, }; \ No newline at end of file diff --git a/docs/html/_static/language_data.js b/docs/html/_static/language_data.js new file mode 100644 index 000000000..5266fb19e --- /dev/null +++ b/docs/html/_static/language_data.js @@ -0,0 +1,297 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]; + + +/* Non-minified version JS is _stemmer.js if file is provided */ +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + + + + + +var splitChars = (function() { + var result = {}; + var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, + 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, + 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, + 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, + 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, + 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, + 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, + 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, + 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, + 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; + var i, j, start, end; + for (i = 0; i < singles.length; i++) { + result[singles[i]] = true; + } + var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], + [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], + [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], + [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], + [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], + [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], + [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], + [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], + [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], + [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], + [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], + [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], + [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], + [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], + [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], + [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], + [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], + [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], + [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], + [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], + [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], + [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], + [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], + [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], + [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], + [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], + [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], + [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], + [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], + [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], + [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], + [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], + [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], + [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], + [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], + [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], + [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], + [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], + [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], + [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], + [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], + [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], + [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], + [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], + [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], + [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], + [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], + [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], + [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; + for (i = 0; i < ranges.length; i++) { + start = ranges[i][0]; + end = ranges[i][1]; + for (j = start; j <= end; j++) { + result[j] = true; + } + } + return result; +})(); + +function splitQuery(query) { + var result = []; + var start = -1; + for (var i = 0; i < query.length; i++) { + if (splitChars[query.charCodeAt(i)]) { + if (start !== -1) { + result.push(query.slice(start, i)); + start = -1; + } + } else if (start === -1) { + start = i; + } + } + if (start !== -1) { + result.push(query.slice(start)); + } + return result; +} + + diff --git a/docs/html/_static/searchtools.js b/docs/html/_static/searchtools.js index 4c5826411..5ff318066 100644 --- a/docs/html/_static/searchtools.js +++ b/docs/html/_static/searchtools.js @@ -36,10 +36,8 @@ if (!Scorer) { // query found in title title: 15, - partialTitle: 7, // query found in terms - term: 5, - partialTerm: 2 + term: 5 }; } @@ -58,14 +56,6 @@ var Search = { _queued_query : null, _pulse_status : -1, - htmlToText : function(htmlString) { - var htmlElement = document.createElement('span'); - htmlElement.innerHTML = htmlString; - $(htmlElement).find('.headerlink').remove(); - docContent = $(htmlElement).find('[role=main]')[0]; - return docContent.textContent || docContent.innerText; - }, - init : function() { var params = $.getQueryParameters(); if (params.q) { @@ -75,6 +65,16 @@ var Search = { } }, + loadIndex : function(url) { + $.ajax({type: "GET", url: url, data: null, + dataType: "script", cache: true, + complete: function(jqxhr, textstatus) { + if (textstatus != "success") { + document.getElementById("searchindexloader").src = url; + } + }}); + }, + setIndex : function(index) { var q; this._index = index; @@ -120,7 +120,7 @@ var Search = { this.out = $('#search-results'); this.title = $('

    ' + _('Searching') + '

    ').appendTo(this.out); this.dots = $('').appendTo(this.title); - this.status = $('

     

    ').appendTo(this.out); + this.status = $('

    ').appendTo(this.out); this.output = $(' @@ -50,8 +52,8 @@

    pyproj.CRS -
  • https://github.com/opendatacube/datacube-core/blob/83bae20d2a2469a6417097168fd4ede37fd2abe5/datacube/utils/geometry/_base.py

  • -
  • https://github.com/mapbox/rasterio/blob/c13f0943b95c0eaa36ff3f620bd91107aa67b381/rasterio/_crs.pyx

  • +
  • https://github.com/opendatacube/datacube-core/blob/83bae20d2a2469a6417097168fd4ede37fd2abe5/datacube/utils/geometry/_base.py
  • +
  • https://github.com/mapbox/rasterio/blob/c13f0943b95c0eaa36ff3f620bd91107aa67b381/rasterio/_crs.pyx
  • @@ -148,38 +150,44 @@

    pyproj.CRS classmethod from_epsg(code)[source]

    Make a CRS from an EPSG code

    -
    -
    Parameters
    -

    code (int or str) – An EPSG code. Strings will be converted to integers.

    -
    -
    + +++ + + + +
    Parameters:code (int or str) – An EPSG code. Strings will be converted to integers.

    Notes

    The input code is not validated against an EPSG database.

    -
    -
    Returns
    -

    -
    -
    Return type
    -

    CRS

    -
    -
    + +++ + + + + + +
    Returns:
    Return type:CRS
    classmethod from_string(proj_string)[source]

    Make a CRS from an EPSG, PROJ, or WKT string

    -
    -
    Parameters
    -

    proj_string (str) – An EPSG, PROJ, or WKT string.

    -
    -
    Returns
    -

    -
    -
    Return type
    -

    CRS

    -
    -
    + +++ + + + + + + + +
    Parameters:proj_string (str) – An EPSG, PROJ, or WKT string.
    Returns:
    Return type:CRS
    @@ -187,30 +195,33 @@

    pyproj.CRSclassmethod from_user_input(value)[source]

    Make a CRS from various input

    Dispatches to from_epsg, from_proj, or from_string

    -
    -
    Parameters
    -

    value (obj) – A Python int, dict, or str.

    -
    -
    Returns
    -

    -
    -
    Return type
    -

    CRS

    -
    -
    + +++ + + + + + + + +
    Parameters:value (obj) – A Python int, dict, or str.
    Returns:
    Return type:CRS

    get_geod()[source]
    -
    -
    Returns
    -

    :obj:`pyproj.Geod`

    -
    -
    Return type
    -

    Geod object based on the CRS.ellipsoid.

    -
    -
    +
    +++ + + + + + +
    Returns::obj:`pyproj.Geod`
    Return type:Geod object based on the CRS.ellipsoid.
    @@ -252,17 +263,18 @@

    pyproj.CRS to_epsg()

    Return the EPSG code best matching the projection.

    -
    -
    Parameters
    -

    min_confidence (int, optional) – A value between 0-100 where 100 is the most confident. Default is 70.

    -
    -
    Returns
    -

    int or None

    -
    -
    Return type
    -

    The best matching EPSG code matching the confidence level.

    -
    -
    + +++ + + + + + + + +
    Parameters:min_confidence (int, optional) – A value between 0-100 where 100 is the most confident. Default is 70.
    Returns:int or None
    Return type:The best matching EPSG code matching the confidence level.

    @@ -276,34 +288,36 @@

    pyproj.CRS to_proj4()

    Convert the projection to a proj.4 string.

    -
    -
    Parameters
    -

    version (int) – The version of the proj.4 output. Default is 4.

    -
    -
    Returns
    -

    str

    -
    -
    Return type
    -

    The proj.4 string.

    -
    -
    + +++ + + + + + + + +
    Parameters:version (int) – The version of the proj.4 output. Default is 4.
    Returns:str
    Return type:The proj.4 string.

    to_wkt()

    Convert the projection to a WKT string.

    -
    -
    Parameters
    -

    version (str) – The version of the WKT output. Default is WKT2_2018.

    -
    -
    Returns
    -

    str

    -
    -
    Return type
    -

    The WKT string.

    -
    -
    + +++ + + + + + + + +
    Parameters:version (str) – The version of the WKT output. Default is WKT2_2018.
    Returns:str
    Return type:The WKT string.
    @@ -315,17 +329,18 @@

    pyproj.crs.is_wkt pyproj.crs.is_wkt()

    Check if the input projection string is in the Well-Known Text format.

    -
    -
    Parameters
    -

    proj_string (str) – The projection string.

    -
    -
    Returns
    -

    bool

    -
    -
    Return type
    -

    True if the string is in the Well-Known Text format

    -
    -
    + +++ + + + + + + + +
    Parameters:proj_string (str) – The projection string.
    Returns:bool
    Return type:True if the string is in the Well-Known Text format
    @@ -365,6 +380,8 @@

    Quick search

    @@ -385,13 +402,13 @@

    Navigation

  • previous |
  • - + \ No newline at end of file diff --git a/docs/html/api/datadir.html b/docs/html/api/datadir.html index fde7cd433..2ede66ea8 100644 --- a/docs/html/api/datadir.html +++ b/docs/html/api/datadir.html @@ -1,10 +1,12 @@ - + - - Data Directory — pyproj 2.0.2 documentation + + + Data Directory — pyproj 2.1.0 documentation @@ -15,7 +17,7 @@ - + @@ -48,18 +50,20 @@

    pyproj.datadir.get_data_dirpyproj.datadir.get_data_dir()[source]

    The order of preference for the data directory is:

      -
    1. The one set by pyproj.datadir.set_data_dir (if exists & valid)

    2. -
    3. The internal proj directory (if exists & valid)

    4. -
    5. The directory in PROJ_LIB

    6. +
    7. The one set by pyproj.datadir.set_data_dir (if exists & valid)
    8. +
    9. The internal proj directory (if exists & valid)
    10. +
    11. The directory in PROJ_LIB
    -
    -
    Returns
    -

    str

    -
    -
    Return type
    -

    The valid data directory.

    -
    -
    + +++ + + + + + +
    Returns:str
    Return type:The valid data directory.
    @@ -69,11 +73,14 @@

    pyproj.datadir.set_data_dir pyproj.datadir.set_data_dir(proj_data_dir)[source]

    Set the data directory for PROJ.4 to use.

    -
    -
    Parameters
    -

    proj_data_dir (str) – The path to rhe PROJ.4 data directory.

    -
    -
    + +++ + + + +
    Parameters:proj_data_dir (str) – The path to rhe PROJ.4 data directory.
    @@ -95,8 +102,8 @@

    Table of Contents

    Previous topic

    -

    Geod

    +

    Transformer

    Next topic

    Change Log

    @@ -113,6 +120,8 @@

    Quick search

    @@ -131,15 +140,15 @@

    Navigation

    next |
  • - previous |
  • - + \ No newline at end of file diff --git a/docs/html/api/geod.html b/docs/html/api/geod.html index 4cc9d0e35..50dc0cddc 100644 --- a/docs/html/api/geod.html +++ b/docs/html/api/geod.html @@ -1,10 +1,12 @@ - + - - Geod — pyproj 2.0.2 documentation + + + Geod — pyproj 2.1.0 documentation @@ -14,7 +16,7 @@ - + @@ -257,8 +259,8 @@

    Previous topic

    CRS

    Next topic

    -

    Data Directory

    +

    Transformer

    This Page

      @@ -272,6 +274,8 @@

      Quick search

    @@ -287,18 +291,18 @@

    Navigation

    index
  • - next |
  • previous |
  • - + \ No newline at end of file diff --git a/docs/html/api/index.html b/docs/html/api/index.html index 25885a4df..61d9b6f09 100644 --- a/docs/html/api/index.html +++ b/docs/html/api/index.html @@ -1,10 +1,12 @@ - + - - API Documentation — pyproj 2.0.2 documentation + + + API Documentation — pyproj 2.1.0 documentation @@ -29,7 +31,7 @@

    Navigation

  • previous |
  • - + @@ -45,8 +47,6 @@

    API DocumentationProj
  • CRS
  • +
  • Transformer +
  • Data Directory \ No newline at end of file diff --git a/docs/html/api/proj.html b/docs/html/api/proj.html index 4426608cf..e76affc5a 100644 --- a/docs/html/api/proj.html +++ b/docs/html/api/proj.html @@ -1,10 +1,12 @@ - + - - Proj — pyproj 2.0.2 documentation + + + Proj — pyproj 2.1.0 documentation @@ -29,7 +31,7 @@

    Navigation

  • previous |
  • - + @@ -44,8 +46,8 @@

    Proj

    pyproj.Proj

    -
    -class pyproj.Proj(projparams=None, preserve_units=True, **kwargs)[source]
    +
    +class pyproj.proj.Proj(projparams=None, preserve_units=True, **kwargs)[source]

    Bases: pyproj._proj.Proj

    performs cartographic transformations (converts from longitude,latitude to native map projection x,y coordinates and @@ -69,8 +71,8 @@

    pyproj.Proj -
    -__call__(*args, **kw)[source]
    +
    +__call__(*args, **kw)[source]

    Calling a Proj class instance with the arguments lon, lat will convert lon/lat (in degrees) to x/y native map projection coordinates (in meters). If optional keyword ‘inverse’ is True @@ -86,20 +88,24 @@

    pyproj.Proj -
    -__init__(projparams=None, preserve_units=True, **kwargs)[source]
    +
    +__init__(projparams=None, preserve_units=True, **kwargs)[source]

    initialize a Proj class instance.

    See the proj documentation (https://github.com/OSGeo/proj.4/wiki) for more information about projection parameters.

    -
    -
    Parameters
    -
      -
    • projparams (int, str, dict, pyproj.CRS) – A proj.4 or WKT string, proj.4 dict, EPSG integer, or a pyproj.CRS instnace.

    • -
    • preserve_units (bool) – If false, will ensure +units=m.

    • -
    • **kwargs – proj.4 projection parameters.

    • + +++ + + + +
      Parameters:
        +
      • projparams (int, str, dict, pyproj.CRS) – A proj.4 or WKT string, proj.4 dict, EPSG integer, or a pyproj.CRS instnace.
      • +
      • preserve_units (bool) – If false, will ensure +units=m.
      • +
      • **kwargs – proj.4 projection parameters.
      - - +

      Example usage:

      >>> from pyproj import Proj
       >>> p = Proj(proj='utm',zone=10,ellps='WGS84', preserve_units=False) # use kwargs
      @@ -144,8 +150,8 @@ 

      pyproj.Proj -
      -definition_string()[source]
      +
      +definition_string()[source]

      Returns formal definition string for projection

      >>> Proj('+init=epsg:4326').definition_string()
       'proj=longlat datum=WGS84 no_defs ellps=WGS84 towgs84=0,0,0'
      @@ -155,188 +161,57 @@ 

      pyproj.Proj -
      -has_inverse
      +
      +has_inverse

      Returns true if this projection has an inverse

    -
    -is_geocent()[source]
    -
    -
    Returns
    -

    bool

    -
    -
    Return type
    -

    True if projection in geocentric (x/y) coordinates

    -
    -
    +
    +is_geocent()[source]
    +
    +++ + + + + + +
    Returns:bool
    Return type:True if projection in geocentric (x/y) coordinates
    -
    -is_latlong()[source]
    -
    -
    Returns
    -

    bool

    -
    -
    Return type
    -

    True if projection in geographic (lon/lat) coordinates.

    -
    -
    +
    +is_latlong()[source]
    +
    +++ + + + + + +
    Returns:bool
    Return type:True if projection in geographic (lon/lat) coordinates.
    -
    -to_latlong()[source]
    +
    +to_latlong()[source]

    return a new Proj instance which is the geographic (lat/lon) coordinate version of the current projection

    -
    -to_latlong_def()[source]
    +
    +to_latlong_def()[source]

    return the definition string of the geographic (lat/lon) coordinate version of the current projection

    -
    -
    -

    pyproj.transform

    -
    -
    -pyproj.transform(p1, p2, x, y, z=None, radians=False)[source]
    -

    x2, y2, z2 = transform(p1, p2, x1, y1, z1)

    -

    Transform points between two coordinate systems defined by the -Proj instances p1 and p2.

    -

    The points x1,y1,z1 in the coordinate system defined by p1 are -transformed to x2,y2,z2 in the coordinate system defined by p2.

    -

    z1 is optional, if it is not set it is assumed to be zero (and -only x2 and y2 are returned). If the optional keyword -‘radians’ is True (default is False), then all input and -output coordinates will be in radians instead of the default -of degrees for geographic input/output projections.

    -

    In addition to converting between cartographic and geographic -projection coordinates, this function can take care of datum -shifts (which cannot be done using the __call__ method of the -Proj instances). It also allows for one of the coordinate -systems to be geographic (proj = ‘latlong’).

    -

    x,y and z can be numpy or regular python arrays, python -lists/tuples or scalars. Arrays are fastest. For projections in -geocentric coordinates, values of x and y are given in meters. -z is always meters.

    -

    Example usage:

    -
    >>> # projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
    ->>> # (defined by epsg code 26915)
    ->>> p1 = Proj(init='epsg:26915', preserve_units=False)
    ->>> # projection 2: UTM zone 15, clrk66 ellipse, NAD27 datum
    ->>> p2 = Proj(init='epsg:26715', preserve_units=False)
    ->>> # find x,y of Jefferson City, MO.
    ->>> x1, y1 = p1(-92.199881,38.56694)
    ->>> # transform this point to projection 2 coordinates.
    ->>> x2, y2 = transform(p1,p2,x1,y1)
    ->>> '%9.3f %11.3f' % (x1,y1)
    -'569704.566 4269024.671'
    ->>> '%9.3f %11.3f' % (x2,y2)
    -'569722.342 4268814.028'
    ->>> '%8.3f %5.3f' % p2(x2,y2,inverse=True)
    -' -92.200 38.567'
    ->>> # process 3 points at a time in a tuple
    ->>> lats = (38.83,39.32,38.75) # Columbia, KC and StL Missouri
    ->>> lons = (-92.22,-94.72,-90.37)
    ->>> x1, y1 = p1(lons,lats)
    ->>> x2, y2 = transform(p1,p2,x1,y1)
    ->>> xy = x1+y1
    ->>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy
    -'567703.344 351730.944 728553.093 4298200.739 4353698.725 4292319.005'
    ->>> xy = x2+y2
    ->>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy
    -'567721.149 351747.558 728569.133 4297989.112 4353489.645 4292106.305'
    ->>> lons, lats = p2(x2,y2,inverse=True)
    ->>> xy = lons+lats
    ->>> '%8.3f %8.3f %8.3f %5.3f %5.3f %5.3f' % xy
    -' -92.220  -94.720  -90.370 38.830 39.320 38.750'
    ->>> # test datum shifting, installation of extra datum grid files.
    ->>> p1 = Proj(proj='latlong',datum='WGS84')
    ->>> x1 = -111.5; y1 = 45.25919444444
    ->>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False)
    ->>> x2, y2 = transform(p1, p2, x1, y1)
    ->>> "%s  %s" % (str(x2)[:9],str(y2)[:9])
    -'1402285.9  5076292.4'
    ->>> from pyproj import CRS
    ->>> c1 = CRS(proj='latlong',datum='WGS84')
    ->>> x1 = -111.5; y1 = 45.25919444444
    ->>> c2 = CRS(proj="utm",zone=10,datum='NAD27')
    ->>> x2, y2 = transform(c1, c2, x1, y1)
    ->>> "%s  %s" % (str(x2)[:9],str(y2)[:9])
    -'1402291.0  5076289.5'
    ->>> x3, y3 = transform("epsg:4326", "epsg:3857", 33, 98)
    ->>> "%.3f  %.3f" % (x3, y3)
    -'10909310.098  3895303.963'
    ->>> pj = Proj(init="epsg:4214")
    ->>> pjx, pjy = pj(116.366, 39.867)
    ->>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True)
    ->>> "%.3f %.3f" % (xr, yr)
    -'2.031 0.696'
    -
    -
    -
    - -
    -
    -

    pyproj.itransform

    -
    -
    -pyproj.itransform(p1, p2, points, switch=False, radians=False)[source]
    -

    points2 = transform(p1, p2, points1) -Iterator/generator version of the function pyproj.transform. -Transform points between two coordinate systems defined by the -Proj instances p1 and p2. This function can be used as an alternative -to pyproj.transform when there is a need to transform a big number of -coordinates lazily, for example when reading and processing from a file. -Points1 is an iterable/generator of coordinates x1,y1(,z1) or lon1,lat1(,z1) -in the coordinate system defined by p1. Points2 is an iterator that returns tuples -of x2,y2(,z2) or lon2,lat2(,z2) coordinates in the coordinate system defined by p2. -z are provided optionally.

    -
    -
    Points1 can be:
      -
    • a tuple/list of tuples/lists i.e. for 2d points: [(xi,yi),(xj,yj),….(xn,yn)]

    • -
    • a Nx3 or Nx2 2d numpy array where N is the point number

    • -
    • a generator of coordinates (xi,yi) for 2d points or (xi,yi,zi) for 3d

    • -
    -
    -
    -

    If optional keyword ‘switch’ is True (default is False) then x, y or lon,lat coordinates -of points are switched to y, x or lat, lon. If the optional keyword ‘radians’ is True -(default is False), then all input and output coordinates will be in radians instead -of the default of degrees for geographic input/output projections.

    -

    Example usage:

    -
    >>> # projection 1: WGS84
    ->>> # (defined by epsg code 4326)
    ->>> p1 = Proj(init='epsg:4326', preserve_units=False)
    ->>> # projection 2: GGRS87 / Greek Grid
    ->>> p2 = Proj(init='epsg:2100', preserve_units=False)
    ->>> # Three points with coordinates lon, lat in p1
    ->>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)]
    ->>> # transform this point to projection 2 coordinates.
    ->>> for pt in itransform(p1,p2,points): '%6.3f %7.3f' % pt
    -'411200.657 4498214.742'
    -'399210.500 4487264.963'
    -'458703.102 4523331.451'
    ->>> for pt in itransform(4326, 2100, points): '{:.3f} {:.3f}'.format(*pt)
    -'2221638.801 2637034.372'
    -'2212924.125 2619851.898'
    -'2238294.779 2703763.736'
    ->>> pj = Proj(init="epsg:4214")
    ->>> pjx, pjy = pj(116.366, 39.867)
    ->>> for pt in itransform(pj, Proj(4326), [(pjx, pjy)]): '{:.3f} {:.3f}'.format(*pt)
    -'2.031 0.696'
    -
    -
    -
    -
    @@ -350,8 +225,6 @@

    Table of Contents

    @@ -375,6 +248,8 @@

    Quick search

    @@ -395,13 +270,13 @@

    Navigation

  • previous |
  • - + \ No newline at end of file diff --git a/docs/html/api/transformer.html b/docs/html/api/transformer.html new file mode 100644 index 000000000..f5da2a3e3 --- /dev/null +++ b/docs/html/api/transformer.html @@ -0,0 +1,407 @@ + + + + + + + + Transformer — pyproj 2.1.0 documentation + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    Transformer

    +
    +

    pyproj.Transformer

    +
    +
    +class pyproj.transformer.Transformer[source]
    +

    The Transformer class is for facilitating re-using +transforms without needing to re-create them. The goal +is to make repeated transforms faster.

    +

    Additionally, it provides multiple methods for initialization.

    +
    +
    +static from_crs(crs_from, crs_to)[source]
    +

    Make a Transformer from a pyproj.CRS or input used to create one.

    + +++ + + + + + + + +
    Parameters:
      +
    • proj_from (pyproj.CRS or input used to create one) – Projection of input data.
    • +
    • proj_from – Projection of output data.
    • +
    +
    Returns:

    +
    Return type:

    pyproj.Transformer

    +
    +
    + +
    +
    +static from_pipeline(proj_pipeline)[source]
    +

    Make a Transformer from a PROJ pipeline string.

    +

    https://proj4.org/operations/pipeline.html

    + +++ + + + + + + + +
    Parameters:proj_pipeline (str) – Projection pipeline string.
    Returns:
    Return type:pyproj.Transformer
    +
    + +
    +
    +static from_proj(proj_from, proj_to)[source]
    +

    Make a Transformer from a pyproj.Proj or input used to create one.

    + +++ + + + + + + + +
    Parameters:
      +
    • proj_from (pyproj.Proj or input used to create one) – Projection of input data.
    • +
    • proj_from – Projection of output data.
    • +
    +
    Returns:

    +
    Return type:

    pyproj.Transformer

    +
    +
    + +
    +
    +itransform(points, switch=False, radians=False)[source]
    +

    Iterator/generator version of the function pyproj.Transformer.transform.

    + +++ + + + +
    Parameters:
      +
    • points (list) – List of point tuples.
    • +
    • switch (boolean, optional) – If True x, y or lon,lat coordinates of points are switched to y, x +or lat, lon. Default is False.
    • +
    • radians (boolean, optional) – If True, will expect input data to be in radians and will return radians +if the projection is geographic. Default is False (degrees).
    • +
    +
    +

    Example:

    +
    >>> from pyproj import Transformer
    +>>> transformer = Transformer.from_crs(4326, 2100)
    +>>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)]
    +>>> for pt in transformer.itransform(points): '{:.3f} {:.3f}'.format(*pt)
    +'2221638.801 2637034.372'
    +'2212924.125 2619851.898'
    +'2238294.779 2703763.736'
    +>>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg"
    +>>> pipe_trans = Transformer.from_pipeline(pipeline_str)
    +>>> for pt in pipe_trans.itransform([(2.1, 0.001)]): '{:.3f} {:.3f}'.format(*pt)
    +'120.321 0.057'
    +>>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326')
    +>>> for pt in transproj.itransform([(-2704026.010, -4253051.810, 3895878.820)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt)
    +'-2.137 0.661 -20.531'
    +>>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'})
    +>>> for pt in transprojr.itransform([(-2.137, 0.661, -20.531)], radians=True): '{:.3f} {:.3f} {:.3f}'.format(*pt)
    +'-2704214.394 -4254414.478 3894270.731'
    +
    +
    +
    + +
    +
    +transform(xx, yy, zz=None, radians=False)[source]
    +

    Transform points between two coordinate systems.

    + +++ + + + +
    Parameters:
      +
    • xx (scalar or array (numpy or python)) – Input x coordinate(s).
    • +
    • yy (scalar or array (numpy or python)) – Input y coordinate(s).
    • +
    • zz (scalar or array (numpy or python), optional) – Input z coordinate(s).
    • +
    • radians (boolean, optional) – If True, will expect input data to be in radians and will return radians +if the projection is geographic. Default is False (degrees).
    • +
    +
    +

    Example:

    +
    >>> from pyproj import Transformer
    +>>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
    +>>> x3, y3 = transformer.transform(33, 98)
    +>>> "%.3f  %.3f" % (x3, y3)
    +'10909310.098  3895303.963'
    +>>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg"
    +>>> pipe_trans = Transformer.from_pipeline(pipeline_str)
    +>>> xt, yt = pipe_trans.transform(2.1, 0.001)
    +>>> "%.3f  %.3f" % (xt, yt)
    +'120.321  0.057'
    +>>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326')
    +>>> xpj, ypj, zpj = transproj.transform(-2704026.010, -4253051.810, 3895878.820, radians=True)
    +>>> "%.3f %.3f %.3f" % (xpj, ypj, zpj)
    +'-2.137 0.661 -20.531'
    +>>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'})
    +>>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True)
    +>>> "%.3f %.3f %.3f" % (xpjr, ypjr, zpjr)
    +'-2704026.010 -4253051.810 3895878.820'
    +
    +
    +
    + +
    + +
    +
    +

    pyproj.transform

    +
    +
    +pyproj.transformer.transform(p1, p2, x, y, z=None, radians=False)[source]
    +

    x2, y2, z2 = transform(p1, p2, x1, y1, z1)

    +

    Transform points between two coordinate systems defined by the +Proj instances p1 and p2.

    +

    The points x1,y1,z1 in the coordinate system defined by p1 are +transformed to x2,y2,z2 in the coordinate system defined by p2.

    +

    z1 is optional, if it is not set it is assumed to be zero (and +only x2 and y2 are returned). If the optional keyword +‘radians’ is True (default is False), then all input and +output coordinates will be in radians instead of the default +of degrees for geographic input/output projections.

    +

    In addition to converting between cartographic and geographic +projection coordinates, this function can take care of datum +shifts (which cannot be done using the __call__ method of the +Proj instances). It also allows for one of the coordinate +systems to be geographic (proj = ‘latlong’).

    +

    x,y and z can be numpy or regular python arrays, python +lists/tuples or scalars. Arrays are fastest. For projections in +geocentric coordinates, values of x and y are given in meters. +z is always meters.

    +

    Example usage:

    +
    >>> from pyproj import Proj, transform
    +>>> # projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
    +>>> # (defined by epsg code 26915)
    +>>> p1 = Proj(init='epsg:26915', preserve_units=False)
    +>>> # projection 2: UTM zone 15, clrk66 ellipse, NAD27 datum
    +>>> p2 = Proj(init='epsg:26715', preserve_units=False)
    +>>> # find x,y of Jefferson City, MO.
    +>>> x1, y1 = p1(-92.199881,38.56694)
    +>>> # transform this point to projection 2 coordinates.
    +>>> x2, y2 = transform(p1,p2,x1,y1)
    +>>> '%9.3f %11.3f' % (x1,y1)
    +'569704.566 4269024.671'
    +>>> '%9.3f %11.3f' % (x2,y2)
    +'569722.342 4268814.028'
    +>>> '%8.3f %5.3f' % p2(x2,y2,inverse=True)
    +' -92.200 38.567'
    +>>> # process 3 points at a time in a tuple
    +>>> lats = (38.83,39.32,38.75) # Columbia, KC and StL Missouri
    +>>> lons = (-92.22,-94.72,-90.37)
    +>>> x1, y1 = p1(lons,lats)
    +>>> x2, y2 = transform(p1,p2,x1,y1)
    +>>> xy = x1+y1
    +>>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy
    +'567703.344 351730.944 728553.093 4298200.739 4353698.725 4292319.005'
    +>>> xy = x2+y2
    +>>> '%9.3f %9.3f %9.3f %11.3f %11.3f %11.3f' % xy
    +'567721.149 351747.558 728569.133 4297989.112 4353489.645 4292106.305'
    +>>> lons, lats = p2(x2,y2,inverse=True)
    +>>> xy = lons+lats
    +>>> '%8.3f %8.3f %8.3f %5.3f %5.3f %5.3f' % xy
    +' -92.220  -94.720  -90.370 38.830 39.320 38.750'
    +>>> # test datum shifting, installation of extra datum grid files.
    +>>> p1 = Proj(proj='latlong',datum='WGS84')
    +>>> x1 = -111.5; y1 = 45.25919444444
    +>>> p2 = Proj(proj="utm",zone=10,datum='NAD27', preserve_units=False)
    +>>> x2, y2 = transform(p1, p2, x1, y1)
    +>>> "%s  %s" % (str(x2)[:9],str(y2)[:9])
    +'1402291.0  5076289.5'
    +>>> from pyproj import CRS
    +>>> c1 = CRS(proj='latlong',datum='WGS84')
    +>>> x1 = -111.5; y1 = 45.25919444444
    +>>> c2 = CRS(proj="utm",zone=10,datum='NAD27')
    +>>> x2, y2 = transform(c1, c2, x1, y1)
    +>>> "%s  %s" % (str(x2)[:9],str(y2)[:9])
    +'1402291.0  5076289.5'
    +>>> pj = Proj(init="epsg:4214")
    +>>> pjx, pjy = pj(116.366, 39.867)
    +>>> xr, yr = transform(pj, Proj(4326), pjx, pjy, radians=True)
    +>>> "%.3f %.3f" % (xr, yr)
    +'2.031 0.696'
    +
    +
    +
    + +
    +
    +

    pyproj.itransform

    +
    +
    +pyproj.transformer.itransform(p1, p2, points, switch=False, radians=False)[source]
    +

    points2 = itransform(p1, p2, points1) +Iterator/generator version of the function pyproj.transform. +Transform points between two coordinate systems defined by the +Proj instances p1 and p2. This function can be used as an alternative +to pyproj.transform when there is a need to transform a big number of +coordinates lazily, for example when reading and processing from a file. +Points1 is an iterable/generator of coordinates x1,y1(,z1) or lon1,lat1(,z1) +in the coordinate system defined by p1. Points2 is an iterator that returns tuples +of x2,y2(,z2) or lon2,lat2(,z2) coordinates in the coordinate system defined by p2. +z are provided optionally.

    +
    +
    Points1 can be:
    +
      +
    • a tuple/list of tuples/lists i.e. for 2d points: [(xi,yi),(xj,yj),….(xn,yn)]
    • +
    • a Nx3 or Nx2 2d numpy array where N is the point number
    • +
    • a generator of coordinates (xi,yi) for 2d points or (xi,yi,zi) for 3d
    • +
    +
    +
    +

    If optional keyword ‘switch’ is True (default is False) then x, y or lon,lat coordinates +of points are switched to y, x or lat, lon. If the optional keyword ‘radians’ is True +(default is False), then all input and output coordinates will be in radians instead +of the default of degrees for geographic input/output projections.

    +

    Example usage:

    +
    >>> from pyproj import Proj, itransform
    +>>> # projection 1: WGS84
    +>>> # (defined by epsg code 4326)
    +>>> p1 = Proj(init='epsg:4326', preserve_units=False)
    +>>> # projection 2: GGRS87 / Greek Grid
    +>>> p2 = Proj(init='epsg:2100', preserve_units=False)
    +>>> # Three points with coordinates lon, lat in p1
    +>>> points = [(22.95, 40.63), (22.81, 40.53), (23.51, 40.86)]
    +>>> # transform this point to projection 2 coordinates.
    +>>> for pt in itransform(p1,p2,points): '%6.3f %7.3f' % pt
    +'411200.657 4498214.742'
    +'399210.500 4487264.963'
    +'458703.102 4523331.451'
    +>>> pj = Proj(init="epsg:4214")
    +>>> pjx, pjy = pj(116.366, 39.867)
    +>>> for pt in itransform(pj, Proj(4326), [(pjx, pjy)], radians=True): '{:.3f} {:.3f}'.format(*pt)
    +'2.031 0.696'
    +
    +
    +
    + +
    +
    + + +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/html/genindex.html b/docs/html/genindex.html index 9005f8c9e..ec3a262a5 100644 --- a/docs/html/genindex.html +++ b/docs/html/genindex.html @@ -1,11 +1,13 @@ - + - - Index — pyproj 2.0.2 documentation + + + Index — pyproj 2.1.0 documentation @@ -22,7 +24,7 @@

    Navigation

  • index
  • - + @@ -53,14 +55,14 @@

    Index

    _

    @@ -93,7 +95,7 @@

    D

    @@ -109,12 +111,18 @@

    E

    F

    @@ -185,7 +197,7 @@

    P

    @@ -205,17 +217,23 @@

    T

  • to_geodetic() (pyproj.crs.CRS method)
  • -
  • to_latlong() (pyproj.Proj method) +
  • to_latlong() (pyproj.proj.Proj method) +
  • +
  • to_latlong_def() (pyproj.proj.Proj method)
  • @@ -233,6 +251,8 @@

    Quick search

    @@ -247,12 +267,12 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/history.html b/docs/html/history.html index 2f8600bce..1c758592e 100644 --- a/docs/html/history.html +++ b/docs/html/history.html @@ -1,10 +1,12 @@ - + - - Change Log — pyproj 2.0.2 documentation + + + Change Log — pyproj 2.1.0 documentation @@ -25,7 +27,7 @@

    Navigation

  • previous |
  • - + @@ -37,63 +39,71 @@

    Navigation

    Change Log

    -

    2.0.2

    +

    2.1.0

      -
    • add filter for boolean values in dict2string so “no_rot=True” works (issue #183).

    • -
    • make sure .pxd files included in source tarball.

    • -
    • add radians flag back in for transform/itransform (issue #185).

    • +
    • Added pyproj.Transformer to make repetitive transformations more efficient (#187)
    • +
    • Added fix for using local datumgrids with transform (issue #191)
    • +
    • Added pyproj.Transformer.from_pipeline to support pipeline transformations.
    -

    2.0.1

    +

    2.0.2

      -
    • Ensure data path set properly for TransProj (pull request #179, addressed -issue #176).

    • +
    • add filter for boolean values in dict2string so “no_rot=True” works (issue #183).
    • +
    • make sure .pxd files included in source tarball.
    • +
    • add radians flag back in for transform/itransform (issue #185).
    -

    2.0.0

    +

    2.0.1

      -
    • Update to PROJ.4 version 6.0.0 & removed support for older PROJ.4 versions.

    • -
    • Added pyproj.CRS class.

    • -
    • Updated pyproj.Proj & pyproj.transform to accept any input from CRS.from_user_input.

    • -
    • Removed internal PROJ.4 source code.

    • -
    • Changed default for preserve_units to be True in pyproj.Proj class initialization.

    • -
    • Modified logic for searching for the PROJ.4 data directory to not conflict with older versions of PROJ.4.

    • -
    • Added pyproject.toml.

    • +
    • Ensure data path set properly for TransProj (pull request #179, addressed +issue #176).
    -

    1.9.6

    +

    2.0.0

      -
    • fix segfault when inverse projection not defined (issue #43, pull request -#44).

    • -
    • supports python 3.7

    • +
    • Update to PROJ.4 version 6.0.0 & removed support for older PROJ.4 versions.
    • +
    • Added pyproj.CRS class.
    • +
    • Updated pyproj.Proj & pyproj.transform to accept any input from CRS.from_user_input.
    • +
    • Removed internal PROJ.4 source code.
    • +
    • Changed default for preserve_units to be True in pyproj.Proj class initialization.
    • +
    • Modified logic for searching for the PROJ.4 data directory to not conflict with older versions of PROJ.4.
    • +
    • Added pyproject.toml.
    -

    1.9.5.1

    +

    1.9.6

      -
    • fix for issue #42 (compilation error with microsoft visual studio).

    • +
    • fix segfault when inverse projection not defined (issue #43, pull request +#44).
    • +
    • supports python 3.7
    -

    1.9.5

    +

    1.9.5.1

      -
    • update proj4 source to latest github master (commit 953cc00fd87425395cabe37641cda905c4b587c1).

    • -
    • port of basemap fix for input arrays in fortran order

    • -
    • restore inverse Hammer patch that was lost when proj4 source code was updated.

    • +
    • fix for issue #42 (compilation error with microsoft visual studio).
    • +
    +
    +
    +

    1.9.5

    +
      +
    • update proj4 source to latest github master (commit 953cc00fd87425395cabe37641cda905c4b587c1).
    • +
    • port of basemap fix for input arrays in fortran order
    • +
    • restore inverse Hammer patch that was lost when proj4 source code was updated.

    1.9.4 (git tag v1.9.4rel)

      -
    • migrate to github from googlecode.

    • -
    • update proj4 source code from svn r2595 (version 4.9.0RC2).

    • -
    • include runtime_library_dirs in setup-proj.py.

    • -
    • added to_latlong method (issue 51).

    • -
    • fix back azimuth when lon1 and lon2 are identical.

    • +
    • migrate to github from googlecode.
    • +
    • update proj4 source code from svn r2595 (version 4.9.0RC2).
    • +
    • include runtime_library_dirs in setup-proj.py.
    • +
    • added to_latlong method (issue 51).
    • +
    • fix back azimuth when lon1 and lon2 are identical.
    @@ -101,10 +111,10 @@

    1.9.4 (git tag v1.9.4rel)1.9.3 (svn revision 327)

      -
    • Geod now uses C code adapted from geographiclib now included in proj4 source, -instead of pure python code directly from geographiclib.

    • -
    • make radians=True work with Geod.npts (issue 47).

    • -
    • allow PROJ_DIR env var to control location of proj data (issue 40).

    • +
    • Geod now uses C code adapted from geographiclib now included in proj4 source, +instead of pure python code directly from geographiclib.
    • +
    • make radians=True work with Geod.npts (issue 47).
    • +
    • allow PROJ_DIR env var to control location of proj data (issue 40).
    @@ -112,8 +122,8 @@

    1.9.3 (svn revision 327)1.9.2 (svn revision 301)

      -
    • updated proj4 src to 4.8.0 - includes two new map projections (natearth and -isea).

    • +
    • updated proj4 src to 4.8.0 - includes two new map projections (natearth and +isea).
    @@ -121,8 +131,8 @@

    1.9.2 (svn revision 301)1.9.1 (svn revision 285)

      -
    • restore compatibility with python 2.4/2.5, which was broken by the addition -of the geographiclib geodesic module (issue 36).

    • +
    • restore compatibility with python 2.4/2.5, which was broken by the addition +of the geographiclib geodesic module (issue 36).
    @@ -130,11 +140,11 @@

    1.9.1 (svn revision 285)1.9.0 (svn revision 282)

      -
    • use pure python geographiclib for geodesic computation codes instead of proj4.

    • -
    • don’t use global variable pj_errno for return codes, use pj_ctx_get_errno instead.

    • -
    • use new projCtx structure for thread safety in proj lib.

    • -
    • update C source and data from proj4 svn (r2140).

    • -
    • add pj_list and pj_ellps module level variables (a dict mapping short names to longer descriptions, e.g. pyproj.pj_list[‘aea’] = ‘Albers Equal Area’).

    • +
    • use pure python geographiclib for geodesic computation codes instead of proj4.
    • +
    • don’t use global variable pj_errno for return codes, use pj_ctx_get_errno instead.
    • +
    • use new projCtx structure for thread safety in proj lib.
    • +
    • update C source and data from proj4 svn (r2140).
    • +
    • add pj_list and pj_ellps module level variables (a dict mapping short names to longer descriptions, e.g. pyproj.pj_list[‘aea’] = ‘Albers Equal Area’).
    @@ -142,14 +152,14 @@

    1.9.0 (svn revision 282)1.8.9 (svn revision 222)

      -
    • Python 3 now supported.

    • -
    • allow ‘EPSG’ init (as well as ‘epsg’). This only worked on case-insensitive -filesystems previously. Fixes issue 6.

    • -
    • added inverse to Hammer projection.

    • -
    • updated proj.4/src/pj_mutex.c from proj4 svn to fix a threading issue on windows +

    • Python 3 now supported.
    • +
    • allow ‘EPSG’ init (as well as ‘epsg’). This only worked on case-insensitive +filesystems previously. Fixes issue 6.
    • +
    • added inverse to Hammer projection.
    • +
    • updated proj.4/src/pj_mutex.c from proj4 svn to fix a threading issue on windows (issue 25). Windows binary installers updated (version 1.8.8-1), courtesy -Christoph Gohlke.

    • -
    • if inputs are NaNs, return huge number (1.e30).

    • +Christoph Gohlke. +
    • if inputs are NaNs, return huge number (1.e30).
    @@ -157,8 +167,8 @@

    1.8.9 (svn revision 222)1.8.8 (svn revision 196)

      -
    • add extra datum shift files, added test/test_datum.py (fixes issue 22). -datum shifts now work correctly in transform function.

    • +
    • add extra datum shift files, added test/test_datum.py (fixes issue 22). +datum shifts now work correctly in transform function.
    @@ -166,10 +176,10 @@

    1.8.8 (svn revision 196)1.8.7 (svn revision 175)

      -
    • reverted pj_init.c to old version (from proj4 4.6.1) because version in -4.7.0 includes caching code that can cause segfaults in pyproj (issue 19).

    • -
    • added ‘preserve_units’ keyword to Proj.__init__ to suppress conversion -to meters.

    • +
    • reverted pj_init.c to old version (from proj4 4.6.1) because version in +4.7.0 includes caching code that can cause segfaults in pyproj (issue 19).
    • +
    • added ‘preserve_units’ keyword to Proj.__init__ to suppress conversion +to meters.
    @@ -177,9 +187,9 @@

    1.8.7 (svn revision 175)1.8.6 (svn revision 169)

      -
    • now works with ms vs2008, vs2003 (fixed missing isnan).

    • -
    • updated to proj 4.7.0 (fixes a problem coexisting with pyqt).

    • -
    • allow Geod instance to be initialized using a proj4 string

    • +
    • now works with ms vs2008, vs2003 (fixed missing isnan).
    • +
    • updated to proj 4.7.0 (fixes a problem coexisting with pyqt).
    • +
    • allow Geod instance to be initialized using a proj4 string
    @@ -187,8 +197,8 @@

    1.8.6 (svn revision 169)1.8.5 (svn revision 155)

      -
    • allow Proj instance to be initialized using a proj4 string -(instead of just a dict or kwargs).

    • +
    • allow Proj instance to be initialized using a proj4 string +(instead of just a dict or kwargs).
    @@ -196,7 +206,7 @@

    1.8.5 (svn revision 155)1.8.4 (svn revision 151)

      -
    • updated proj4 sources to version 4.6.0

    • +
    • updated proj4 sources to version 4.6.0
    @@ -204,66 +214,66 @@

    1.8.4 (svn revision 151)1.8.3 (svn revision 146)

      -
    • fixed bug in Geod class that caused erroneous error message -“undefined inverse geodesic (may be an antipodal point)”.

    • -
    • fix __reduce__ method of Geod class so instances can be pickled.

    • -
    • make sure points outside projection limb are set to 1.e30 on inverse -transform (if errcheck=False).

    • -
    • fixed small setup.py bug.

    • -
    • generate C source with Cython 0.9.6.6 (pycompat.h no longer needed).

    • +
    • fixed bug in Geod class that caused erroneous error message +“undefined inverse geodesic (may be an antipodal point)”.
    • +
    • fix __reduce__ method of Geod class so instances can be pickled.
    • +
    • make sure points outside projection limb are set to 1.e30 on inverse +transform (if errcheck=False).
    • +
    • fixed small setup.py bug.
    • +
    • generate C source with Cython 0.9.6.6 (pycompat.h no longer needed).
    -
    -

    1.8.2

    +
    +

    1.8.2

      -
    • added ‘srs’ (spatial reference system) instance variable to Proj.

    • -
    • instead of returning HUGE_VAL (usually ‘inf’) when projection not defined -and errcheck=False, return 1.e30.

    • -
    • added Geod class for geodesic (i.e. Great Circle) computations. -Includes doctests (which can be run with pyproj.test()).

    • -
    • proj.4 source code now included, thus removing proj.4 lib +

    • added ‘srs’ (spatial reference system) instance variable to Proj.
    • +
    • instead of returning HUGE_VAL (usually ‘inf’) when projection not defined +and errcheck=False, return 1.e30.
    • +
    • added Geod class for geodesic (i.e. Great Circle) computations. +Includes doctests (which can be run with pyproj.test()).
    • +
    • proj.4 source code now included, thus removing proj.4 lib dependency. Version 4.5.0 is included, with a patch to -create an API for geodesic computations.

    • -
    • python 2.4 compatibility patch (suggested by Andrew Straw) +create an API for geodesic computations.

    • +
    • python 2.4 compatibility patch (suggested by Andrew Straw) from M. v. Loewis: -http://mail.python.org/pipermail/python-dev/2006-March/062561.html

    • +http://mail.python.org/pipermail/python-dev/2006-March/062561.html
    -
    -

    1.8.1

    +
    +

    1.8.1

      -
    • if given tuples, returns tuples (instead of lists).

    • -
    • test for numpy arrays first.

    • -
    • Fixed error in docstring example.

    • -
    • README.html contains html docstrings generated by pydoc.

    • -
    • Renamed pyproj.so to _pyproj.so, created a new python module +

    • if given tuples, returns tuples (instead of lists).
    • +
    • test for numpy arrays first.
    • +
    • Fixed error in docstring example.
    • +
    • README.html contains html docstrings generated by pydoc.
    • +
    • Renamed pyproj.so to _pyproj.so, created a new python module called pyproj.py. Moved as code as possible from _pyproj.so to -pyproj.py.

    • -
    • docstring examples now executed by doctest when ‘pyproj.test()’ is run.

    • -
    • added test to _pyproj.c which defines Py_ssize_t for python < 2.5. -This is necessary when pyrex 0.9.5 is used.

    • +pyproj.py. +
    • docstring examples now executed by doctest when ‘pyproj.test()’ is run.
    • +
    • added test to _pyproj.c which defines Py_ssize_t for python < 2.5. +This is necessary when pyrex 0.9.5 is used.
    -
    -

    1.8.0

    +
    +

    1.8.0

      -
    • Better error handling Proj.__init__.

    • -
    • Added optional keyword ‘errcheck’ to __call__ method.

    • -
    • If True, an exception is raised if the transformation is invalid.

    • +
    • Better error handling Proj.__init__.
    • +
    • Added optional keyword ‘errcheck’ to __call__ method.
    • +
    • If True, an exception is raised if the transformation is invalid.
    -
    @@ -337,12 +350,12 @@

    Navigation

  • previous |
  • - +
    \ No newline at end of file diff --git a/docs/html/index.html b/docs/html/index.html index b00121e36..7337d7085 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -1,10 +1,12 @@ - + - - pyproj Documentation — pyproj 2.0.2 documentation + + + pyproj Documentation — pyproj 2.1.0 documentation @@ -25,7 +27,7 @@

    Navigation

  • next |
  • - +
    @@ -50,9 +52,9 @@

    pyproj Documentation

    Indices and tables

    @@ -84,6 +86,8 @@

    Quick search

    @@ -101,12 +105,12 @@

    Navigation

  • next |
  • - + \ No newline at end of file diff --git a/docs/html/installation.html b/docs/html/installation.html index d02b88cf1..cc8c238e6 100644 --- a/docs/html/installation.html +++ b/docs/html/installation.html @@ -1,10 +1,12 @@ - + - - Installation — pyproj 2.0.2 documentation + + + Installation — pyproj 2.1.0 documentation @@ -29,7 +31,7 @@

    Navigation

  • previous |
  • - + @@ -42,7 +44,7 @@

    Navigation

    Installation

    The easiest methods for installing pyproj are:

      -
    1. Use the wheels on pypi or from https://www.lfd.uci.edu/~gohlke/pythonlibs/

    2. +
    3. Use the wheels on pypi or from https://www.lfd.uci.edu/~gohlke/pythonlibs/
    @@ -102,20 +104,20 @@

    Setup pyproj

    The order of preference for the data directory is:

      -
    1. The one set by pyproj.datadir.set_data_dir (if exists & valid)

    2. -
    3. The internal proj directory (if exists & valid)

    4. -
    5. The directory in the PROJ_LIB environment variable (if exists & valid)

    6. +
    7. The one set by pyproj.datadir.set_data_dir (if exists & valid)
    8. +
    9. The internal proj directory (if exists & valid)
    10. +
    11. The directory in the PROJ_LIB environment variable (if exists & valid)

    Install pyproj

    -

    Note

    -

    Cython or pip>=10.0.1 is required for the installation.

    +

    Note

    +

    Cython or pip>=10.0.1 is required for the installation.

    -

    Note

    -

    You may need to run pip with administrative privileges (e.g. sudo pip) or +

    Note

    +

    You may need to run pip with administrative privileges (e.g. sudo pip) or perform a user only installation (e.g. pip install –user).

    @@ -183,6 +185,8 @@

    Quick search

    @@ -203,12 +207,12 @@

    Navigation

  • previous |
  • - + \ No newline at end of file diff --git a/docs/html/objects.inv b/docs/html/objects.inv index c4dbf403d2b2605764136e4fe06df325edbc06b5..07bb9e339cc168f3f851532e6c16964f936a2821 100644 GIT binary patch delta 609 zcmV-n0-pVb1;_=EJOeQB4A`l+VF88$8xX9!3#vui z>SRffB;X)L#wz@pxVCMl7zIT@>;@}HnNF{isiGUv!w!i@M*p)Id{BR_p6 zyUfhOoKm5Lr!)`^_!`+;NcqeY)IuE-)XI3bPF`4-|M>F|XBx~`q}OwOe+yz37}X_h z9R!YfZ^dKlVGa5s9KN#DsUT;*ZBikSQW&QNPX$Y>8w$o%Q!Q5)r$ZgSN^OO)tQKoz zTA%Kq0#B>qwy%cpNRTN&Vbn!xsd~7w%+#CUu!h0|-@qQ3Og~#=MFX?}E4W}PmG*kN z7pv=wOgIzpeSuQAu>O_`e?9;6s}Zc?ATL{0c%juB05&1x!gjYTJX2g;Ku6g%+-<|V zp9B8H1FqY+s>T^tFexw0xSQOS*?5EFPzDeaTFikI2Q>>b@(A|we7!->-JJSfBqj4w zr$>yJ?%gECx~-$VWy+P>Vh`tk=jZrZEM+TQ^aB{Le(>cy!;U=*e`m8xBMeBP;KTh6 z?eIZ9#kBG2B(}JFzqj*%qCv6NNwSY&{t@T-9oGffosUFf95S@!I@=5 zL75n|hKK0UR2gh70=@76K0u;Gqy=8v2p@tNI2k0t#EiEQq(#&=E5&I43*uzYI#Bws z{r2l++TIjikS=%Y79>0fZcE;e=%)qmDSJjD0q~)R`qb@g{$v^(->p~bq9M8I={EhV*|Va zj|zp!rRiJ_`(m}f#H5};>Mm1ee>)nm9eUc;)*p-E zDxNau>zSo1ypy3(@IKXb!Cv@v|IBt)whbLsk!mT1N~X}cI+kveq5?Cnt;H+oBpjl> z@HsseHHMV+<$9;k$%tB*3fK=@75`*=u~^@LNwR1{q`wp0;F=rbLoQ>aXsnt^-W@l? hM9=)Rs?~5RBY^O-5xyq+STBC*=l7z5;xCb + - - Search — pyproj 2.0.2 documentation + + + Search — pyproj 2.1.0 documentation @@ -16,7 +18,11 @@ - + + + @@ -26,7 +32,7 @@

    Navigation

  • index
  • - + @@ -74,12 +80,12 @@

    Navigation

  • index
  • - + \ No newline at end of file diff --git a/docs/html/searchindex.js b/docs/html/searchindex.js index 637b6220c..255d4f49f 100644 --- a/docs/html/searchindex.js +++ b/docs/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api/crs","api/datadir","api/geod","api/index","api/proj","history","index","installation"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["api/crs.rst","api/datadir.rst","api/geod.rst","api/index.rst","api/proj.rst","history.rst","index.rst","installation.rst"],objects:{"pyproj.Geod":{__init__:[2,1,1,""],fwd:[2,1,1,""],inv:[2,1,1,""],npts:[2,1,1,""]},"pyproj.Proj":{__call__:[4,1,1,""],__init__:[4,1,1,""],definition_string:[4,1,1,""],has_inverse:[4,2,1,""],is_geocent:[4,1,1,""],is_latlong:[4,1,1,""],to_latlong:[4,1,1,""],to_latlong_def:[4,1,1,""]},"pyproj.crs":{CRS:[0,0,1,""],is_wkt:[0,4,1,""]},"pyproj.crs.CRS":{__init__:[0,1,1,""],area_of_use:[0,2,1,""],axis_info:[0,2,1,""],datum:[0,2,1,""],ellipsoid:[0,2,1,""],from_epsg:[0,3,1,""],from_string:[0,3,1,""],from_user_input:[0,3,1,""],get_geod:[0,1,1,""],is_geocentric:[0,2,1,""],is_geographic:[0,2,1,""],is_projected:[0,2,1,""],is_valid:[0,2,1,""],prime_meridian:[0,2,1,""],to_epsg:[0,1,1,""],to_geodetic:[0,1,1,""],to_proj4:[0,1,1,""],to_wkt:[0,1,1,""]},"pyproj.datadir":{get_data_dir:[1,4,1,""],set_data_dir:[1,4,1,""]},pyproj:{Geod:[2,0,1,""],Proj:[4,0,1,""],itransform:[4,4,1,""],transform:[4,4,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","attribute","Python attribute"],"3":["py","classmethod","Python class method"],"4":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:attribute","3":"py:classmethod","4":"py:function"},terms:{"0rc2":5,"10n":0,"15n":0,"83bae20d2a2469a6417097168fd4ede37fd2abe5":0,"953cc00fd87425395cabe37641cda905c4b587c1":5,"boolean":5,"case":5,"class":[0,2,4,5],"default":[0,4,5],"export":7,"float":2,"function":[0,4,5],"import":[0,2,4],"int":[0,4],"new":[0,2,4,5],"return":[0,1,2,4,5],"short":5,"switch":4,"true":[0,2,4,5,7],"var":5,Added:5,CRS:[3,4,5],For:[4,7],GRS:2,The:[0,1,2,4],Use:[0,2,7],WGS:[0,2],__call__:[4,5],__init__:[0,2,4,5],__reduce__:5,_base:0,_cr:0,_geod:2,_proj:4,_pyproj:5,about:[0,2,4],accept:5,adapt:5,add:5,added:5,addit:[4,5],address:5,administr:7,aea:5,against:0,airi:2,alber:5,all:4,allow:[4,5],along:2,alongsid:7,also:[2,4],altern:4,alwai:4,amer:2,america:0,andra:2,andrew:5,angleunit:0,ani:[2,5],antipod:5,api:[5,6],apl4:2,appl:2,area:[0,5],area_of_us:0,areaofus:0,arg:4,argument:[0,2,4],arrai:[2,4,5],asia:2,associ:0,assum:4,attribut:0,aust_sa:2,australian:2,avoid:7,axi:[0,2],axis_info:0,axisinfo:0,az12:2,az21:2,azimuth:[2,5],back:[2,5],backaz:2,base:[0,2,4],basegeogcr:0,basemap:5,baz:2,becaus:5,befor:7,belgium:2,below:7,bess_nam:2,bessel:2,best:[0,7],better:5,between:[0,2,4],big:4,binari:[5,7],blanklin:0,blob:0,bool:[0,4],boston:2,boston_lat:2,boston_lon:2,bound:0,broken:5,bug:5,build:7,c13f0943b95c0eaa36ff3f620bd91107aa67b381:0,cach:5,call:[4,5],can:[2,4,5,7],cannot:4,care:4,cartesian:0,cartograph:4,cast:4,caus:[4,5],chang:6,chapter:2,check:0,christoph:5,circl:[2,5],citi:[2,4],clark:2,classmethod:0,clrk66:[2,4],clrk80:2,code:[0,4,5],coexist:5,columbia:4,com:[0,2,4,6,7],comm:2,command:4,commit:5,compat:[4,5],compil:5,comput:[2,5],conda:7,confid:0,conflict:[5,7],contain:5,content:[3,6],control:[0,4,5],convers:[0,5],convert:[0,4],coordin:[0,4],core:0,correctli:5,countri:0,courtesi:5,cpm:2,creat:5,crs:3,crs_utm:0,current:[0,4,7],cython:[5,7],data:[3,4,5],databas:0,datacub:0,datadir:[3,7],datum:[0,2,4,5],defin:[2,4,5],definit:4,definition_str:4,degre:[0,2,4],delambr:2,delmbr:2,den:2,depend:5,des:2,describ:2,descript:5,determin:2,dev:5,dg2rad:2,dict2str:5,dict:[0,4,5],dictionari:[0,2,4],differ:4,directli:[2,5],directori:[3,5],dispatch:0,dist:2,distanc:2,docstr:5,doctest:5,document:[0,2,4],doe:7,don:5,done:4,doubl:4,download:7,e30:[4,5],earth:2,easiest:7,east:0,eccentr:2,edu:7,either:[0,4],ellips:4,ellipsoid:[0,2],ellp:[0,2,4],endlat:2,endlon:2,eng:2,ensur:[4,5],env:5,environ:7,epsg:[0,4,5],equal:[2,5],equatori:2,errcheck:[4,5],erron:5,error:5,everest:2,evrst30:2,evrst48:2,evrst56:2,evrst69:2,evrstss:2,exampl:[0,2,4,5,7],except:[4,5],execut:[5,7],exist:[1,7],extra:[4,5],factor:0,fals:[0,2,4,5],fantast:0,fastest:4,faz:2,feet:4,figur:2,file:[4,5],filesystem:5,filter:5,find:[2,4],first:5,fischer:2,fix:5,flag:5,flatten:2,follow:2,forc:4,forg:7,formal:4,format:[0,4],fortran:5,forward:2,fount:7,franc:2,fresno:4,from:[0,2,4,5],from_epsg:0,from_proj:0,from_str:0,from_user_input:[0,5],fschr60:2,fschr60m:2,fschr68:2,further:7,fwd:2,gener:[4,5],geocentr:[0,4],geod:[0,3,5],geodes:[2,5],geodet:2,geograph:[0,4],geographiclib:5,geometri:0,geotiff:4,get:7,get_data_dir:3,get_geod:0,ggrs87:4,git:7,github:[0,2,4,5,6],given:[0,2,4,5],global:5,gohlk:[5,7],googlecod:5,great:[2,5],greek:4,greenwich:0,grid:4,grs67:2,grs80:[2,4],hammer:5,handl:5,has:4,has_invers:4,have:7,hayford:2,helmert:2,hit:4,hough:2,how:7,html:5,http:[0,2,4,5,6,7],huge:5,huge_v:5,iau76:2,iau:2,iclnd:2,ident:5,includ:5,index:6,inf:5,info:0,inform:[0,2,4],init:[4,5],initi:[0,2,4,5],initparam:2,initstr:2,input:[0,2,4,5],insensit:5,instal:[4,5,6],instanc:[0,2,4,5],instead:[2,4,5],instnac:4,instruct:7,integ:[0,4],interfac:6,intermedi:2,intern:[1,2,5,7],intl:2,inv:2,invalid:[4,5],invers:[2,4,5],inverse_flatten:0,involv:2,is_geoc:4,is_geocentr:0,is_geograph:0,is_latlong:4,is_project:0,is_valid:0,is_wkt:3,isea:5,isnan:5,issu:5,iter:4,itransform:[3,5],iugg:2,jefferson:4,jswhit:[6,7],just:5,kaula:2,kei:4,keyword:[0,2,4,5],known:0,krass:2,krassovski:2,kwarg:[0,2,4,5],lab:2,lat1:[2,4],lat2:[2,4],lat:[0,2,4],latest:5,latitud:[0,2,4],latlong:4,lats1:2,lats2:2,lazili:4,lengthunit:0,lerch:2,level:[0,5],lfd:7,lib:5,limb:5,linux:7,list:[0,2,4,5],local:7,locat:[5,7],loewi:5,log:6,logic:5,lon1:[2,4,5],lon2:[2,4,5],lon:[0,2,4],london_lat:2,london_lon:2,longer:5,longitud:[0,2,4],longlat:4,lonlat:2,lons1:2,lons2:2,lost:5,mai:[2,5,7],mail:5,main:2,major:2,make:[0,5],manag:0,manual:2,map:[4,5],mapbox:0,march:5,master:5,match:0,math:2,maupertiu:2,meet:7,mercat:0,mercuri:2,meridian:0,merit:2,messag:5,mesur:2,meter:[2,4,5],method:[0,2,4,5,7],metr:0,microsoft:5,migrat:5,min_confid:0,minor:2,miss:5,missouri:4,mod:2,mod_airi:2,model:2,modifi:[2,5],modul:[5,6],more:[0,2,4],most:0,move:5,mprt:2,must:0,nad27:4,nad83:[0,4],name:[0,5],namibia:2,nan:5,natearth:5,nativ:4,natl:2,natur:0,naval:2,necessari:5,need:[4,5,7],new_intl:2,newyork_lat:2,newyork_lon:2,no_def:[0,4],no_rot:5,none:[0,2,4],normal:2,north:0,note:0,now:5,npt:[2,5],number:[4,5],numpi:[2,4,5],nwl9d:2,nx2:4,nx3:4,obj:0,object:[0,2,4],old:[5,7],older:5,one:[1,2,4,7],onli:[4,5,7],opendatacub:0,option:[0,4,5],order:[0,1,5,7],org:[4,5,7],origin:0,osgeo4w:7,osgeo:[0,2,4,7],other:0,output:[0,2,4],outsid:5,page:6,pair:[2,4],paramet:[0,1,2,4],pass:[2,4],patch:5,path:[1,5,7],perform:[2,4,7],physic:2,pickl:5,pipermail:5,pj_ctx_get_errno:5,pj_ellp:[2,5],pj_errno:5,pj_init:5,pj_list:5,pj_mutex:5,pjx:4,pjy:4,plessi:2,plu:2,poid:2,point:[2,4,5,7],points1:4,points2:4,polar:2,port:5,portland:2,portland_lat:2,portland_lon:2,possibl:5,prefer:[1,7],preserve_unit:[4,5],previou:7,previous:5,prime:0,prime_meridian:0,primem:0,primemeridian:0,privileg:7,problem:5,process:4,proj4:[2,4,5,7],proj:[0,1,2,3,5,6],proj_data_dir:1,proj_dir:[5,7],proj_lib:[1,7],proj_list:4,proj_str:0,proj_wheel:7,projcr:0,projctx:5,project:[0,4,5],projparam:[0,4],properli:5,provid:[4,7],pull:5,pure:5,pxd:5,py_ssize_t:5,pycompat:5,pydoc:5,pyproj:[3,5],pyproject:5,pyqt:5,pyrex:5,python:[0,2,4,5,6],pythonlib:7,pyx:0,r2140:5,r2595:5,rad2dg:2,radian:[2,4,5],radiu:2,rais:[4,5],rasterio:0,read:4,readm:5,reciproc:2,refer:[0,5],regular:[2,4],remotesens:4,remov:[5,7],renam:5,repositori:6,request:5,requir:7,restor:5,result:7,revert:5,rhe:1,rtype:0,run:[5,7],runtime_library_dir:5,sabah:2,safeti:5,sarawak:2,scalar:[2,4],scale:0,scaleunit:0,search:[5,6,7],seasia:2,section:7,see:[0,2,4],segfault:5,semi:2,semi_major_metr:0,semi_minor_metr:0,sequenc:[2,4],set:[1,2,4,5,7],set_data_dir:[3,7],setup:5,sever:2,sgs85:2,shift:[4,5],should:4,singl:2,slight:4,small:5,some:2,sourc:[0,1,2,4,5,7],southeast:2,soviet:2,space:2,spatial:5,specif:2,specifi:[0,2],sphere:2,squar:2,src:5,srs:5,stl:4,store:2,str:[0,1,4],straw:5,string:[0,2,4,5],structur:5,studio:5,style:2,sudo:7,suggest:5,support:5,suppress:5,sure:5,system:[0,2,4,5],take:4,tarbal:5,temporarili:7,ten:2,terminu:2,test:[2,4,5],test_datum:5,text:0,thei:4,thi:[4,5],thread:5,three:4,thu:5,time:4,to_epsg:0,to_geodet:0,to_latlong:[4,5],to_latlong_def:4,to_proj4:0,to_wkt:0,toml:5,towgs84:4,transform:[2,3,5],transproj:5,transvers:0,tupl:[4,5],two:[4,5],type:[0,1,4],uci:7,undefin:5,unit:[0,4],unit_conversion_factor:0,unit_nam:0,uniti:0,unknown:0,unset:7,updat:5,usag:[0,2,4],use:[0,1,2,4,5],used:[4,5],user:[2,7],uses:5,using:[2,4,5],usr:7,usual:5,util:0,utm:[0,4],valid:[0,1,7],valu:[0,4,5],variabl:[2,5,7],variou:0,versa:4,version:[0,4,5,7],vice:4,visual:5,vs2003:5,vs2008:5,wai:7,walbeck:2,weapon:2,well:[0,5],wgs60:2,wgs66:2,wgs72:2,wgs84:[0,2,4],wheel:7,when:[4,5,7],where:[0,4],which:[0,4,5],wiki:[0,2,4],window:[5,7],wkt2_2018:0,wkt:[0,4],work:[2,4,5],www:[4,7],york:2,you:7,your:7,zero:4,zip:2,zone:[0,4]},titles:["CRS","Data Directory","Geod","API Documentation","Proj","Change Log","pyproj Documentation","Installation"],titleterms:{"4rel":5,CRS:0,The:7,api:3,chang:5,clone:7,crs:0,data:[1,7],datadir:1,develop:7,directori:[1,7],document:[3,6],from:7,geod:2,get_data_dir:1,git:5,github:7,indic:6,instal:7,is_wkt:0,itransform:4,log:5,pip:7,proj:[4,7],pypi:7,pyproj:[0,1,2,4,6,7],repo:7,revis:5,set_data_dir:1,setup:7,svn:5,tabl:6,tag:5,transform:4}}) \ No newline at end of file +Search.setIndex({docnames:["api/crs","api/datadir","api/geod","api/index","api/proj","api/transformer","history","index","installation"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:55},filenames:["api/crs.rst","api/datadir.rst","api/geod.rst","api/index.rst","api/proj.rst","api/transformer.rst","history.rst","index.rst","installation.rst"],objects:{"pyproj.Geod":{__init__:[2,1,1,""],fwd:[2,1,1,""],inv:[2,1,1,""],npts:[2,1,1,""]},"pyproj.crs":{CRS:[0,0,1,""],is_wkt:[0,4,1,""]},"pyproj.crs.CRS":{__init__:[0,1,1,""],area_of_use:[0,2,1,""],axis_info:[0,2,1,""],datum:[0,2,1,""],ellipsoid:[0,2,1,""],from_epsg:[0,3,1,""],from_string:[0,3,1,""],from_user_input:[0,3,1,""],get_geod:[0,1,1,""],is_geocentric:[0,2,1,""],is_geographic:[0,2,1,""],is_projected:[0,2,1,""],is_valid:[0,2,1,""],prime_meridian:[0,2,1,""],to_epsg:[0,1,1,""],to_geodetic:[0,1,1,""],to_proj4:[0,1,1,""],to_wkt:[0,1,1,""]},"pyproj.datadir":{get_data_dir:[1,4,1,""],set_data_dir:[1,4,1,""]},"pyproj.proj":{Proj:[4,0,1,""]},"pyproj.proj.Proj":{__call__:[4,1,1,""],__init__:[4,1,1,""],definition_string:[4,1,1,""],has_inverse:[4,2,1,""],is_geocent:[4,1,1,""],is_latlong:[4,1,1,""],to_latlong:[4,1,1,""],to_latlong_def:[4,1,1,""]},"pyproj.transformer":{Transformer:[5,0,1,""],itransform:[5,4,1,""],transform:[5,4,1,""]},"pyproj.transformer.Transformer":{from_crs:[5,5,1,""],from_pipeline:[5,5,1,""],from_proj:[5,5,1,""],itransform:[5,1,1,""],transform:[5,1,1,""]},pyproj:{Geod:[2,0,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","attribute","Python attribute"],"3":["py","classmethod","Python class method"],"4":["py","function","Python function"],"5":["py","staticmethod","Python static method"]},objtypes:{"0":"py:class","1":"py:method","2":"py:attribute","3":"py:classmethod","4":"py:function","5":"py:staticmethod"},terms:{"0rc2":6,"10n":0,"15n":0,"83bae20d2a2469a6417097168fd4ede37fd2abe5":0,"953cc00fd87425395cabe37641cda905c4b587c1":6,"boolean":[5,6],"case":6,"class":[0,2,4,5,6],"default":[0,4,5,6],"export":8,"float":2,"function":[0,5,6],"import":[0,2,4,5],"int":[0,4],"new":[0,2,4,6],"return":[0,1,2,4,5,6],"short":6,"static":5,"switch":5,"true":[0,2,4,5,6,8],"var":6,Added:6,CRS:[3,4,5,6],For:[5,8],GRS:2,The:[0,1,2,4,5],Use:[0,2,8],WGS:[0,2],__call__:[4,5,6],__init__:[0,2,4,6],__reduce__:6,_base:0,_cr:0,_geod:2,_proj:4,_pyproj:6,about:[0,2,4],accept:6,adapt:6,add:6,added:6,addit:[5,6],addition:5,address:6,administr:8,aea:6,against:0,airi:2,alber:6,all:5,allow:[5,6],along:2,alongsid:8,also:[2,5],altern:5,alwai:5,amer:2,america:0,andra:2,andrew:6,angleunit:0,ani:[2,6],antipod:6,api:[6,7],apl4:2,appl:2,area:[0,6],area_of_us:0,areaofus:0,arg:4,argument:[0,2,4],arrai:[2,4,5,6],asia:2,associ:0,assum:5,attribut:0,aust_sa:2,australian:2,avoid:8,axi:[0,2],axis_info:0,axisinfo:0,az12:2,az21:2,azimuth:[2,6],back:[2,6],backaz:2,base:[0,2,4],basegeogcr:0,basemap:6,baz:2,becaus:6,befor:8,belgium:2,below:8,bess_nam:2,bessel:2,best:[0,8],better:6,between:[0,2,5],big:5,binari:[6,8],blanklin:0,blob:0,bool:[0,4],boston:2,boston_lat:2,boston_lon:2,bound:0,broken:6,bug:6,build:8,c13f0943b95c0eaa36ff3f620bd91107aa67b381:0,cach:6,call:[4,6],can:[2,4,5,6,8],cannot:5,care:5,cartesian:0,cartograph:[4,5],cast:4,caus:[4,6],chang:7,chapter:2,check:0,christoph:6,circl:[2,6],citi:[2,4,5],clark:2,classmethod:0,clrk66:[2,5],clrk80:2,code:[0,5,6],coexist:6,columbia:5,com:[0,2,4,7,8],comm:2,command:4,commit:6,compat:[4,6],compil:6,comput:[2,6],conda:8,confid:0,conflict:[6,8],contain:6,content:[3,7],control:[0,4,6],convers:[0,6],convert:[0,4,5],coordin:[0,4,5],core:0,correctli:6,countri:0,courtesi:6,cpm:2,creat:[5,6],crs:3,crs_from:5,crs_to:5,crs_utm:0,current:[0,4,8],cython:[6,8],data:[3,4,5,6],databas:0,datacub:0,datadir:[3,8],datum:[0,2,4,5,6],datumgrid:6,defin:[2,4,5,6],definit:4,definition_str:4,deg:5,degre:[0,2,4,5],delambr:2,delmbr:2,den:2,depend:6,des:2,describ:2,descript:6,determin:2,dev:6,dg2rad:2,dict2str:6,dict:[0,4,6],dictionari:[0,2,4],differ:4,directli:[2,6],directori:[3,6],dispatch:0,dist:2,distanc:2,docstr:6,doctest:6,document:[0,2,4],doe:8,don:6,done:5,doubl:4,download:8,e30:[4,6],earth:2,easiest:8,east:0,eccentr:2,edu:8,effici:6,either:[0,4],ellips:5,ellipsoid:[0,2],ellp:[0,2,4,5],endlat:2,endlon:2,eng:2,ensur:[4,6],env:6,environ:8,epsg:[0,4,5,6],equal:[2,6],equatori:2,errcheck:[4,6],erron:6,error:6,everest:2,evrst30:2,evrst48:2,evrst56:2,evrst69:2,evrstss:2,exampl:[0,2,4,5,6,8],except:[4,6],execut:[6,8],exist:[1,8],expect:5,extra:[5,6],facilit:5,factor:0,fals:[0,2,4,5,6],fantast:0,faster:5,fastest:[4,5],faz:2,feet:4,figur:2,file:[5,6],filesystem:6,filter:6,find:[2,5],first:6,fischer:2,fix:6,flag:6,flatten:2,follow:2,forc:4,forg:8,formal:4,format:[0,4,5],fortran:6,forward:2,fount:8,franc:2,fresno:4,from:[0,2,4,5,6],from_cr:5,from_epsg:0,from_pipelin:[5,6],from_proj:[0,5],from_str:0,from_user_input:[0,6],fschr60:2,fschr60m:2,fschr68:2,further:8,fwd:2,gener:[5,6],geocent:5,geocentr:[0,4,5],geod:[0,3,6],geodes:[2,6],geodet:2,geograph:[0,4,5],geographiclib:6,geometri:0,geotiff:4,get:8,get_data_dir:3,get_geod:0,ggrs87:5,git:8,github:[0,2,4,6,7],given:[0,2,5,6],global:6,goal:5,gohlk:[6,8],googlecod:6,great:[2,6],greek:5,greenwich:0,grid:5,grs67:2,grs80:[2,5],hammer:6,handl:6,has:4,has_invers:4,have:8,hayford:2,helmert:2,hit:4,hough:2,how:8,html:[5,6],http:[0,2,4,5,6,7,8],huge:6,huge_v:6,iau76:2,iau:2,iclnd:2,ident:6,includ:6,index:7,inf:6,info:0,inform:[0,2,4],init:[4,5,6],initi:[0,2,4,5,6],initparam:2,initstr:2,input:[0,2,4,5,6],insensit:6,instal:[5,6,7],instanc:[0,2,4,5,6],instead:[2,5,6],instnac:4,instruct:8,integ:[0,4],interfac:7,intermedi:2,intern:[1,2,6,8],intl:2,inv:2,invalid:[4,6],invers:[2,4,5,6],inverse_flatten:0,involv:2,is_geoc:4,is_geocentr:0,is_geograph:0,is_latlong:4,is_project:0,is_valid:0,is_wkt:3,isea:6,isnan:6,issu:6,iter:5,itransform:[3,6],iugg:2,jefferson:5,jswhit:[7,8],just:6,kaula:2,kei:4,keyword:[0,2,4,5,6],known:0,krass:2,krassovski:2,kwarg:[0,2,4,6],lab:2,lat1:[2,5],lat2:[2,5],lat:[0,2,4,5],latest:6,latitud:[0,2,4],latlong:5,lats1:2,lats2:2,lazili:5,lengthunit:0,lerch:2,level:[0,6],lfd:8,lib:6,limb:6,linux:8,list:[0,2,5,6],local:[6,8],locat:[6,8],loewi:6,log:7,logic:6,lon1:[2,5,6],lon2:[2,5,6],lon:[0,2,4,5],london_lat:2,london_lon:2,longer:6,longitud:[0,2,4],longlat:[4,5],lonlat:2,lons1:2,lons2:2,lost:6,mai:[2,6,8],mail:6,main:2,major:2,make:[0,5,6],manag:0,manual:2,map:[4,6],mapbox:0,march:6,master:6,match:0,math:2,maupertiu:2,meet:8,mercat:0,mercuri:2,meridian:0,merit:2,messag:6,mesur:2,meter:[2,4,5,6],method:[0,2,5,6,8],metr:0,microsoft:6,migrat:6,min_confid:0,minor:2,miss:6,missouri:5,mod:2,mod_airi:2,model:2,modifi:[2,6],modul:[6,7],more:[0,2,4,6],most:0,move:6,mprt:2,multipl:5,must:0,nad27:5,nad83:[0,5],name:[0,6],namibia:2,nan:6,natearth:6,nativ:4,natl:2,natur:0,naval:2,necessari:6,need:[5,6,8],new_intl:2,newyork_lat:2,newyork_lon:2,no_def:[0,4],no_rot:6,none:[0,2,4,5],normal:2,north:0,note:0,now:6,npt:[2,6],number:[5,6],numpi:[2,4,5,6],nwl9d:2,nx2:5,nx3:5,obj:0,object:[0,2,4],old:[6,8],older:6,one:[1,2,5,8],onli:[5,6,8],opendatacub:0,oper:5,option:[0,4,5,6],order:[0,1,6,8],org:[4,5,6,8],origin:0,osgeo4w:8,osgeo:[0,2,4,8],other:0,output:[0,2,5],outsid:6,page:7,pair:[2,4],paramet:[0,1,2,4,5],pass:[2,4],patch:6,path:[1,6,8],perform:[2,4,8],physic:2,pickl:6,pipe_tran:5,pipelin:[5,6],pipeline_str:5,pipermail:6,pj_ctx_get_errno:6,pj_ellp:[2,6],pj_errno:6,pj_init:6,pj_list:6,pj_mutex:6,pjx:5,pjy:5,plessi:2,plu:2,poid:2,point:[2,5,6,8],points1:5,points2:5,polar:2,port:6,portland:2,portland_lat:2,portland_lon:2,possibl:6,prefer:[1,8],preserve_unit:[4,5,6],previou:8,previous:6,prime:0,prime_meridian:0,primem:0,primemeridian:0,privileg:8,problem:6,process:5,proj4:[2,4,5,6,8],proj:[0,1,2,3,5,6,7],proj_data_dir:1,proj_dir:[6,8],proj_from:5,proj_lib:[1,8],proj_list:4,proj_pipelin:5,proj_str:0,proj_to:5,proj_wheel:8,projcr:0,projctx:6,project:[0,4,5,6],projparam:[0,4],properli:6,provid:[5,8],pull:6,pure:6,pxd:6,py_ssize_t:6,pycompat:6,pydoc:6,pyproj:[3,6],pyproject:6,pyqt:6,pyrex:6,python:[0,2,4,5,6,7],pythonlib:8,pyx:0,r2140:6,r2595:6,rad2dg:2,rad:5,radian:[2,4,5,6],radiu:2,rais:[4,6],rasterio:0,read:5,readm:6,reciproc:2,refer:[0,6],regular:[2,4,5],remotesens:4,remov:[6,8],renam:6,repeat:5,repetit:6,repositori:7,request:6,requir:8,restor:6,result:8,revert:6,rhe:1,rtype:0,run:[6,8],runtime_library_dir:6,sabah:2,safeti:6,sarawak:2,scalar:[2,4,5],scale:0,scaleunit:0,search:[6,7,8],seasia:2,section:8,see:[0,2,4],segfault:6,semi:2,semi_major_metr:0,semi_minor_metr:0,sequenc:[2,4],set:[1,2,5,6,8],set_data_dir:[3,8],setup:6,sever:2,sgs85:2,shift:[5,6],should:4,singl:2,slight:4,small:6,some:2,sourc:[0,1,2,4,5,6,8],southeast:2,soviet:2,space:2,spatial:6,specif:2,specifi:[0,2],sphere:2,squar:2,src:6,srs:6,step:5,stl:5,store:2,str:[0,1,4,5],straw:6,string:[0,2,4,5,6],structur:6,studio:6,style:2,sudo:8,suggest:6,support:6,suppress:6,sure:6,system:[0,2,5,6],take:5,tarbal:6,temporarili:8,ten:2,terminu:2,test:[2,4,5,6],test_datum:6,text:0,thei:4,them:5,thi:[4,5,6],thread:6,three:5,thu:6,time:[4,5],to_epsg:0,to_geodet:0,to_latlong:[4,6],to_latlong_def:4,to_proj4:0,to_wkt:0,toml:6,towgs84:4,transform:[2,3,4,6],transproj:[5,6],transprojr:5,transvers:0,tupl:[4,5,6],two:[5,6],type:[0,1,4,5],uci:8,undefin:6,unit:[0,4],unit_conversion_factor:0,unit_nam:0,unitconvert:5,uniti:0,unknown:0,unset:8,updat:6,usag:[0,2,4,5],use:[0,1,2,4,6],used:[5,6],user:[2,8],uses:6,using:[2,4,5,6],usr:8,usual:6,util:0,utm:[0,4,5],valid:[0,1,8],valu:[0,4,5,6],variabl:[2,6,8],variou:0,versa:4,version:[0,4,5,6,8],vice:4,visual:6,vs2003:6,vs2008:6,wai:8,walbeck:2,weapon:2,well:[0,6],wgs60:2,wgs66:2,wgs72:2,wgs84:[0,2,4,5],wheel:8,when:[5,6,8],where:[0,5],which:[0,4,5,6],wiki:[0,2,4],window:[6,8],without:5,wkt2_2018:0,wkt:[0,4],work:[2,4,6],www:[4,8],xpj:5,xpjr:5,xy_in:5,xy_out:5,york:2,you:8,your:8,ypj:5,ypjr:5,zero:5,zip:2,zone:[0,4,5],zpj:5,zpjr:5},titles:["CRS","Data Directory","Geod","API Documentation","Proj","Transformer","Change Log","pyproj Documentation","Installation"],titleterms:{"4rel":6,CRS:0,The:8,api:3,chang:6,clone:8,crs:0,data:[1,8],datadir:1,develop:8,directori:[1,8],document:[3,7],from:8,geod:2,get_data_dir:1,git:6,github:8,indic:7,instal:8,is_wkt:0,itransform:5,log:6,pip:8,proj:[4,8],pypi:8,pyproj:[0,1,2,4,5,7,8],repo:8,revis:6,set_data_dir:1,setup:8,svn:6,tabl:7,tag:6,transform:5}}) \ No newline at end of file