Trees | Indices | Help |
|
---|
|
object --+ | dict --+ | KeyedPoints
Since: 2008-05-02
|
|||
new empty dictionary |
|
||
str
|
|
||
|
|||
list of float
|
|
||
list of float
|
|
||
list of float
|
|
||
list of 2 tuple of float
|
|
||
list of Point instance
|
|
||
list of Point objects within specified range
|
|
||
|
|||
|
|||
list of datetime.datetime
|
|
||
list of datetime.datetime
|
|
||
list of 2 tuple of datetime.datetime
|
|
||
list of str
|
|
||
Inherited from Inherited from |
|
|||
Inherited from |
|
Initialise a new KeyedPoints object >>> KeyedPoints({"a": Point(52.015, -0.221), "b": Point(53.645, -0.284)}) KeyedPoints({'a': Point(52.015, -0.221, 'metric', 'degrees', 0), 'b': Point(53.645, -0.284, 'metric', 'degrees', 0)}, False, 'metric') |
Self-documenting string representation >>> locations = {"a": Point(0, 0), "b": Point(0,0)} >>> KeyedPoints(locations) KeyedPoints({'a': Point(0.0, 0.0, 'metric', 'degrees', 0), 'b': Point(0.0, 0.0, 'metric', 'degrees', 0)}, False, 'metric')
|
Import locations from arguments >>> locations = KeyedPoints() >>> locations.import_locations([("prime", "0;0"), ... ("home", "52.015 -0.221")]) >>> locations KeyedPoints({'prime': Point(0.0, 0.0, 'metric', 'degrees', 0), 'home': Point(52.015, -0.221, 'metric', 'degrees', 0)}, False, 'metric')
|
Calculate distances between locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> "%.3f" % sum(locations.distance(("home", "Carol", "Kenny"))) '111.632'
|
Calculate bearing between locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> map(lambda x: "%.3f" % x, ... locations.bearing(("home", "Carol", "Kenny"))) ['46.242', '28.416']
|
Calculate final bearing between locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> map(lambda x: "%.3f" % x, ... locations.final_bearing(("home", "Carol", "Kenny"))) ['46.448', '28.906']
|
Calculate the inverse geodesic between locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> locations.inverse(("home", "Carol", "Kenny")) [(46.242393198024672, 24.629669163425465), (28.416173848453582, 87.002075833085328)]
|
Calculate the midpoint between locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> locations.midpoint(("home", "Carol", "Kenny")) [Point(52.0915720432, -0.0907237539143, 'metric', 'degrees', 0), Point(52.5119010509, 0.346088603087, 'metric', 'degrees', 0)]
|
Test whether locations are within a given range of the first >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> list(locations.range(Point(52.015, -0.221), 20)) [('home', Point(52.015, -0.221, 'metric', 'degrees', 0))] |
Calculate destination locations for given distance and bearings >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> list(locations.destination(42, 240)) [('home', Point(53.5956078217, 2.2141813684, 'metric', 'degrees', 0)), ('Carol', Point(53.7484691495, 2.48403821375, 'metric', 'degrees', 0)), ('Kenny', Point(54.4348338045, 3.14183478498, 'metric', 'degrees', 0))]
|
Calculate destination locations for given distance and bearings >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> list(locations.destination(42, 240)) [('home', Point(53.5956078217, 2.2141813684, 'metric', 'degrees', 0)), ('Carol', Point(53.7484691495, 2.48403821375, 'metric', 'degrees', 0)), ('Kenny', Point(54.4348338045, 3.14183478498, 'metric', 'degrees', 0))]
|
Calculate sunrise times for locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> import datetime >>> list(locations.sunrise(datetime.date(2008, 5, 2))) [('home', datetime.time(4, 28)), ('Carol', datetime.time(4, 26)), ('Kenny', datetime.time(4, 21))]
|
Calculate sunset times for locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> import datetime >>> list(locations.sunset(datetime.date(2008, 5, 2))) [('home', datetime.time(19, 29)), ('Carol', datetime.time(19, 28)), ('Kenny', datetime.time(19, 28))]
|
Calculate sunrise/sunset times for locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> import datetime >>> list(locations.sun_events(datetime.date(2008, 5, 2))) [('home', (datetime.time(4, 28), datetime.time(19, 29))), ('Carol', (datetime.time(4, 26), datetime.time(19, 28))), ('Kenny', (datetime.time(4, 21), datetime.time(19, 28)))]
|
Calculate Maidenhead locator for locations >>> locations = KeyedPoints([("home", "52.015;-0.221"), ... ("Carol", "52.168;0.040"), ... ("Kenny", "52.855;0.657")], ... parse=True) >>> list(locations.to_grid_locator("extsquare")) [('home', 'IO92va33'), ('Carol', 'JO02ae40'), ('Kenny', 'JO02hu85')] >>> list(locations.to_grid_locator("subsquare")) [('home', 'IO92va'), ('Carol', 'JO02ae'), ('Kenny', 'JO02hu')]
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue May 20 12:41:37 2008 | http://epydoc.sourceforge.net |