Gryd (version 1.0.10)

Gryd package provides efficient great circle computation and projection
library.
 
EPSG dataset
============
 
All epsg dataset linked to these projections are available through
python API using epsg id or name. Available projections are Mercator,
Transverse Mercator and Lambert Conformal Conic. 
 
Grids
=====
 
The four main grids are available : Universal Transverse Mercator,
Military Grid Reference System, British National Grid and Irish
National Grid.
 
>>> from Gryd import *
>>> dublin = Geodesic(-6.259437, 53.350765, 0.)
>>> utm = Crs(epsg=3395, projection="utm")
>>> utm(dublin)
Grid point area=29U E=682406.211 N=5914792.531, alt=0.000
>>> mgrs = Crs(epsg=3395, projection="mgrs")
>>> mgrs(dublin)
Grid point area=29U PV E=82406.211 N=14792.531, alt=0.000
>>> bng = Crs(projection="bng")
>>> bng(dublin)
Grid point area=SG E=16572.029 N=92252.917, alt=0.000
>>> ing = Crs(projection="ing")
>>> ing(dublin)
Grid point area=O E=15890.887 N=34804.964, alt=0.000
 
Image-map interpolation
=======================
 
``Gryd.Crs`` class also provides functions for map coordinates
interpolation using calibration points. Two points minimum are
required.

 
Package Contents
       
geodesy

 
Classes
       
_ctypes.Structure(_ctypes._CData)
Dmm
Dms
Geocentric
Geographic
Grid
Point
Structure
Crs
Datum
Ellipsoid
Prime
Unit
Vincenty_dest
Vincenty_dist

 
class Crs(Structure)
    >>> pvs = Gryd.Crs(epsg=3785)
>>> osgb36 = Gryd.Crs(epsg=27700)
>>> osgb36.datum.xyz(london)
Geocentric point X=3976632.017 Y=-8814.837 Z=4969286.446
>>> osgb36.datum.ellipsoid.distance(dublin, london)
Distance 463.981km initial bearing=113.6 final bearing=118.5
>>> osgb36
Crs epsg=27700:
- <Datum epsg=4277:
- <Ellispoid epsg=7001 a=6377563.396000 1/f=299.32496460>
- <Prime meridian epsg=8901 longitude=0.000000>
- to wgs84 446.45,-125.16,542.06,-20.49,0.15,0.25,0.84>
- <Unit epsg=9001 ratio=1.0>
- <Projection 'tmerc'>
 
 
Method resolution order:
Crs
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__call__(self, element)
>>> osgb36(london) # projection of Geodesic point
Geographic point X=529939.106 Y=181680.962s alt=0.000
>>> osgb36(osgb36(london)) # deprojection of Geographic point
Geodesic point lon=-000°07'37.218'' lat=+051°31'6.967'' alt=0.000
__init__(self, *args, **kwargs)
__reduce__(self)
__repr__(self)
__setattr__(self, attr, value)
add_map_point(self, px, py, point)
>>> pvs.add_map_point(0,0, Geodesic(-179.999, 85))
>>> pvs.add_map_point(512,512, Geodesic(179.999, -85))
crs2map(self, point)
>>> pvs.crs2map(pvs.map2crs(256+128, 256+128))
Reference point px=384 py=384
- <Geodesic point lon=+089°59'58.20'' lat=-066°23'43.74'' alt=0.000>
- <Geographic point X=10018698.512 Y=-9985934.440s alt=0.000>
delete_map_point(self, px=None, py=None, index=None)
map2crs(self, px, py, geographic=False)
>>> pvs.map2crs(256+128, 256+128)
Geodesic point lon=+089°59'58.20'' lat=-066°23'43.74'' alt=0.000
>>> pvs.map2crs(256-128, 256+128, geographic=True)
Geographic point X=-10018698.512 Y=-9985934.440s alt=0.000
transform(self, dst, xya)
>>> osgb36.transform(pvs, osgb36(london))
Geographic point X=-14317.072 Y=6680144.273s alt=-13015.770
>>> pvs.transform(osgb36, osgb36.transform(pvs, osgb36(london)))
Geographic point X=529939.101 Y=181680.963s alt=0.012
>>> osgb36(london)
Geographic point X=529939.106 Y=181680.962s alt=0.000

Data descriptors defined here:
azimut
Structure/Union member
datum
Structure/Union member
epsg
Structure/Union member
k0
Structure/Union member
lambda0
Structure/Union member
phi0
Structure/Union member
phi1
Structure/Union member
phi2
Structure/Union member
unit
Structure/Union member
x0
Structure/Union member
y0
Structure/Union member

 
class Datum(Structure)
    >>> Gryd.Datum(epsg=4326)
