Home | Trees | Indices | Help |
---|
|
object --+ | _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 'radians' is True (default is False) lon/lat are interpreted as radians instead of degrees. 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.
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
Static Methods | |||
a new object with type S, a subtype of T |
|
Properties | |
Inherited from Inherited from |
Method Details |
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 'radians' is True (default is False) the units of lon/lat are radians instead of degrees. 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. |
initialize a Proj class instance. Proj4 projection control parameters must either be given in a dictionary 'projparams' or as keyword arguments. See the proj documentation (https://github.com/OSGeo/proj.4/wiki) for more information about specifying projection parameters. Example usage: >>> from pyproj import Proj >>> p = Proj(proj='utm',zone=10,ellps='WGS84') # 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') # 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") >>> 'x=%12.3f y=%12.3f (meters)' % p(-114.057222, 51.045) 'x=-1783486.760 y= 6193833.196 (meters)' >>> p = Proj("+init=epsg:32667",preserve_units=True) >>> 'x=%12.3f y=%12.3f (feet)' % p(-114.057222, 51.045) 'x=-5851322.810 y=20320934.409 (feet)'
|
Returns formal definition string for projection >>> Proj('+init=epsg:4326').definition_string() ' +units=m +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0' >>>
|
returns True if projection in geocentric (x/y) coordinates
|
returns True if projection in geographic (lon/lat) coordinates
|
returns an equivalent Proj in the corresponding lon/lat coordinates. (see pj_latlong_from_proj() in the Proj.4 C API)
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Nov 13 18:49:17 2019 | http://epydoc.sourceforge.net |