Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Diblo Geo

Diblo Geo is a Python 2 api for developer.

Diblo Geo makes it easy for Python developers to calculate coordinates and bearing across the globe.

Diblo Geo is tested against CPython 2.7.

Development site.

© Diblo Geo contributors 2016 under the The GNU General Public License v3.0.

Installation

Install using pip with:

pip install diblogeo

Or, download a wheel or source archive from PyPI.

Measuring Distances

Example 1:

>>> from diblogeo import Geo
>>> distance = Geo((55.3303636516, 10.4466164796)) \
...            .distance((55.3706593849, 10.469825563))
>>> print(distance)
4.70941600331
>>> print(distance.kilometers)
4.71
>>> print(distance.feet)
15450.84

Example 2 (Altitude 11.34 meters):

>>> from diblogeo import Geo
>>> distance = Geo((55.3303636516, 10.4466164796, 11.34)) \
...            .distance((55.3706593849, 10.469825563, 11.34))
>>> print(distance)
4.71780808395
>>> print(distance.kilometers)
4.72
>>> print(distance.feet)
15478.37

Measuring Angles

>>> from diblogeo import Geo
>>> bearing = Geo((55.3303636516, 10.4466164796)) \
...           .bearing((55.3706593849, 10.469825563))
>>> print(bearing)
18.1225041609
>>> print(bearing.degrees)
18.12
>>> print(bearing.radians)
0.316297366315

Projecting Destinations

Example 1:

>>> from diblogeo import Geo
>>> point = Geo((55.3303636516, 10.4466164796))
>>> point.destination(37.2, 3.2)
(55.3533088458, 10.4772564424, 0)
>>> point.destination(bearing=37.2, kilometers=3.2)
(55.3533088458, 10.4772564424, 0)
>>> point.destination(37.2, meters=3200)
(55.3533088458, 10.4772564424, 0)

Example 2 (Altitude 11.34 meters):

>>> from diblogeo import Geo
>>> point = Geo((55.3303636516, 10.4466164796, 11.34))
>>> point.destination(37.2, 3.2)
(55.3532680374, 10.4772019082, 11.34)
>>> point.destination(bearing=37.2, kilometers=3.2)
(55.3532680374, 10.4772019082, 11.34)
>>> point.destination(37.2, meters=3200)
(55.3532680374, 10.4772019082, 11.34)

Calculate Earth’s Radius

>>> from diblogeo import calc_earth_radius
>>> earth_radius = calc_earth_radius((55.3303636516, 10.4466164796, 11.34))
>>> print(earth_radius)
6375.05118755
>>> print(earth_radius.kilometers)
6375.05
>>> print(earth_radius.miles)
3961.27

More input and output methods

>>> from diblogeo import Geo
>>> location = Geo(("55° 19' 49.31\"", "10° 26' 47.82\"", 11.34)) \
...            .destination(37.2, miles=3.2)
>>> print(location.latitude, location.longitude, location.altitude)
(55.367221177288684, 10.495856496671713, 11.34)
>>> print(location[0], location[1], location[2])
(55.367221177288684, 10.495856496671713, 11.34)
>>> print(location.dms)
((55, 22, 1.99624, 'N'), (10, 29, 45.08339, 'E'), 11.34)
>>> print(location.dms.latitude, location.dms.longitude, location.altitude)
((55, 22, 1.99624, 'N'), (10, 29, 45.08339, 'E'), 11.34)

Locations/ Points Attributes

The attributes can be used with Geo and destination.

Decimal Degrees:

  • location, loc, dd

  • latitude, lat

  • longitude, lon

  • elevations, altitude, alt

location, loc and dd return an instance of _Point

  • [_Point].latitude, [_Point].lat

  • [_Point].longitude, [_Point].lon

  • [_Point].elevations, [_Point].altitude, [_Point].alt

Degrees Minutes Seconds:

  • dms

  • dms.latitude, dms.lat

  • dms.longitude, dms.lon

  • dms.elevations, dms.altitude, dms.alt

Unit of measurement

The attributes can be used with distance and calc_earth_radius. Destination supports all the units as distance argument.

  • kilometers, km

  • meters, m

  • cm

  • miles, mi

  • feet, ft

  • nautical, nm, nmi

Angle Units

The attributes can be used with bearing.

  • degrees, deg

  • radians, rad

Metadata

Release files for diblogeo 0.1.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diblogeo 0.1.0rc3
File Size Uploaded Provenance Actions
diblogeo-0.1.0rc3.tar.gz 20.1 kB Without provenance Details for diblogeo-0.1.0rc3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for diblogeo 0.1.0rc3
File Interpreter ABI Platform Actions
diblogeo-0.1.0rc3-py2-none-any.whl Python 2 none any Details for diblogeo-0.1.0rc3-py2-none-any.whl

Total release size: 28.8 kB

Release files / diblogeo-0.1.0rc3.tar.gz

Download URL diblogeo-0.1.0rc3.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1fb6c222ddbfd9569337ebf7f7acfb384642728ff4753ffd03f723967bf85f55
BLAKE2b-256 checksum
How to use checksums
e77a34593afa6d3779f23f33183451de2b8d14c20add25557de4c4385c0d5811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / diblogeo-0.1.0rc3-py2-none-any.whl

Download URL diblogeo-0.1.0rc3-py2-none-any.whl
Size 8.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
dba8bc0ab80bcccabbf8e5268d4f54d4da22700ca71838eeb9d95bb677fd8d06
BLAKE2b-256 checksum
How to use checksums
5870d975f92c393bccfb2a83f2c2685660be78b83370b2b5a1fa74d7892c590c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for diblogeo 0.1.0rc3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page