rio-tiler


Namerio-tiler JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/mapbox/rio-tiler
SummaryGet mercator tile from landsat, sentinel or other AWS hosted raster
upload_time2017-10-17 16:53:57
maintainer
docs_urlNone
authorVincent Sarago
requires_python
licenseBSD
keywords raster aws tiler gdal rasterio
VCS
bugtrack_url
requirements numpy Pillow mercantile boto3 cachetools rasterio rio-toa rio-pansharpen
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
Rio-tiler
=========

Rasterio pluggin to serve tiles from AWS S3 hosted files.

.. image:: https://circleci.com/gh/mapbox/rio-tiler.svg?style=svg&circle-token=b78bc1a238c21046a855a9c80b441a8f2f9a4478
   :target: https://circleci.com/gh/mapbox/rio-tiler

.. image:: https://codecov.io/gh/mapbox/rio-tiler/branch/master/graph/badge.svg?token=zuHupC20cG
   :target: https://codecov.io/gh/mapbox/rio-tiler

Get mercator tile from Landsat, sentinel or other AWS hosted rasters.

Rio-tiler supports Python 2.7 and 3.3-3.6.


Install
=======

.. code-block:: console

    $ pip install -U pip
    $ pip install rio-tiler

Or install from source:

.. code-block:: console

    $ git clone https://github.com/mapbox/rio-tiler.git
    $ cd rio-tiler
    $ pip install -U pip
    $ pip install -e .


Or if you want to create an AWS Lambda package using rasterio wheels:

