__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.
- Arguments:
tuples - The list , tuple or
sequence of tuples (tuple []).
ilat - Optional index of the latitudes value (int ).
ilon - Optional index of the longitudes value (int ).
LatLon - Optional LatLon class to use (LatLon_).
- 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 LatLon with
lat , lon and name
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)
|