Fast lon, lat to BNG conversion
Project description
===============================================
Fast lon, lat to BNG conversion, and vice versa
===============================================
| Uses a Rust 1.x binary to perform fast longitude, latitude to `BNG <https://en.wikipedia.org/wiki/Ordnance_Survey_National_Grid>`_ conversion.
| This module exposes two methods:
| ``util.convertbng()`` – pass sequences (such as lists or numpy arrays) of lons, lats, or single values of each. Returns a list of two lists containing Easting and Northing integers (longs), respectively
| ``util.convertlonlat_list()`` – pass sequences (such as lists or numpy arrays) of Eastings, Northings, or single values of each. Returns a list of two lists containing Longitude and Latitude floats, respectively
| NOTE: Coordinate pairs outside the BNG bounding box will return a result of
``[[9999], [9999]]``, which cannot be mapped. Since transformed coordinates are guaranteed to be returned in the same order as the input, it is trivial to check for this value. Alternatively, ensure your data fall within the bounding box before transforming them:
| **Latitude**:
| East: 1.768960
| West: -6.379880
| **Longitude**:
| North: 55.811741
| South: 49.871159
Installation
============
| Installation as a binary wheel using pip, for OS X:
| ``pip install convertbng``
| Binary wheels aren't yet available for Linux or Windows, but installation directly from Github works:
| ``pip install git+git://github.com/urschrei/convertbng.git``
Usage
=====
.. code-block:: python
from convertbng.util import convertbng, convertlonlat
# convert a single value
res = convertbng(lon, lat)
# convert lists of longitude and latitude values to BNG Eastings and Northings
lons = [lon1, lon2, lon3]
lats = [lat1, lat2, lat3]
res_list = convertbng(lons, lats)
# convert lists of BNG Eastings and Northings to longitude, latitude
eastings = [easting1, easting2, easting3]
northings = [northing1, northing2, northing3]
res_list_en = convertlonlat(eastings, northings)
# assumes numpy imported as np
lons_np = np.array(lons)
lats_np = np.array(lats)
res_list_np = convertbng(lons_np, lats_np)
Testing
=======
Run ``nosetests`` (requires `Nose <http://nose.readthedocs.org/en/latest/>`_)
Fast lon, lat to BNG conversion, and vice versa
===============================================
| Uses a Rust 1.x binary to perform fast longitude, latitude to `BNG <https://en.wikipedia.org/wiki/Ordnance_Survey_National_Grid>`_ conversion.
| This module exposes two methods:
| ``util.convertbng()`` – pass sequences (such as lists or numpy arrays) of lons, lats, or single values of each. Returns a list of two lists containing Easting and Northing integers (longs), respectively
| ``util.convertlonlat_list()`` – pass sequences (such as lists or numpy arrays) of Eastings, Northings, or single values of each. Returns a list of two lists containing Longitude and Latitude floats, respectively
| NOTE: Coordinate pairs outside the BNG bounding box will return a result of
``[[9999], [9999]]``, which cannot be mapped. Since transformed coordinates are guaranteed to be returned in the same order as the input, it is trivial to check for this value. Alternatively, ensure your data fall within the bounding box before transforming them:
| **Latitude**:
| East: 1.768960
| West: -6.379880
| **Longitude**:
| North: 55.811741
| South: 49.871159
Installation
============
| Installation as a binary wheel using pip, for OS X:
| ``pip install convertbng``
| Binary wheels aren't yet available for Linux or Windows, but installation directly from Github works:
| ``pip install git+git://github.com/urschrei/convertbng.git``
Usage
=====
.. code-block:: python
from convertbng.util import convertbng, convertlonlat
# convert a single value
res = convertbng(lon, lat)
# convert lists of longitude and latitude values to BNG Eastings and Northings
lons = [lon1, lon2, lon3]
lats = [lat1, lat2, lat3]
res_list = convertbng(lons, lats)
# convert lists of BNG Eastings and Northings to longitude, latitude
eastings = [easting1, easting2, easting3]
northings = [northing1, northing2, northing3]
res_list_en = convertlonlat(eastings, northings)
# assumes numpy imported as np
lons_np = np.array(lons)
lats_np = np.array(lats)
res_list_np = convertbng(lons_np, lats_np)
Testing
=======
Run ``nosetests`` (requires `Nose <http://nose.readthedocs.org/en/latest/>`_)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
convertbng-0.2.3.tar.gz
(1.4 MB
view hashes)
Built Distribution
Close
Hashes for convertbng-0.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0770cb171d7075898bc6d41d70efc2955ce448c03cb90a79532586e7ff7eac5 |
|
MD5 | 1cb9dd089c6a8a5c83cb1a9cdf016d7a |
|
BLAKE2b-256 | a4a095a9adb3e0276f42dbd746afee048f556a2c17c61c0fa081c418b429ecf1 |