Skip to main content

Extend the functionality of morecantile with additional commands.

Project description

Supermorecado

Extend the functionality of morecantile with additional commands.

Test Coverage Package version Downloads License


Documentation: https://developmentseed.org/supermorecado/

Source Code: https://github.com/developmentseed/supermorecado


supermorecado is like supermercado, but with support for other TileMatrixSet grids.

Install

$ python -m pip install -U pip
$ python -m pip install supermorecado

# Or install from source:

$ python -m pip install -U pip
$ python -m pip install git+https://github.com/developmentseed/supermorecado.git

Usage

supermorecado --help
Usage: supermorecado [OPTIONS] COMMAND [ARGS]...

  Command line interface for the Supermorecado Python package.

Options:
  --help  Show this message and exit.

Commands:
  burn     Burn a stream of GeoJSONs into a output stream of the tiles they intersect for a given zoom.
  edges    For a stream of [<x>, <y>, <z>] tiles, return only those tiles that are on the edge.
  heatmap  Creates a vector `heatmap` of tile densities.
  union    Returns the unioned shape of a stream of [<x>, <y>, <z>] tiles in GeoJSON.

supermorecado burn

<{geojson} stream> | supermorecado burn <zoom> --identifier {tms Identifier} | <[x, y, z] stream>

Takes an input stream of GeoJSON and returns a stream of intersecting [x, y, z]s for a given zoom.

Using default TMS (WebMercatorQuad)

cat tests/fixtures/france.geojson | supermorecado burn 9 | morecantile shapes | fio collect | geojsonio

Using other TMS (e.g WGS1984Quad)

cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad | morecantile shapes --identifier WGS1984Quad | fio collect | geojsonio

supermorecado edges

<[x, y, z] stream> | supermorecado edges | <[x, y, z] stream>

Outputs a stream of [x, y, z]s representing the edge tiles of an input stream of [x, y, z]s. Edge tile = any tile that is either directly adjacent to a tile that does not exist, or diagonal to an empty tile.

cat tests/fixtures/france.geojson | supermorecado burn 9 | supermorecado edges | morecantile shapes | fio collect | geojsonio

supermorecado union

<[x, y, z] stream> | supermorecado union --identifier {tms Identifier} | <{geojson} stream>

Outputs a stream of unioned GeoJSON from an input stream of [x, y, z]s. Like morecantile shapes but as an overall footprint instead of individual shapes for each tile.

Using default TMS (WebMercatorQuad)

cat tests/fixtures/france.geojson | supermorecado burn 9 | supermorecado union | fio collect | geojsonio

Using other TMS (e.g WGS1984Quad)

cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad |  supermorecado union --identifier WGS1984Quad | fio collect | geojsonio

supermorecado heatmap

<[x, y, z] stream> | supermorecado heatmap --identifier {tms Identifier} | <{geojson} stream>

Outputs a stream of heatmap GeoJSON from an input stream of [x, y, z]s.

Using default TMS (WebMercatorQuad)

cat tests/fixtures/heatmap.txt| supermorecado heatmap | fio collect | geojsonio

Using other TMS (e.g WGS1984Quad)

# create a list of tiles
cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad > france_wgs84_z6.txt
# randomly append more tiles
for run in {1..10}; do cat france_wgs84_z6.txt | sort -R | head -n 2 >> france_wgs84_z6.txt; done

cat france_wgs84_z6.txt |  supermorecado heatmap --identifier WGS1984Quad | fio collect | geojsonio

API migration

supermorecado is really similar to supermercado (it reuse most of the code) but with the addition of multiple TMS support from morecantile.

features = [
    {
        "geometry": {
            "coordinates": [
                [-127.97, 49.15],
                [-101.95, -8.41],
                [-43.24, -32.84],
                [37.62, -25.17],
                [71.72, -7.01],
                [107.23, 48.69],
            ],
            "type": "LineString",
        },
        "properties": {},
        "type": "Feature",
    },
]

# supermercado
from supermercado import burntiles, uniontiles

tiles = burntiles.burn(features)
u_tiles = uniontiles.union(features)

# supermorecado
import morecantile
from supermorecado import burnTiles, unionTiles

tms = morecantile.tms.get("WebMercatorQuad")

burntiles = burnTiles(tms=tms)
tiles = burntiles.burn(features)

uniontiles = unionTiles(tms=tms)
u_tiles = uniontiles.burn(features)

Changes

See CHANGES.md.

Contribution & Development

See CONTRIBUTING.md

License

See LICENSE

Authors

Created by Development Seed

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

supermorecado-0.1.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

supermorecado-0.1.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file supermorecado-0.1.2.tar.gz.

File metadata

  • Download URL: supermorecado-0.1.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for supermorecado-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b51664d2eb12326e657a9d80c6849857c42ef3876545515ef988e266e6cc9654
MD5 ab6d4a6dc76ea3e566d7824a0e33971f
BLAKE2b-256 7ecc97693e7c34e56a9f3c869ff10a962e14d38c48b2c56436f0483ee77c3cc4

See more details on using hashes here.

File details

Details for the file supermorecado-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for supermorecado-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5116b9ff8c8aa0b0da235cb5962449dc878515c8155adf1440268c3cf271bed6
MD5 0363205918f5db6613e70b1540616498
BLAKE2b-256 7325909292b8a012282d3b535e51c2626095f0ff0cfea796da637b34512fb9f6

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