Package pygeodesy :: Module points :: Class Tuple2LatLon |
[frames] | no frames]

# Class Tuple2LatLon

           object --+
                    |
        _abcoll.Sized --+
                        |
           object --+   |
                    |   |
     _abcoll.Iterable --+
                        |
           object --+   |
                    |   |
    _abcoll.Container --+
                        |
         _abcoll.Sequence --+
                            |
                  _Basequence --+
                                |
                    _Array2LatLon --+
                                    |
                                   Tuple2LatLon

Wrapper for tuple sequences as "on-the-fly" LatLon points.

Nested Classes
Inherited from `_abcoll.Sized`: `__metaclass__`

Instance Methods
__init__(self, tuples, ilat=0, ilon=1, LatLon=None) Handle a list of tuples, each containing a lat- and longitude and perhaps other values as a sequence of LatLon points. |
Inherited from `_Array2LatLon`: `__contains__`, `__getitem__`, `__iter__`, `__len__`, `__repr__`, `__reversed__`, `__str__`, `count`, `find`, `findall`, `index`, `point`, `rfind`, `subset` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`

Class Methods
Inherited from `_abcoll.Sized`: `__subclasshook__`

Class Variables
Inherited from `_Array2LatLon`: `__abstractmethods__`

Properties
| isTuple2 Is this a Tuple2 wrapper?
Inherited from `_Array2LatLon`: `epsilon`, `ilat`, `ilon`, `shape` Inherited from `_Basequence`: `isNumpy2`, `isPoints2` Inherited from `object`: `__class__`

Method Details

### __init__(self, tuples, ilat=0, ilon=1, LatLon=None) (Constructor) |
Handle a list of tuples, each containing a lat- and longitude and perhaps other values as a sequence of LatLon points. Parameters: `tuples` - List, tuple or sequence of tuples (list). `ilat` - Optional index of the latitudes value (integer). `ilon` - Optional index of the longitudes value (integer). `LatLon` - Optional LatLon class to use (internal). Raises: `IndexError` - If (len(tuples), min(len(t) for t in tuples)) is not (1+, 2+). `TypeError` - If tuples is not a list, tuple or sequence or if LatLon is not a class with lat and lon attributes. `ValueError` - If the ilat and/or ilon values are the same or out of range. Overrides: object.__init__ Example:
    >>> tuples = [(0, 1), (2, 3), (4, 5)]
    >>> type(tuples)
    <type 'list'>  # <class ...> in Python 3+
    >>> points = Tuple2LatLon(tuples, lat=0, lon=1)
    >>> simply = simplifyRW(points, 0.5, ...)
    >>> type(simply)
    <type 'list'>  # <class ...> in Python 3+
    >>> simply
    [(0, 1), (4, 5)]
    >>> sliced = points[1:-1]
    >>> type(sliced)
    <class '...Tuple2LatLon'>
    >>> sliced
    ...Tuple2LatLon([(2, 3), ...][1], ilat=0, ilon=1)
    >>> closest, _ = nearestOn2(LatLon_(2, 1), points, adjust=False)
    >>> closest
    LatLon_(lat=1.0, lon=2.0)
    >>> closest, _ = nearestOn2(LatLon_(3, 2), points)
    >>> closest
    LatLon_(lat=2.001162, lon=3.001162)

Property Details

### isTuple2 Is this a Tuple2 wrapper? Get Method: isTuple2(self) - Is this a Tuple2 wrapper? Set Method: Read_Only(self, ignored) - Throws an `AttributeError`, always.