Skip to main content

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

Metadata

Release files for nsglib 3.0.0.0

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

Source distribution (sdist)

Source distribution for nsglib 3.0.0.0
File Size Uploaded Provenance
nsglib-3.0.0.0.tar.gz 9.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nsglib 3.0.0.0
File Interpreter ABI Platform
nsglib-3.0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / nsglib-3.0.0.0.tar.gz

Download URL nsglib-3.0.0.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1f3b4b6a9731fe613fdafe28ed1aea5c1657b90011db29d28539d353a644ba07
BLAKE2b-256 checksum
How to use checksums
029da7b8d90202663c1219b6ac92c3b90c8d1e3fff3dae8a20249dc4ae2c0385
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / nsglib-3.0.0.0-py3-none-any.whl

Download URL nsglib-3.0.0.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
837a98e326b06b9fe2259c9f9f6584d628b9edebc822735e4cceee38d58f6b89
BLAKE2b-256 checksum
How to use checksums
824eac26b0560b36fa88b12df9a441c38222f98d75c86f3e668b191d66715bc7
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for nsglib 3.0.0.0

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.

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