Skip to main content

Tools for manipulating Geomark datasets

Project description

Build Status

A small python library that provides implementations of the BC Governments Geomark Web Service

Installation

Option 1 - Clone this repository and install manually

  1. We will do our best to keep the master branch of this repository stable. However you could also checkout the tag corresponding to the release you would like…

    git clone https://github.com/greg-and-adam/python-geomark.git

  2. the cd into the directory where this repository was cloned

    cd /path/to/python-geomark

  3. Install using setup.py

    python setup.py install

  4. Or… Follow step 1 above then install using pip

    pip install /path/to/cloned/python-geomark

TODO List more installation methods here as they become supported…

Usage

A Geomark object can be instantiated with either a Geomark ID or a full Geomark URL.

We recommend using the Geomark ID.

from geomark import Geomark

gm = Geomark('gm-abcdefghijklmnopqrstuv0bcislands')
# or...
gm = Geomark('https://apps.gov.bc.ca/pub/geomark/geomarks/gm-abcdefghijklmnopqrstuv0bcislands')

This library supports all of the basic read functions from the Geomark API.

Reponse results are returned as a bytes string. It can be parsed using the appropriate library.

The default format is ‘json’ which will return a json parsable byte string. When using the JSON format any geometries will be formatted as EWKT.

Any of the supported file formats may be requested.

import json
from geomark import Geomark

gm = Geomark('gm-abcdefghijklmnopqrstuv0bcislands')

info = json.loads(gm.info())
parts = json.loads(gm.parts('geojson'))  # geojson is also supported.

Data can also be requested in any of the supported coordinate systems.

import json
from geomark import Geomark

gm = Geomark('gm-abcdefghijklmnopqrstuv0bcislands')
parts_bcalbers = json.loads(gm.parts('geojson', 3005))

If you get data in a format you wish to write to a file you may do so by simply opening a file location as writable in binary mode. (wb)

from geomark import Geomark

gm = Geomark('gm-abcdefghijklmnopqrstuv0bcislands')
feature_file = gm.feature('shpz')

with open('bc_islands.shpz', 'wb') as file:
    file.write(feature_file)

Testing

Using tox

The recommended way to run the tests is by using tox, which can be installed usingpip install tox.

You can use tox -l to list the available environments, and then e.g. use the following to run all tests with Python 3.6

tox -e py36

Running tests manually

Please refer to the tox.ini file for reference/help in case you want to run tests manually / without tox.

Contributing

  1. Fork it!

  2. Create your feature branch: git checkout -b my-new-feature

  3. Commit your changes: git commit -am 'Add some feature'

  4. Push to the branch: git push origin my-new-feature

  5. Submit a pull request :D

History

Recent changes can be viewed in the CHANGELOG.md file.

Credits

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geomark-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geomark-0.1.1-py2.py3-none-any.whl (15.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file geomark-0.1.1.tar.gz.

File metadata

  • Download URL: geomark-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for geomark-0.1.1.tar.gz
Algorithm Hash digest
SHA256 002ff27cd3581d120b77b90ad174e0318327d061f4564a088fbe1c43009cf9a5
MD5 3c2bfa95ef662dc2c125add57cd6f70c
BLAKE2b-256 4e5cb7df66627cefcb1a7efdd3c32342d974e032462969bcac0fd4127dd21174

See more details on using hashes here.

File details

Details for the file geomark-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for geomark-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aedee528cf15eaf016fe72949992e226fa5d0e1d33e4ee94279023535cd2f445
MD5 2ef6e9b7b0375b8285487ae53a7897c1
BLAKE2b-256 5465cae987abf41f2f3221933b3764a70dab4e6d1dd1ab5a77302b69b3f1b6eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page