Datum epsg=4326:
- <Ellispoid epsg=7030 a=6378137.000000 1/f=298.25722356>
- <Prime meridian epsg=8901 longitude=0.000000>
- to wgs84 0.0,0.0,0.0,0.0,0.0,0.0,0.0
 
 
Method resolution order:
Datum
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)
__setattr__(self, attr, value)
lla(self, xyz)
>>> wgs84.lla(wgs84.xyz(london))
Geodesic point lon=-000°07'37.218'' lat=+051°31'6.967'' alt=0.000
>>> london
Geodesic point lon=-000°07'37.218'' lat=+051°31'6.967'' alt=0.000
transform(self, dst, lla)
>>> airy = Gryd.Datum(epsg=4277)
>>> wgs84.transform(airy, london)
Geodesic point lon=-000°07'31.431'' lat=+051°31'5.137'' alt=-46.118
xyz(self, lla)
>>> wgs84.xyz(london)
Geocentric point X=3977018.848 Y=-8815.695 Z=4969650.564

Data descriptors defined here:
ds
Structure/Union member
dx
Structure/Union member
dy
Structure/Union member
dz
Structure/Union member
ellipsoid
Structure/Union member
epsg
Structure/Union member
prime
Structure/Union member
rx
Structure/Union member
ry
Structure/Union member
rz
Structure/Union member

 
class Dmm(_ctypes.Structure)
    >>> Gryd.Dmm(sign=1, degree=60, minute=25.372108333333188)
+060°25.3721083´
>>> Gryd.Dmm(0, 60, 25.372108333333188)
-060°25.3721083´
>>> float(Gryd.Dmm(0, 60, 25.372108333333188))
-60.42286847222222
 
 
Method resolution order:
Dmm
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__float__(self)
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
degree
Structure/Union member
minute
Structure/Union member
sign
Structure/Union member

 
class Dms(_ctypes.Structure)
    >>> Gryd.Dms(sign=1, degree=60, minute=25, second=22.3265)
+060°25´22.33´´
>>> Gryd.Dms(0, 60, 25, 22.3265)
-060°25´22.33´´
>>> float(Gryd.Dms(0, 60, 25, 22.3265))
-60.42286847222222
 
 
Method resolution order:
Dms
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__float__(self)
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
degree
Structure/Union member
minute
Structure/Union member
second
Structure/Union member
sign
Structure/Union member

 
class Ellipsoid(Structure)
    >>> wgs84 = Gryd.Ellipsoid(name="WGS 84")
>>> wgs84
Ellispoid epsg=7030 a=6378137.000000 1/f=298.25722356
 
 
Method resolution order:
Ellipsoid
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)
__setattr__(self, attr, value)
destination(self, lla, bearing, distance)
>>> wgs84.destination(london, math.degrees(vdist.final_bearing)+180, vdist.distance)
Destination lon=-006°15'33.973'' lat=+053°21'2.754'' end bearing=-66.4
>>> dublin
Geodesic point lon=-006°15'33.973'' lat=+053°21'2.754'' alt=0.000
distance(self, lla0, lla1)
>>> london = Gryd.Geodesic(-0.127005, 51.518602, 0.)
>>> dublin = Gryd.Geodesic(-6.259437, 53.350765, 0.)
>>> wgs84.distance(dublin, london)
Distance 464.025km initial bearing=113.6 final bearing=118.5
npoints(self, lla0, lla1, n)
>>> for p in wgs84.npoints(dublin, londre, 4): print(p)
...
Destination lon=-006°15'33.973'' lat=+053°21'2.754'' end bearing=113.6
Destination lon=-004°59'32.422'' lat=+053°00'36.687'' end bearing=114.6
Destination lon=-003°44'43.501'' lat=+052°39'22.715'' end bearing=115.6
Destination lon=-002°31'7.792'' lat=+052°17'22.201'' end bearing=116.6
Destination lon=-001°18'45.650'' lat=+051°54'36.502'' end bearing=117.5
Destination lon=-000°07'37.218'' lat=+051°31'6.967'' end bearing=118.5

Data descriptors defined here:
a
Structure/Union member
b
Structure/Union member
e
Structure/Union member
epsg
Structure/Union member
f
Structure/Union member

 
class Geocentric(_ctypes.Structure)
    ctypes structure for geocentric coordinates. Attributes :
 * x -> X-axis value
 * y -> Y-axis value
 * z -> Z-axis value
 
>>> Gryd.Geocentric(x=4457584, y=429216, z=4526544)
Geocentric point X=4457584.000 Y=429216.000 Z=4526544.000
 
 
Method resolution order:
Geocentric
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
x
Structure/Union member
y
Structure/Union member
z
Structure/Union member

 
class Geographic(_ctypes.Structure)
    ctypes structure for geographic coordinates. 2D coordinates on flattened
