PyBNG


NamePyBNG JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/ThunderStruct/PyBNG
SummaryA library to convert BNG/OSNG coordinates
upload_time2025-10-22 19:23:18
maintainerNone
docs_urlNone
authorMohamed Shahawy
requires_python>=3.6
licenseNone
keywords gis mapping coordinates grid-reference mapping ordiance-survey lat-long bng all-numeric
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # PyBNG
[![Build Status](https://travis-ci.org/ThunderStruct/PyBNG.svg?branch=master)](https://travis-ci.org/ThunderStruct/PyBNG) [![pypi](https://img.shields.io/badge/pypi%20package-0.2.0-lightgrey.svg)](https://pypi.org/project/PyBNG/0.2.0/) [![Python](https://img.shields.io/badge/python-3.5^-blue.svg)](https://github.com/ThunderStruct/PyBNG) [![License](https://img.shields.io/cocoapods/l/AFNetworking.svg)](https://github.com/ThunderStruct/PyBNG/blob/master/LICENSE)

An Ordinance-Survey National Grid coordinates converter

------------------------

## Getting Started
PyBNG is built on top of [OSGridConverter](https://github.com/jdstmporter/OSGridConverter/) and is used to convert coordinates from the Ordnance Survey National Grid system (often called the British National Grid -- *BNG*) to latitude and longitude using `WGS84` (other geodetic reference systems available).

While OSGridConverter can convert BNG to latitude and longitude, it does not support all-numeric grid references, which is the primary feature in this library.

### Installation
#### PIP (recommended)

```sh
pip install PyBNG
```
#### Manual Installation
Simply clone the entire repo and extract the files in the `PyBNG` folder, then copy all the content to your project folder

Or use one of the shorthand methods below
##### GIT
  - `cd` into your project directory
  - Use `sparse-checkout` to pull the library files only into your project directory
    ```sh
    git init PyBNG
    cd PyBNG
    git remote add -f origin https://github.com/ThunderStruct/PyBNG.git
    git config core.sparseCheckout true
    echo "PyBNG/*" >> .git/info/sparse-checkout
    git pull --depth=1 origin master
    ```
   - Import the newly pulled files into your project folder

##### SVN
  - `cd` into your project directory
  - `checkout` the library files
    ```sh
    svn checkout https://github.com/ThunderStruct/PyBNG/trunk/PyBNG
    ```
  - Import the newly checked out files into your project folder
  

### Usage
#### Initialization
A `PyBNG` object can be instantiated as follows:

```python
from PyBNG import PyBNG

bng = PyBNG(easting=519080, northing=185050)

latlon = PyBNG(lat=51.55178424773851, lon= -0.2835125528796557)
```
The initializer expects `easting` and `northing` *OR* `lat` and `lon` parameters, depending on the required conversion


### Methods

  - `get_latlon(datum='WGS84')`:
    - Description: calculates the latitude and logitude based on the given BNG coordinates
    - Parameters: none (passed to constructor)
    - Return Value: tuple -- (latitude, longitude)
    - Usage: 
        ```python
        from PyBNG import PyBNG

        bng = PyBNG(easting=519080, northing=185050)
        bng.get_latlon()     # (51.55178424773851, -0.2835125528796557)
        ```
  - `get_bng(datum='WGS84')`:
    - Description: calculates the BNG coordinates given a latitude and a longitude
    - Parameters: none (passed to constructor)
    - Return Value: typle -- (easting, northing)
    - Usage: 
        ```python
        from PyBNG import PyBNG

        latlon = PyBNG(lat=51.55178424773851, lon= -0.2835125528796557)
        latlon.get_bng()     # (519107, 185051)
        ```
*Please note that converting BNG coordinates to latitude/longitude and back to BNG will yield different results due to internal float rounding*

### Acknowledgment
I would like to thank [Dr. Lakshmi Babu-Saheer](mailto:lakshmi.babu-saheer@anglia.ac.uk) for her unwavering support, encouragement, and advice. 

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/ThunderStruct/PyBNG/blob/master/LICENSE) file for details



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ThunderStruct/PyBNG",
    "name": "PyBNG",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "gis mapping coordinates grid-reference mapping ordiance-survey lat-long bng all-numeric",
    "author": "Mohamed Shahawy",
    "author_email": "envious-citizen.0s@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/72/c75ca8164a7ee17ed07c301477d72694515486ac30659c71ff0d7cca32b0/pybng-0.2.0.tar.gz",
    "platform": null,
    "description": "# PyBNG\n[![Build Status](https://travis-ci.org/ThunderStruct/PyBNG.svg?branch=master)](https://travis-ci.org/ThunderStruct/PyBNG) [![pypi](https://img.shields.io/badge/pypi%20package-0.2.0-lightgrey.svg)](https://pypi.org/project/PyBNG/0.2.0/) [![Python](https://img.shields.io/badge/python-3.5^-blue.svg)](https://github.com/ThunderStruct/PyBNG) [![License](https://img.shields.io/cocoapods/l/AFNetworking.svg)](https://github.com/ThunderStruct/PyBNG/blob/master/LICENSE)\n\nAn Ordinance-Survey National Grid coordinates converter\n\n------------------------\n\n## Getting Started\nPyBNG is built on top of [OSGridConverter](https://github.com/jdstmporter/OSGridConverter/) and is used to convert coordinates from the Ordnance Survey National Grid system (often called the British National Grid -- *BNG*) to latitude and longitude using `WGS84` (other geodetic reference systems available).\n\nWhile OSGridConverter can convert BNG to latitude and longitude, it does not support all-numeric grid references, which is the primary feature in this library.\n\n### Installation\n#### PIP (recommended)\n\n```sh\npip install PyBNG\n```\n#### Manual Installation\nSimply clone the entire repo and extract the files in the `PyBNG` folder, then copy all the content to your project folder\n\nOr use one of the shorthand methods below\n##### GIT\n  - `cd` into your project directory\n  - Use `sparse-checkout` to pull the library files only into your project directory\n    ```sh\n    git init PyBNG\n    cd PyBNG\n    git remote add -f origin https://github.com/ThunderStruct/PyBNG.git\n    git config core.sparseCheckout true\n    echo \"PyBNG/*\" >> .git/info/sparse-checkout\n    git pull --depth=1 origin master\n    ```\n   - Import the newly pulled files into your project folder\n\n##### SVN\n  - `cd` into your project directory\n  - `checkout` the library files\n    ```sh\n    svn checkout https://github.com/ThunderStruct/PyBNG/trunk/PyBNG\n    ```\n  - Import the newly checked out files into your project folder\n  \n\n### Usage\n#### Initialization\nA `PyBNG` object can be instantiated as follows:\n\n```python\nfrom PyBNG import PyBNG\n\nbng = PyBNG(easting=519080, northing=185050)\n\nlatlon = PyBNG(lat=51.55178424773851, lon= -0.2835125528796557)\n```\nThe initializer expects `easting` and `northing` *OR* `lat` and `lon` parameters, depending on the required conversion\n\n\n### Methods\n\n  - `get_latlon(datum='WGS84')`:\n    - Description: calculates the latitude and logitude based on the given BNG coordinates\n    - Parameters: none (passed to constructor)\n    - Return Value: tuple -- (latitude, longitude)\n    - Usage: \n        ```python\n        from PyBNG import PyBNG\n\n        bng = PyBNG(easting=519080, northing=185050)\n        bng.get_latlon()     # (51.55178424773851, -0.2835125528796557)\n        ```\n  - `get_bng(datum='WGS84')`:\n    - Description: calculates the BNG coordinates given a latitude and a longitude\n    - Parameters: none (passed to constructor)\n    - Return Value: typle -- (easting, northing)\n    - Usage: \n        ```python\n        from PyBNG import PyBNG\n\n        latlon = PyBNG(lat=51.55178424773851, lon= -0.2835125528796557)\n        latlon.get_bng()     # (519107, 185051)\n        ```\n*Please note that converting BNG coordinates to latitude/longitude and back to BNG will yield different results due to internal float rounding*\n\n### Acknowledgment\nI would like to thank [Dr. Lakshmi Babu-Saheer](mailto:lakshmi.babu-saheer@anglia.ac.uk) for her unwavering support, encouragement, and advice. \n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/ThunderStruct/PyBNG/blob/master/LICENSE) file for details\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library to convert BNG/OSNG coordinates ",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/ThunderStruct/PyBNG"
    },
    "split_keywords": [
        "gis",
        "mapping",
        "coordinates",
        "grid-reference",
        "mapping",
        "ordiance-survey",
        "lat-long",
        "bng",
        "all-numeric"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d4cc7b0ab808d710d132daeb5eb109584626c3740b652191683e628ea1ee7413",
                "md5": "8131c4b284e953b86aa17d07397ca737",
                "sha256": "510671d14a76043fb098d5acd3e6b5dc8fb84bd4ab73cd246eb589e5cd32b3de"
            },
            "downloads": -1,
            "filename": "pybng-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8131c4b284e953b86aa17d07397ca737",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8810,
            "upload_time": "2025-10-22T19:23:17",
            "upload_time_iso_8601": "2025-10-22T19:23:17.034069Z",
            "url": "https://files.pythonhosted.org/packages/d4/cc/7b0ab808d710d132daeb5eb109584626c3740b652191683e628ea1ee7413/pybng-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8d72c75ca8164a7ee17ed07c301477d72694515486ac30659c71ff0d7cca32b0",
                "md5": "7934f357e25e99118033a5ba62eb0d49",
                "sha256": "6789d244a5b6ec514daa247445c25b988ed0bb3c2119c183e7d041a6684a26be"
            },
            "downloads": -1,
            "filename": "pybng-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7934f357e25e99118033a5ba62eb0d49",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7398,
            "upload_time": "2025-10-22T19:23:18",
            "upload_time_iso_8601": "2025-10-22T19:23:18.238137Z",
            "url": "https://files.pythonhosted.org/packages/8d/72/c75ca8164a7ee17ed07c301477d72694515486ac30659c71ff0d7cca32b0/pybng-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-22 19:23:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ThunderStruct",
    "github_project": "PyBNG",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pybng"
}
        
Elapsed time: 0.58039s