Skip to main content

NSG Common Python Library

Project description

NSG Common Library

NSG common library.

A Python 3 library that contains the basic objects and schemas that NSG tile caches, or NSG components would need to adhere to.

Motivation

We wanted a library to contain common geospatial objects and commonly used functions to be used acrossed NSG python geospatial libraries and tools.

Build status

pipeline status coverage report

Sample Code

Example of calculating resolution width and height:

from nsg.common.spatial_reference_system import SpatialReferenceSystem
from nsg.tile_cache.tile_scheme import calc_resolutions

resolution_width, resolution_height = calc_resolutions(bounding_box=SpatialReferenceSystem.NSG_WORLD_GEODETIC.world_bounding_box,
                                                       tile_size=(256, 256),
                                                       zoom_level=1,
                                                       tile_scheme=SpatialReferenceSystem.NSG_WORLD_GEODETIC.tile_scheme)

Installation

pip install nsglib

Common NSG objects

Some examples of NSG objects include (but not limited to):

  • SpatialReferenceSystem
  • BoundingBox
  • Coordinate

The most common Spatial Reference Systems that are defined are EPSG:4326, EPSG:3395, and EPSG:3857. These Spatial Reference Systems can be easily accessed by using the Python Enum: SpatialReferenceSystem.NSG_WORLD_GEODETIC, SpatialReferenceSystem.NSG_WORLD_MERCATOR, SpatialReferenceSystem.WEB_MERCATOR

The bounding box defines an object that holds the extent information in a particular Coordinate Reference System.

A Coordinate is an geographical location on a map. They can be used for Coordinate Reference System coordinates or tile coordinates.

Tile Cache NSG Objects

Some examples of Tile Cache objects include(but not limited to):

  • Tile
  • TileScheme
  • AbstractTileCache

A Tile has a coordinate location (row, colum, zoom level) and a source. The coordinate location describes where to place the tile. The source is the tile data in bytes (the jpeg, png, or vector-tile data).

A Tile Scheme is how the world is divided up into tiles based on zoom level. There is also an implementation included called ZoomTimesTwo which is a tile scheme implementation of a common convention where a tile set's tile matrix doubles width and height between successive zoom levels.

Tile Scheme class also includes functions for calculating the resolution and scale denominator.

An AbstractTileCache are the basic functions that a tile cache should include. Some example tile caches are Compact Cache V2, GeoPackage, and File based Cache.

License

MIT

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

nsglib-3.0.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

nsglib-3.0.0.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file nsglib-3.0.0.0.tar.gz.

File metadata

  • Download URL: nsglib-3.0.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

File hashes

Hashes for nsglib-3.0.0.0.tar.gz
Algorithm Hash digest
SHA256 1f3b4b6a9731fe613fdafe28ed1aea5c1657b90011db29d28539d353a644ba07
MD5 0babeac52a21216101af7abffb443af4
BLAKE2b-256 029da7b8d90202663c1219b6ac92c3b90c8d1e3fff3dae8a20249dc4ae2c0385

See more details on using hashes here.

File details

Details for the file nsglib-3.0.0.0-py3-none-any.whl.

File metadata

  • Download URL: nsglib-3.0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

File hashes

Hashes for nsglib-3.0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 837a98e326b06b9fe2259c9f9f6584d628b9edebc822735e4cceee38d58f6b89
MD5 8565746683d78682d32207b98f50837c
BLAKE2b-256 824eac26b0560b36fa88b12df9a441c38222f98d75c86f3e668b191d66715bc7

See more details on using hashes here.

Supported by

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