earth (usng a projection system) with altitude as third dimension. Attributes :
 * x -> X-projection-axis value
 * y -> Y-projection-axis value
 * altitude
 
>>> Gryd.Geographic(x=5721186, y=2948518, altitude=105)
Geographic point X=5721186.000 Y=2948518.000 alt=105.000
 
 
Method resolution order:
Geographic
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
altitude
Structure/Union member
x
Structure/Union member
y
Structure/Union member

 
class Grid(_ctypes.Structure)
    ctypes structure for grided coordinates. Another coordinates system
applied on flattened earth. It is defined by an area, a 2D coordinates and
altitude. Attributes :
 * area -> string region
 * easting -> X-grid-axis value
 * northing -> Y-grid-axis value
 
>>> Gryd.Grid(area="31T", easting=925595, northing=5052949, altitude=105)
Grid point area=31T E=925595.000 N=5052949.000, alt=105.000
 
 
Method resolution order:
Grid
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
altitude
Structure/Union member
easting
Structure/Union member
northing
Structure/Union member

 
class Point(_ctypes.Structure)
    ctypes structure for calibration point. Attributes :
* px -> pixel column position
* py -> pixel row position
* lla -> Gryd.Geodesic associated to the pixel coordinates
* xya -> Gryd.Geographic associated to the pixel coordinates
 
 
Method resolution order:
Point
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
lla
Structure/Union member
px
Structure/Union member
py
Structure/Union member
xya
Structure/Union member

 
class Prime(Structure)
    >>> Gryd.Prime(longitude=3.1416)
Prime meridian epsg=0 longitude=180.000421
>>> Gryd.Prime(epsg=8902)
Prime meridian epsg=8902 longitude=-9.131906
>>> Gryd.Prime(epsg=8902).name
'Lisbon'
>>> float(Gryd.Prime(epsg=8902))
-0.15938182862188002
 
 
Method resolution order:
Prime
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__float__(self)
__repr__(self)

Data descriptors defined here:
epsg
Structure/Union member
longitude
Structure/Union member

 
class Structure(_ctypes.Structure)
    ctypes structure with a sqlite connection for initialization purpose.
 
 
Method resolution order:
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__init__(self, *args, **pairs)
if keyword argument is given, it searches in sqlite database an entry matching
the given pair. If list of values is given, structure members are initialized in the
order of the field definition.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Unit(Structure)
    >>> Gryd.Unit(epsg=9001)
Unit epsg=9001 ratio=1.0
>>> Gryd.Unit(epsg=9001).name
'metre'
>>> Gryd.Unit(name="foot")
Unit epsg=9002 ratio=3.2808693302666354
>>> Gryd.Unit(epsg=9002).name
'foot'
>>> float(Gryd.Unit(name="foot"))
3.2808693302666354
 
 
Method resolution order:
Unit
Structure
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__float__(self)
__repr__(self)

Data descriptors defined here:
epsg
Structure/Union member
ratio
Structure/Union member

 
class Vincenty_dest(_ctypes.Structure)
    >>> vdest = wgs84.destination(london, math.degrees(vdist.final_bearing)+180, vdist.distance)
>>> vdest
Destination lon=-006°15'33.973'' lat=+053°21'2.754'' end bearing=-66.4
>>> dublin
Geodesic point lon=-006°15'33.973'' lat=+053°21'2.754'' alt=0.000
>>> vdest.longitude, vdest.latitude, vdest.destination_bearing
(-0.10924778507143726, 0.9311465077339985, -1.1589622298392817)
 
 
Method resolution order:
Vincenty_dest
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
destination_bearing
Structure/Union member
latitude
Structure/Union member
longitude
Structure/Union member

 
class Vincenty_dist(_ctypes.Structure)
    >>> wgs84 = Gryd.Ellipsoid(name="WGS 84") # WGS 84 ellipsoid
>>> london = Gryd.Geodesic(-0.127005, 51.518602, 0.)
>>> dublin = Gryd.Geodesic(-6.259437, 53.350765, 0.)
>>> vdist = wgs84.distance(dublin, london)
>>> vdist
Distance 464.025km initial bearing=113.6 final bearing=118.5
>>> vdist.distance, vdist.initial_bearing, vdist.final_bearing
(464025.2235062019, 1.9826304238310775, 2.0675106301597674)
 
 
Method resolution order:
Vincenty_dist
_ctypes.Structure
_ctypes._CData
builtins.object

Methods defined here:
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
distance
Structure/Union member
final_bearing
Structure/Union member
initial_bearing
Structure/Union member

 
Author
        Bruno THOORENS