{ "info": { "author": "Vincent Sarago", "author_email": "vincent@developmentseed.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Information Technology", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: GIS" ], "description": "# rio-tiler-mosaic\n\n[![Packaging status](https://badge.fury.io/py/rio-tiler-mosaic.svg)](https://badge.fury.io/py/rio-tiler-mosaic)\n[![CircleCI](https://circleci.com/gh/cogeotiff/rio-tiler-mosaic.svg?style=svg)](https://circleci.com/gh/cogeotiff/rio-tiler-mosaic)\n[![codecov](https://codecov.io/gh/cogeotiff/rio-tiler-mosaic/branch/master/graph/badge.svg)](https://codecov.io/gh/cogeotiff/rio-tiler-mosaic)\n\nA rio-tiler plugin for creating tiles from multiple observations.\n\n![](https://user-images.githubusercontent.com/10407788/57466726-304f5880-724f-11e9-9969-bec4ce940e07.png)\n\n\n## Install\n\n```bash\n$ pip install rio-tiler-mosaic\n```\nOr \n```bash\n$ git clone http://github.com/cogeotiff/rio-tiler-mosaic\n$ cd rio-tiler-mosaic\n$ pip install -e .\n```\n\n## Rio-tiler + Mosaic\n\n![](https://user-images.githubusercontent.com/10407788/57467798-30505800-7251-11e9-9bde-6f50801dc851.png)\n\nThe goal of this rio-tiler plugin is to create tiles from multiple observations. \n\nBecause user might want to choose which pixel goes on top of the tile, this plugin comes with 5 differents `pixel selection` algorithms:\n- **First**: takes the first pixel received\n- **Highest**: loop though all the assets and return the highest value \n- **Lowest**: loop though all the assets and return the lowest value\n- **Mean**: compute the mean value of the whole stack\n- **Median**: compute the median value of the whole stack\n\n### API\n\n`mosaic_tiler(assets, tile_x, tile_y, tile_z, tiler, pixel_selection=None, chunk_size=5, kwargs)`\n\nInputs:\n- assets : list, tuple of rio-tiler compatible assets (url or sceneid)\n- tile_x : Mercator tile X index. \n- tile_y : Mercator tile Y index. \n- tile_z : Mercator tile ZOOM level. \n- tiler: Rio-tiler's tiler function (e.g rio_tiler.landsat8.tile) \n- pixel_selection : optional **pixel selection** algorithm (default: \"first\"). \n- chunk_size: optional, control the number of asset to process per loop.\n- kwargs: Rio-tiler tiler module specific otions.\n\nReturns:\n- tile, mask : tuple of ndarray Return tile and mask data.\n\n#### Examples\n\n```python\nfrom rio_tiler.main import tile as cogTiler\nfrom rio_tiler_mosaic.mosaic import mosaic_tiler\nfrom rio_tiler_mosaic.methods import defaults\n\nassets = [\"mytif1.tif\", \"mytif2.tif\", \"mytif3.tif\"]\ntile = (1000, 1000, 9)\nx, y, z = tile\n\n# Use Default First value method\nmosaic_tiler(assets, x, y, z, cogTiler)\n\n# Use Highest value: defaults.HighestMethod()\nmosaic_tiler(\n assets,\n x,\n y,\n z,\n cogTiler,\n pixel_selection=defaults.HighestMethod()\n)\n\n# Use Lowest value: defaults.LowestMethod()\nmosaic_tiler(\n assets,\n x,\n y,\n z,\n cogTiler,\n pixel_selection=defaults.LowestMethod()\n)\n```\n\n### The `MosaicMethod` interface\n\nthe `rio-tiler-mosaic.methods.base.MosaicMethodBase` class defines an abstract \ninterface for all `pixel selection` methods allowed by `rio-tiler-mosaic`. its methods and properties are:\n\n- `is_done`: property, returns a boolean indicating if the process is done filling the tile\n- `data`: property, returns the output **tile** and **mask** numpy arrays\n- `feed(tile: numpy.ma.ndarray)`: method, update the tile\n\nThe MosaicMethodBase class is not intended to be used directly but as an abstract base class, a template for concrete implementations.\n\n#### Writing your own Pixel Selection method\n\nThe rules for writing your own `pixel selection algorithm` class are as follows:\n\n- Must inherit from MosaicMethodBase\n- Must provide concrete implementations of all the above methods.\n\nSee [rio_tiler_mosaic.methods.defaults](/rio_tiler_mosaic/defaults.py) classes for examples.\n\n#### Smart Multi-Threading \n\nWhen dealing with an important number of image, you might not want to process the whole stack, especially if the pixel selection method stops when the tile is filled. To allow better optimization, `rio-tiler-mosaic` is fetching the tiles in parallel (threads) but to limit the number of files we also embeded the fetching in a loop (creating 2 level of processing): \n\n```python\nassets = [\"1.tif\", \"2.tif\", \"3.tif\", \"4.tif\", \"5.tif\", \"6.tif\"]\n\n# 1st level loop - Creates chuncks of assets\nfor chunks in _chunks(assets, chunk_size):\n # 2nd level loop - Uses threads for process each `chunck`\n with futures.ThreadPoolExecutor(max_workers=max_threads) as executor:\n future_tasks = [executor.submit(_tiler, asset) for asset in chunks]\n```\n\nBy default the chunck_size is equal to max_threads ([default](https://github.com/cogeotiff/rio-tiler-mosaic/blob/4a4d188a9b0fefbf244af3cf52cf2695db7e0cf1/rio_tiler_mosaic/mosaic.py#L77))\n\n## Example\n\nSee [/example](/example)\n\n## Contribution & Development\n\nIssues and pull requests are more than welcome.\n\n**dev install**\n\n```bash\n$ git clone https://github.com/cogeotiff/rio-tiler-mosaic.git\n$ cd rio-tiler-mosaic\n$ pip install -e .[dev]\n```\n\n**Python3.6 only**\n\nThis repo is set to use `pre-commit` to run *flake8*, *pydocstring* and *black* (\"uncompromising Python code formatter\") when commiting new code.\n\n```bash\n$ pre-commit install\n```\n\n\n## Implementation\n[cogeo-mosaic](http://github.com/developmentseed/cogeo-mosaic.git)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cogeotiff/rio-tiler-mosaic", "keywords": "COG Mosaic GIS", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rio-tiler-mosaic", "package_url": "https://pypi.org/project/rio-tiler-mosaic/", "platform": "", "project_url": "https://pypi.org/project/rio-tiler-mosaic/", "project_urls": { "Homepage": "https://github.com/cogeotiff/rio-tiler-mosaic" }, "release_url": "https://pypi.org/project/rio-tiler-mosaic/0.0.1.dev3/", "requires_dist": null, "requires_python": "", "summary": "A rio-tiler plugin to create mosaic tiles.", "version": "0.0.1.dev3" }, "last_serial": 5586548, "releases": { "0.0.1.dev0": [ { "comment_text": "", "digests": { "md5": "4e9c47af8566573d54e26376deb9e2d7", "sha256": "e379ca0060434c40bbf4ac61023034063500c9acafc1f87d7ce68d5274613007" }, "downloads": -1, "filename": "rio-tiler-mosaic-0.0.1.dev0.tar.gz", "has_sig": false, "md5_digest": "4e9c47af8566573d54e26376deb9e2d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3229, "upload_time": "2019-05-23T19:14:16", "url": "https://files.pythonhosted.org/packages/0b/4a/f9bb73e216293f901cb3cad57cec91b1b240a5f70cd019dd3fb88b62a796/rio-tiler-mosaic-0.0.1.dev0.tar.gz" } ], "0.0.1.dev1": [ { "comment_text": "", "digests": { "md5": "5c372f336213496d6f26636eb4f88882", "sha256": "3be60b9152cfd2e7d9ed92e4e12a67d8f4c38826adb3f1df121ee10aa346a85e" }, "downloads": -1, "filename": "rio-tiler-mosaic-0.0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "5c372f336213496d6f26636eb4f88882", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4991, "upload_time": "2019-07-18T18:25:38", "url": "https://files.pythonhosted.org/packages/87/7f/fe37b4c745e48ce71bb86397480c71579068e70bbccf3300b02c01ccc6dd/rio-tiler-mosaic-0.0.1.dev1.tar.gz" } ], "0.0.1.dev2": [ { "comment_text": "", "digests": { "md5": "f32efc90e1f92313c6f6ce7411be2457", "sha256": "825bab3fe41bfd0e3832f91a329348dec20898c7477b020cd3ee611b94624034" }, "downloads": -1, "filename": "rio-tiler-mosaic-0.0.1.dev2.tar.gz", "has_sig": false, "md5_digest": "f32efc90e1f92313c6f6ce7411be2457", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5052, "upload_time": "2019-07-19T01:57:57", "url": "https://files.pythonhosted.org/packages/fb/73/7c4f15e748a55c470b3d98c9b93d7544e4bea956707874fc0252c61d2556/rio-tiler-mosaic-0.0.1.dev2.tar.gz" } ], "0.0.1.dev3": [ { "comment_text": "", "digests": { "md5": "b259714c1a1cc381d1e6e52f423dbd52", "sha256": "f09644e85960b321319a0efc02f2f7928179e6230dcc8d725ced5938d60509f1" }, "downloads": -1, "filename": "rio-tiler-mosaic-0.0.1.dev3.tar.gz", "has_sig": false, "md5_digest": "b259714c1a1cc381d1e6e52f423dbd52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5636, "upload_time": "2019-07-26T02:47:28", "url": "https://files.pythonhosted.org/packages/09/16/d440c8cbbe5f3b4e1ff3a5e770a0b4d19876e03e9760d54931b9094b215c/rio-tiler-mosaic-0.0.1.dev3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b259714c1a1cc381d1e6e52f423dbd52", "sha256": "f09644e85960b321319a0efc02f2f7928179e6230dcc8d725ced5938d60509f1" }, "downloads": -1, "filename": "rio-tiler-mosaic-0.0.1.dev3.tar.gz", "has_sig": false, "md5_digest": "b259714c1a1cc381d1e6e52f423dbd52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5636, "upload_time": "2019-07-26T02:47:28", "url": "https://files.pythonhosted.org/packages/09/16/d440c8cbbe5f3b4e1ff3a5e770a0b4d19876e03e9760d54931b9094b215c/rio-tiler-mosaic-0.0.1.dev3.tar.gz" } ] }