.. code-block:: console

    # On a centos machine
    pip install rio-tiler --no-binary numpy -t /tmp/vendored -U
    zip -r9q package.zip vendored/*

API Overview
============

rio_tiler.landsat8
------------------

The ``landsat8`` module process Landsat 8 data hosted on AWS Public Dataset https://aws.amazon.com/fr/public-datasets/landsat/

- **landsat8.bounds**

    Get WGS84 bounds for a Landsat scene.

    ``Input``:
      - sceneid: Landsat product id (or scene id for scene < 1st May 2017)

    ``Output``:
      - dictionary:
          - bounds: (minX, minY, maxX, maxY) (list)
          - sceneid: scene id (string)

      .. code-block:: python

          >>> from rio_tiler import landsat8
          >>> landsat8.bounds('LC08_L1TP_016037_20170813_20170814_01_RT')
          {'bounds': [-81.30836, 32.10539, -78.82045, 34.22818],
          'sceneid': 'LC08_L1TP_016037_20170813_20170814_01_RT'}

- **landsat8.metadata**

    Get WGS84 bounds and cumulative histogram cuts for each bands for a Landsat scene.

    ``Input``:
      - sceneid: Landsat product id (or scene id for scene < 1st May 2017)
      - pmin: Histogram cut minimum value in percent (default: 2)
      - pmax: Histogram cut maximum value in percent (default: 98)

    ``Output``:
      - dictionary:
          - bounds: (minX, minY, maxX, maxY) (list)
          - sceneid: scene id (string)
          - rgbMinMax: Min/Max DN values for the linear rescaling (dictionary)

        .. code-block:: python

          >>> from rio_tiler import landsat8
          >>> landsat8.metadata('LC08_L1TP_016037_20170813_20170814_01_RT', pmin=5, pmax=95)
          {'bounds': [-81.30836, 32.10539, -78.82045, 34.22818],
           'rgbMinMax': {'1': [1245, 5396],
            '2': [983, 5384],
            '3': [718, 5162],
            '4': [470, 5273],
            '5': [403, 6440],
            '6': [258, 4257],
            '7': [151, 2984]},
           'sceneid': 'LC08_L1TP_016037_20170813_20170814_01_RT'}

- **landsat8.tile**

    Return base64 encoded image corresponding to a mercator tile

    ``Input``:
      - sceneid : Landsat product id (or scene id for scene < 1st May 2017)
      - x: Mercator tile X index
      - y: Mercator tile Y index
      - z: Mercator tile ZOOM level
      - rgb: Bands index for the RGB combination (default: (4, 3, 2))
      - r_bds: First band (red) DN min and max values (default: (0, 16000))
      - g_bds: Second band (green) DN min and max values (default: (0, 16000))
      - b_bds: Third band (blue) DN min and max values (default: (0, 16000))
      - tilesize: Output image size (default: 256)
      - pan: If True, apply pan-sharpening(default: False)

    ``Output``:
      - numpy ndarray of the image data

      .. code-block:: python

        >>> from rio_tiler import landsat8
        >>> tile = landsat8.tile('LC08_L1TP_016037_20170813_20170814_01_RT', 71, 102, 8)
        >>> tile.shape
        (3, 256, 256)


rio_tiler.sentinel2
-------------------

The `sentinel2` module process Sentinel 2 data hosted on AWS Public Dataset http://sentinel-pds.s3-website.eu-central-1.amazonaws.com

- **sentinel2.bounds**

    Get WGS84 bounds for a Landsat scene.

    ``Input``:
      - sceneid: Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)

    ``Output``:
      - dictionary:
          - bounds: (minX, minY, maxX, maxY) (list)
          - sceneid: scene id (string)

    .. code-block:: python

      >>> from rio_tiler import sentinel2
      >>> sentinel2.bounds('S2A_tile_20170729_19UDP_0')
      {'bounds': [-70.36082319774495, 47.75776333620836, -68.8677615795376, 48.75301295078041],
       'sceneid': 'S2A_tile_20170729_19UDP_0'}

- **sentinel2.metadata**

    Get WGS84 bounds and cumulative histogram cuts for each bands for a Sentinel scene.

    ``Input``:
      - sceneid: Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)
      - pmin: Histogram cut minimum value in percent (default: 2)
      - pmax: Histogram cut maximum value in percent (default: 98)

    ``Output``:
      - dictionary:
          - bounds: (minX, minY, maxX, maxY) (list)
          - sceneid: scene id (string)
          - rgbMinMax: Min/Max DN values for the linear rescaling (dictionary)

    .. code-block:: python

      >>> from rio_tiler import sentinel2
      >>> sentinel2.metadata('S2A_tile_20170729_19UDP_0', pmin=5, pmax=95)
      {'sceneid': 'S2A_tile_20170729_19UDP_0',
      'bounds': [-70.36082319774495, 47.75776333620836, -68.8677615795376, 48.75301295078041],
      'rgbMinMax': {
          '01': [1088, 8237],
          '02': [740, 8288],
          '03': [488, 7977],
          '04': [255, 8626],
          '05': [210, 8877],
          '06': [172, 9079],
          '07': [150, 9263],
          '08': [122, 9163],
          '8A': [107, 9360],
          '09': [53, 5926],
          '10': [6, 546],
          '11': [15, 5658],
          '12': [8, 4009]}}

- **sentinel2.tile**

    Return base64 encoded image corresponding to a mercator tile

    ``Input``:
      - sceneid : Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)
      - x: Mercator tile X index
      - y: Mercator tile Y index
      - z: Mercator tile ZOOM level
      - rgb: Bands index for the RGB combination (default: (04, 03, 02))
      - r_bds: First band (red) DN min and max values (default: (0, 16000))
      - g_bds: Second band (green) DN min and max values (default: (0, 16000))
      - b_bds: Third band (blue) DN min and max values (default: (0, 16000))
      - tilesize: Output image size (default: 256)

    ``Output``:
      - numpy ndarray of the image data

    .. code-block:: python

        >>> from rio_tiler import sentinel2
        >>> sentinel2.tile('S2A_tile_20170729_19UDP_0', 77, 89, 8, 'png')
        >>> tile.shape
        (3, 256, 256)


rio_tiler.aws
-------------

The `aws` module can process any raster hosted on AWS S3.

- **aws.bounds**

    Get WGS84 bounds for a scene.

    ``Input``:
      - bucket: AWS S3 bucket name where the raster is stored
      - key: AWS S3 key

    ``Output``:
      - dictionary:
          - bounds: (minX, minY, maxX, maxY) (list)
          - bucket: bucket name
          - key: AWS key

    .. code-block:: python

      >>> from rio_tiler import aws
      >>> aws.bounds('my-bucket', 'data/my-raster.tif')
      {'bounds': [-104.77532797841498, 38.95344940972065, -104.77466477631017, 38.95376633047638],
       'bucket': 'my-bucket'
       'key': 'data/my-raster.tif'}

- **aws.tile**

    Return base64 encoded image corresponding to a mercator tile

    ``Input``:
      - bucket: bucket name
      - key: AWS key
      - x: Mercator tile X index
      - y: Mercator tile Y index
      - z: Mercator tile ZOOM level
      - rgb: Band index to read (default: (1, 2, 3))
      - tilesize: Output image size (default: 256)

    ``Output``:
      - numpy ndarray of the image data

    .. code-block:: python

        >>> from rio_tiler import aws
        >>> aws.tile('my-bucket', 'data/my-raster.tif', 77, 89, 8)
        >>> tile.shape
        (3, 256, 256)


Convert ``tile`` output to image
=================================

rio_tiler.utils.array_to_img
----------------------------

  ``Input``:
    - numpy **nuint8** ndarray
    - tileformat: Image format to return ("jpg" or "png")

  ``Output``:
    - base64 encoded image PNG or JPEG (string)


  .. code-block:: python

    >>> from rio_tiler import landsat8
    >>> from rio_tiler.utils import array_to_img
    >>> tile = landsat8.tile('LC08_L1TP_016037_20170813_20170814_01_RT', 71, 102, 8)
    >>> array_to_img(tile, 'png')
    'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAEAAElEQVR4AQAggN9/AAAAAAA....


License
-------

See `LICENSE.txt <LICENSE.txt>`__.

Authors
-------

See `AUTHORS.txt <AUTHORS.txt>`__.

Changes
-------

See `CHANGES.txt <CHANGES.txt>`__.
            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "raster aws tiler gdal rasterio", 
    "upload_time": "2017-10-17 16:53:57", 
    "requirements": [
        {
            "name": "numpy", 
            "specs": []
        }, 
        {
            "name": "Pillow", 
            "specs": []
        }, 
        {
            "name": "mercantile", 
            "specs": []
        }, 
        {
            "name": "boto3", 
            "specs": []
        }, 
        {
            "name": "cachetools", 
            "specs": []
        }, 
        {
            "name": "rasterio", 
            "specs": [
                [
                    ">=", 
                    "1.0a10"
                ]
            ]
        }, 
        {
            "name": "rio-toa", 
            "specs": []
        }, 
        {
            "name": "rio-pansharpen", 
            "specs": []
        }
    ], 
    "author": "Vincent Sarago", 
    "home_page": "https://github.com/mapbox/rio-tiler", 
    "github_user": "mapbox", 
    "download_url": "https://pypi.python.org/packages/b5/62/115423a6f9b17fa9bbd31456074be88cd7579a672f4c71cfe56e41714d08/rio_tiler-0.0.2.tar.gz", 
    "platform": "", 
    "version": "0.0.2", 
    "cheesecake_documentation_id": null, 
    "description": "=========\nRio-tiler\n=========\n\nRasterio pluggin to serve tiles from AWS S3 hosted files.\n\n.. image:: https://circleci.com/gh/mapbox/rio-tiler.svg?style=svg&circle-token=b78bc1a238c21046a855a9c80b441a8f2f9a4478\n   :target: https://circleci.com/gh/mapbox/rio-tiler\n\n.. image:: https://codecov.io/gh/mapbox/rio-tiler/branch/master/graph/badge.svg?token=zuHupC20cG\n   :target: https://codecov.io/gh/mapbox/rio-tiler\n\nGet mercator tile from Landsat, sentinel or other AWS hosted rasters.\n\nRio-tiler supports Python 2.7 and 3.3-3.6.\n\n\nInstall\n=======\n\n.. code-block:: console\n\n    $ pip install -U pip\n    $ pip install rio-tiler\n\nOr install from source:\n\n.. code-block:: console\n\n    $ git clone https://github.com/mapbox/rio-tiler.git\n    $ cd rio-tiler\n    $ pip install -U pip\n    $ pip install -e .\n\n\nOr if you want to create an AWS Lambda package using rasterio wheels:\n\n.. code-block:: console\n\n    # On a centos machine\n    pip install rio-tiler --no-binary numpy -t /tmp/vendored -U\n    zip -r9q package.zip vendored/*\n\nAPI Overview\n============\n\nrio_tiler.landsat8\n------------------\n\nThe ``landsat8`` module process Landsat 8 data hosted on AWS Public Dataset https://aws.amazon.com/fr/public-datasets/landsat/\n\n- **landsat8.bounds**\n\n    Get WGS84 bounds for a Landsat scene.\n\n    ``Input``:\n      - sceneid: Landsat product id (or scene id for scene < 1st May 2017)\n\n    ``Output``:\n      - dictionary:\n          - bounds: (minX, minY, maxX, maxY) (list)\n          - sceneid: scene id (string)\n\n      .. code-block:: python\n\n          >>> from rio_tiler import landsat8\n          >>> landsat8.bounds('LC08_L1TP_016037_20170813_20170814_01_RT')\n          {'bounds': [-81.30836, 32.10539, -78.82045, 34.22818],\n          'sceneid': 'LC08_L1TP_016037_20170813_20170814_01_RT'}\n\n- **landsat8.metadata**\n\n    Get WGS84 bounds and cumulative histogram cuts for each bands for a Landsat scene.\n\n    ``Input``:\n      - sceneid: Landsat product id (or scene id for scene < 1st May 2017)\n      - pmin: Histogram cut minimum value in percent (default: 2)\n      - pmax: Histogram cut maximum value in percent (default: 98)\n\n    ``Output``:\n      - dictionary:\n          - bounds: (minX, minY, maxX, maxY) (list)\n          - sceneid: scene id (string)\n          - rgbMinMax: Min/Max DN values for the linear rescaling (dictionary)\n\n        .. code-block:: python\n\n          >>> from rio_tiler import landsat8\n          >>> landsat8.metadata('LC08_L1TP_016037_20170813_20170814_01_RT', pmin=5, pmax=95)\n          {'bounds': [-81.30836, 32.10539, -78.82045, 34.22818],\n           'rgbMinMax': {'1': [1245, 5396],\n            '2': [983, 5384],\n            '3': [718, 5162],\n            '4': [470, 5273],\n            '5': [403, 6440],\n            '6': [258, 4257],\n            '7': [151, 2984]},\n           'sceneid': 'LC08_L1TP_016037_20170813_20170814_01_RT'}\n\n- **landsat8.tile**\n\n    Return base64 encoded image corresponding to a mercator tile\n\n    ``Input``:\n      - sceneid : Landsat product id (or scene id for scene < 1st May 2017)\n      - x: Mercator tile X index\n      - y: Mercator tile Y index\n      - z: Mercator tile ZOOM level\n      - rgb: Bands index for the RGB combination (default: (4, 3, 2))\n      - r_bds: First band (red) DN min and max values (default: (0, 16000))\n      - g_bds: Second band (green) DN min and max values (default: (0, 16000))\n      - b_bds: Third band (blue) DN min and max values (default: (0, 16000))\n      - tilesize: Output image size (default: 256)\n      - pan: If True, apply pan-sharpening(default: False)\n\n    ``Output``:\n      - numpy ndarray of the image data\n\n      .. code-block:: python\n\n        >>> from rio_tiler import landsat8\n        >>> tile = landsat8.tile('LC08_L1TP_016037_20170813_20170814_01_RT', 71, 102, 8)\n        >>> tile.shape\n        (3, 256, 256)\n\n\nrio_tiler.sentinel2\n-------------------\n\nThe `sentinel2` module process Sentinel 2 data hosted on AWS Public Dataset http://sentinel-pds.s3-website.eu-central-1.amazonaws.com\n\n- **sentinel2.bounds**\n\n    Get WGS84 bounds for a Landsat scene.\n\n    ``Input``:\n      - sceneid: Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)\n\n    ``Output``:\n      - dictionary:\n          - bounds: (minX, minY, maxX, maxY) (list)\n          - sceneid: scene id (string)\n\n    .. code-block:: python\n\n      >>> from rio_tiler import sentinel2\n      >>> sentinel2.bounds('S2A_tile_20170729_19UDP_0')\n      {'bounds': [-70.36082319774495, 47.75776333620836, -68.8677615795376, 48.75301295078041],\n       'sceneid': 'S2A_tile_20170729_19UDP_0'}\n\n- **sentinel2.metadata**\n\n    Get WGS84 bounds and cumulative histogram cuts for each bands for a Sentinel scene.\n\n    ``Input``:\n      - sceneid: Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)\n      - pmin: Histogram cut minimum value in percent (default: 2)\n      - pmax: Histogram cut maximum value in percent (default: 98)\n\n    ``Output``:\n      - dictionary:\n          - bounds: (minX, minY, maxX, maxY) (list)\n          - sceneid: scene id (string)\n          - rgbMinMax: Min/Max DN values for the linear rescaling (dictionary)\n\n    .. code-block:: python\n\n      >>> from rio_tiler import sentinel2\n      >>> sentinel2.metadata('S2A_tile_20170729_19UDP_0', pmin=5, pmax=95)\n      {'sceneid': 'S2A_tile_20170729_19UDP_0',\n      'bounds': [-70.36082319774495, 47.75776333620836, -68.8677615795376, 48.75301295078041],\n      'rgbMinMax': {\n          '01': [1088, 8237],\n          '02': [740, 8288],\n          '03': [488, 7977],\n          '04': [255, 8626],\n          '05': [210, 8877],\n          '06': [172, 9079],\n          '07': [150, 9263],\n          '08': [122, 9163],\n          '8A': [107, 9360],\n          '09': [53, 5926],\n          '10': [6, 546],\n          '11': [15, 5658],\n          '12': [8, 4009]}}\n\n- **sentinel2.tile**\n\n    Return base64 encoded image corresponding to a mercator tile\n\n    ``Input``:\n      - sceneid : Sentinel scene id (`S2{A|B}_tile_{YYYYMMDD}_{utm_zone}{latitude_band}{grid_square}_{img_number}`)\n      - x: Mercator tile X index\n      - y: Mercator tile Y index\n      - z: Mercator tile ZOOM level\n      - rgb: Bands index for the RGB combination (default: (04, 03, 02))\n      - r_bds: First band (red) DN min and max values (default: (0, 16000))\n      - g_bds: Second band (green) DN min and max values (default: (0, 16000))\n      - b_bds: Third band (blue) DN min and max values (default: (0, 16000))\n      - tilesize: Output image size (default: 256)\n\n    ``Output``:\n      - numpy ndarray of the image data\n\n    .. code-block:: python\n\n        >>> from rio_tiler import sentinel2\n        >>> sentinel2.tile('S2A_tile_20170729_19UDP_0', 77, 89, 8, 'png')\n        >>> tile.shape\n        (3, 256, 256)\n\n\nrio_tiler.aws\n-------------\n\nThe `aws` module can process any raster hosted on AWS S3.\n\n- **aws.bounds**\n\n    Get WGS84 bounds for a scene.\n\n    ``Input``:\n      - bucket: AWS S3 bucket name where the raster is stored\n      - key: AWS S3 key\n\n    ``Output``:\n      - dictionary:\n          - bounds: (minX, minY, maxX, maxY) (list)\n          - bucket: bucket name\n          - key: AWS key\n\n    .. code-block:: python\n\n      >>> from rio_tiler import aws\n      >>> aws.bounds('my-bucket', 'data/my-raster.tif')\n      {'bounds': [-104.77532797841498, 38.95344940972065, -104.77466477631017, 38.95376633047638],\n       'bucket': 'my-bucket'\n       'key': 'data/my-raster.tif'}\n\n- **aws.tile**\n\n    Return base64 encoded image corresponding to a mercator tile\n\n    ``Input``:\n      - bucket: bucket name\n      - key: AWS key\n      - x: Mercator tile X index\n      - y: Mercator tile Y index\n      - z: Mercator tile ZOOM level\n      - rgb: Band index to read (default: (1, 2, 3))\n      - tilesize: Output image size (default: 256)\n\n    ``Output``:\n      - numpy ndarray of the image data\n\n    .. code-block:: python\n\n        >>> from rio_tiler import aws\n        >>> aws.tile('my-bucket', 'data/my-raster.tif', 77, 89, 8)\n        >>> tile.shape\n        (3, 256, 256)\n\n\nConvert ``tile`` output to image\n=================================\n\nrio_tiler.utils.array_to_img\n----------------------------\n\n  ``Input``:\n    - numpy **nuint8** ndarray\n    - tileformat: Image format to return (\"jpg\" or \"png\")\n\n  ``Output``:\n    - base64 encoded image PNG or JPEG (string)\n\n\n  .. code-block:: python\n\n    >>> from rio_tiler import landsat8\n    >>> from rio_tiler.utils import array_to_img\n    >>> tile = landsat8.tile('LC08_L1TP_016037_20170813_20170814_01_RT', 71, 102, 8)\n    >>> array_to_img(tile, 'png')\n    'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAEAAElEQVR4AQAggN9/AAAAAAA....\n\n\nLicense\n-------\n\nSee `LICENSE.txt <LICENSE.txt>`__.\n\nAuthors\n-------\n\nSee `AUTHORS.txt <AUTHORS.txt>`__.\n\nChanges\n-------\n\nSee `CHANGES.txt <CHANGES.txt>`__.", 
    "lcname": "rio-tiler", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "rio-tiler", 
    "license": "BSD", 
    "travis_ci": false, 
    "github_project": "rio-tiler", 
    "summary": "Get mercator tile from landsat, sentinel or other AWS hosted raster", 
    "split_keywords": [
        "raster", 
        "aws", 
        "tiler", 
        "gdal", 
        "rasterio"
    ], 
    "author_email": "vincent.sarago@mapbox.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-10-17T16:53:57", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/b5/62/115423a6f9b17fa9bbd31456074be88cd7579a672f4c71cfe56e41714d08/rio_tiler-0.0.2.tar.gz", 
            "md5_digest": "716e055053a9673b30b0b55d26aa2cbf", 
            "downloads": 0, 
            "filename": "rio_tiler-0.0.2.tar.gz", 
            "packagetype": "sdist", 
            "path": "b5/62/115423a6f9b17fa9bbd31456074be88cd7579a672f4c71cfe56e41714d08/rio_tiler-0.0.2.tar.gz", 
            "size": 11995
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}