├── .bumpversion.cfg ├── .github ├── codecov.yml └── workflows │ ├── ci.yml │ └── deploy_mkdocs.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CHANGES.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── docs ├── docs │ ├── contributing.md │ ├── examples │ │ ├── Multi_assets_item.ipynb │ │ └── data │ │ │ ├── B01.tif │ │ │ ├── B02.tif │ │ │ ├── B03.tif │ │ │ ├── B04.tif │ │ │ └── B05.tif │ ├── index.md │ ├── intro.md │ └── release-notes.md └── mkdocs.yml ├── fio_stac ├── __init__.py ├── scripts │ ├── __init__.py │ └── cli.py └── stac.py ├── pyproject.toml └── tests ├── __init__.py ├── conftest.py ├── fixtures ├── !test.geojson ├── LICENSE.txt ├── collection-pp.txt ├── collection.txt ├── coutwildrnp.cpg ├── coutwildrnp.dbf ├── coutwildrnp.prj ├── coutwildrnp.shp ├── coutwildrnp.shx ├── coutwildrnp.zip ├── curves_line.csv ├── example.topojson ├── gre.cpg ├── gre.dbf ├── gre.prj ├── gre.shp ├── gre.shx ├── grenada.geojson ├── issue627.geojson ├── sequence-pp.txt ├── sequence.txt ├── test_gpx.gpx ├── test_tin.csv ├── test_tin.dbf ├── test_tin.shp ├── test_tin.shx ├── test_tz.geojson └── testopenfilegdb.gdb.zip ├── test_cli.py └── test_create_item.py /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 0.1.0 3 | commit = True 4 | tag = True 5 | tag_name = {new_version} 6 | 7 | [bumpversion:file:fio_stac/__init__.py] 8 | search = __version__ = "{current_version}" 9 | replace = __version__ = "{new_version}" 10 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 5 9 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # On every pull request, but only on push to main 4 | on: 5 | push: 6 | branches: 7 | - main 8 | tags: 9 | - '*' 10 | pull_request: 11 | env: 12 | LATEST_PY_VERSION: '3.10' 13 | 14 | jobs: 15 | tests: 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | python-version: 20 | - '3.8' 21 | - '3.9' 22 | - '3.10' 23 | - '3.11' 24 | 25 | steps: 26 | - uses: actions/checkout@v3 27 | - name: Set up Python ${{ matrix.python-version }} 28 | uses: actions/setup-python@v4 29 | with: 30 | python-version: ${{ matrix.python-version }} 31 | 32 | - name: Install fio-stac 33 | run: | 34 | python -m pip install --upgrade pip 35 | python -m pip install .["test,numpy"] 36 | 37 | - name: run pre-commit 38 | if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} 39 | run: | 40 | python -m pip install pre-commit 41 | pre-commit run --all-files 42 | 43 | - name: Run test 44 | run: python -m pytest --cov fio_stac --cov-report xml --cov-report term-missing 45 | 46 | - name: Upload Results 47 | if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} 48 | uses: codecov/codecov-action@v1 49 | with: 50 | file: ./coverage.xml 51 | flags: unittests 52 | name: ${{ matrix.python-version }} 53 | fail_ci_if_error: false 54 | 55 | publish: 56 | needs: [tests] 57 | runs-on: ubuntu-latest 58 | if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' 59 | steps: 60 | - uses: actions/checkout@v3 61 | - name: Set up Python 62 | uses: actions/setup-python@v4 63 | with: 64 | python-version: ${{ env.LATEST_PY_VERSION }} 65 | 66 | - name: Install dependencies 67 | run: | 68 | python -m pip install --upgrade pip 69 | python -m pip install flit 70 | python -m pip install . 71 | 72 | - name: Set tag version 73 | id: tag 74 | run: | 75 | echo "version=${GITHUB_REF#refs/*/}" 76 | echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT 77 | 78 | - name: Set module version 79 | id: module 80 | run: | 81 | echo version=$(python -c'import fio_stac; print(fio_stac.__version__)') >> $GITHUB_OUTPUT 82 | 83 | - name: Build and publish 84 | if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}} 85 | env: 86 | FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }} 87 | FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 88 | run: flit publish 89 | -------------------------------------------------------------------------------- /.github/workflows/deploy_mkdocs.yml: -------------------------------------------------------------------------------- 1 | name: Publish docs via GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | # Only rebuild website when docs have changed 9 | - 'README.md' 10 | - 'docs/**' 11 | - 'mkdocs.yml' 12 | - 'fio_stac/**.py' 13 | - .github/workflows/deploy_mkdocs.yml 14 | 15 | jobs: 16 | build: 17 | name: Deploy docs 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Checkout main 21 | uses: actions/checkout@v2 22 | 23 | - name: Set up Python 3.8 24 | uses: actions/setup-python@v2 25 | with: 26 | python-version: 3.8 27 | 28 | - name: Install dependencies 29 | run: | 30 | python -m pip install --upgrade pip 31 | python -m pip install -e .["doc"] 32 | 33 | - name: update API docs 34 | run: | 35 | pdocs as_markdown --output_dir docs/docs/api/ --exclude_source --overwrite fio_stac.stac 36 | 37 | - name: Deploy docs 38 | run: mkdocs gh-deploy -f docs/mkdocs.yml --force 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | .pytest_cache 104 | 105 | docs/docs/api/ 106 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/abravalheri/validate-pyproject 3 | rev: v0.12.1 4 | hooks: 5 | - id: validate-pyproject 6 | 7 | - repo: https://github.com/psf/black 8 | rev: 22.12.0 9 | hooks: 10 | - id: black 11 | language_version: python 12 | 13 | - repo: https://github.com/PyCQA/isort 14 | rev: 5.12.0 15 | hooks: 16 | - id: isort 17 | language_version: python 18 | 19 | - repo: https://github.com/charliermarsh/ruff-pre-commit 20 | rev: v0.0.238 21 | hooks: 22 | - id: ruff 23 | args: ["--fix"] 24 | 25 | - repo: https://github.com/pre-commit/mirrors-mypy 26 | rev: v0.991 27 | hooks: 28 | - id: mypy 29 | language_version: python 30 | # No reason to run if only tests have changed. They intentionally break typing. 31 | exclude: tests/.* 32 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | 2 | ## 0.1.0 3 | 4 | Initial release. 5 | 6 | * Design API 7 | * add CLI 8 | * add tests 9 | * write docs 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Issues and pull requests are more than welcome. 4 | 5 | **dev install** 6 | 7 | ```bash 8 | git clone https://github.com/developmentseed/fio-stac.git 9 | cd fio-stac 10 | python -m pip install -e .["test","dev","numpy"] 11 | ``` 12 | 13 | You can then run the tests with the following command: 14 | 15 | ```sh 16 | python -m pytest --cov fio_stac --cov-report term-missing 17 | ``` 18 | 19 | **pre-commit** 20 | 21 | This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code. 22 | 23 | ```bash 24 | pre-commit install 25 | ``` 26 | 27 | **Docs** 28 | 29 | ```bash 30 | git clone https://github.com/developmentseed/fio-stac.git 31 | cd fio-stac 32 | python -m pip install -e .["doc"] 33 | ``` 34 | 35 | Create API docs 36 | 37 | ```bash 38 | pdocs as_markdown --output_dir docs/docs/api/ --exclude_source --overwrite fio_stac.stac 39 | ``` 40 | 41 | Hot-reloading docs: 42 | 43 | ```bash 44 | mkdocs serve 45 | ``` 46 | 47 | To manually deploy docs (note you should never need to do this because Github 48 | Actions deploys automatically for new commits.): 49 | 50 | ```bash 51 | mkdocs gh-deploy -f docs/mkdocs.yml 52 | ``` 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Development Seed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fio-stac 2 | 3 |

4 | fio-stac 5 |

6 |

7 | Create STAC Items from vector datasets. 8 |

9 |

10 | 11 | Test 12 | 13 | 14 | Coverage 15 | 16 | 17 | Package version 18 | 19 | 20 | Downloads 21 | 22 | 23 | Downloads 24 | 25 |

26 | 27 | --- 28 | 29 | **Documentation**: https://developmentseed.github.io/fio-stac/ 30 | 31 | **Source Code**: https://github.com/developmentseed/fio-stac 32 | 33 | --- 34 | 35 | `fio-stac` is a simple [fiona](https://github.com/Toblerity/Fiona) plugin for creating valid STAC items from a vector dataset. The library is built on top of [pystac](https://github.com/stac-utils/pystac) to make sure we follow the STAC specification. 36 | 37 | ## Installation 38 | 39 | ```bash 40 | $ pip install pip -U 41 | 42 | # From Pypi 43 | $ pip install fio-stac 44 | 45 | # Or from source 46 | $ pip install git+http://github.com/developmentseed/fio-stac 47 | ``` 48 | 49 | ### Example 50 | 51 | ```json 52 | // fio stac zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip | jq 53 | { 54 | "type": "Feature", 55 | "stac_version": "1.0.0", 56 | "id": "ne_10m_roads_north_america", 57 | "properties": { 58 | "proj:epsg": 4326, 59 | "proj:geometry": { 60 | "type": "Polygon", 61 | "coordinates": [ 62 | [ 63 | [ 64 | -176.7640084731439, 65 | 14.590750676565 66 | ], 67 | [ 68 | -52.64725244187383, 69 | 14.590750676565 70 | ], 71 | [ 72 | -52.64725244187383, 73 | 70.2966838677457 74 | ], 75 | [ 76 | -176.7640084731439, 77 | 70.2966838677457 78 | ], 79 | [ 80 | -176.7640084731439, 81 | 14.590750676565 82 | ] 83 | ] 84 | ] 85 | }, 86 | "proj:bbox": [ 87 | -176.7640084731439, 88 | 14.590750676565, 89 | -52.64725244187383, 90 | 70.2966838677457 91 | ], 92 | "proj:projjson": { 93 | "$schema": "https://proj.org/schemas/v0.4/projjson.schema.json", 94 | "type": "GeographicCRS", 95 | "name": "WGS 84", 96 | "datum": { 97 | "type": "GeodeticReferenceFrame", 98 | "name": "World Geodetic System 1984", 99 | "ellipsoid": { 100 | "name": "WGS 84", 101 | "semi_major_axis": 6378137, 102 | "inverse_flattening": 298.257223563 103 | } 104 | }, 105 | "coordinate_system": { 106 | "subtype": "ellipsoidal", 107 | "axis": [ 108 | { 109 | "name": "Geodetic latitude", 110 | "abbreviation": "Lat", 111 | "direction": "north", 112 | "unit": "degree" 113 | }, 114 | { 115 | "name": "Geodetic longitude", 116 | "abbreviation": "Lon", 117 | "direction": "east", 118 | "unit": "degree" 119 | } 120 | ] 121 | }, 122 | "id": { 123 | "authority": "EPSG", 124 | "code": 4326 125 | } 126 | }, 127 | "proj:wkt2": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]", 128 | "vector:layers": { 129 | "ne_10m_roads_north_america": { 130 | "properties": { 131 | "prefix": "str:5", 132 | "number": "str:5", 133 | "class": "str:10", 134 | "type": "str:12", 135 | "divided": "str:10", 136 | "country": "str:25", 137 | "state": "str:25", 138 | "note": "str:100", 139 | "scalerank": "int:4", 140 | "uident": "int:9", 141 | "length": "float:13.11", 142 | "rank": "int:4", 143 | "continent": "str:50" 144 | }, 145 | "geometry": "LineString" 146 | } 147 | }, 148 | "datetime": "2023-12-11T15:21:15.054810Z" 149 | }, 150 | "geometry": { 151 | "coordinates": [ 152 | [ 153 | [ 154 | -176.7640084731439, 155 | 14.590750676565 156 | ], 157 | [ 158 | -52.64725244187383, 159 | 14.590750676565 160 | ], 161 | [ 162 | -52.64725244187383, 163 | 70.2966838677457 164 | ], 165 | [ 166 | -176.7640084731439, 167 | 70.2966838677457 168 | ], 169 | [ 170 | -176.7640084731439, 171 | 14.590750676565 172 | ] 173 | ] 174 | ], 175 | "type": "Polygon" 176 | }, 177 | "links": [], 178 | "assets": { 179 | "ne_10m_roads_north_america": { 180 | "href": "zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip", 181 | "roles": [] 182 | } 183 | }, 184 | "bbox": [ 185 | -176.7640084731439, 186 | 14.590750676565, 187 | -52.64725244187383, 188 | 70.2966838677457 189 | ], 190 | "stac_extensions": [ 191 | "https://stac-extensions.github.io/projection/v1.1.0/schema.json" 192 | ] 193 | } 194 | ``` 195 | 196 | See https://developmentseed.org/fio-stac/intro/ for more. 197 | 198 | ## Contribution & Development 199 | 200 | See [CONTRIBUTING.md](https://github.com/developmentseed/fio-stac/blob/main/CONTRIBUTING.md) 201 | 202 | ## Authors 203 | 204 | See [contributors](https://github.com/developmentseed/fio-stac/graphs/contributors) 205 | 206 | ## Changes 207 | 208 | See [CHANGES.md](https://github.com/developmentseed/fio-stac/blob/main/CHANGES.md). 209 | 210 | ## License 211 | 212 | See [LICENSE](https://github.com/developmentseed/fio-stac/blob/main/LICENSE) 213 | -------------------------------------------------------------------------------- /docs/docs/contributing.md: -------------------------------------------------------------------------------- 1 | ../../CONTRIBUTING.md -------------------------------------------------------------------------------- /docs/docs/examples/data/B01.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/docs/docs/examples/data/B01.tif -------------------------------------------------------------------------------- /docs/docs/examples/data/B02.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/docs/docs/examples/data/B02.tif -------------------------------------------------------------------------------- /docs/docs/examples/data/B03.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/docs/docs/examples/data/B03.tif -------------------------------------------------------------------------------- /docs/docs/examples/data/B04.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/docs/docs/examples/data/B04.tif -------------------------------------------------------------------------------- /docs/docs/examples/data/B05.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/docs/docs/examples/data/B05.tif -------------------------------------------------------------------------------- /docs/docs/index.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /docs/docs/intro.md: -------------------------------------------------------------------------------- 1 | 2 | `fio-stac` can be used either from the command line as a rasterio plugin (`fio stac`) or from your own script. 3 | 4 | For more information about the `Item` specification, please see https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md 5 | 6 | # CLI 7 | 8 | ``` 9 | $ fio stac --help 10 | Usage: fio stac [OPTIONS] INPUT 11 | 12 | Fiona STAC plugin: Create a STAC Item for Vector dataset. 13 | 14 | Options: 15 | -d, --datetime TEXT The date and time of the assets, in UTC (e.g 16 | 2020-01-01, 2020-01-01T01:01:01). 17 | -e, --extension TEXT STAC extension URL the Item implements. 18 | -c, --collection TEXT The Collection ID that this item belongs to. 19 | --collection-url TEXT Link to the STAC Collection. 20 | -p, --property NAME=VALUE Additional property to add. 21 | --id TEXT Item id. 22 | -n, --asset-name TEXT Asset name. 23 | --asset-href TEXT Overwrite asset href. 24 | --asset-mediatype [COG|FLATGEOBUF|GEOJSON|GEOPACKAGE|GEOTIFF|HDF|HDF5|HTML|JPEG|JPEG2000|JSON|PNG|TEXT|TIFF|KML|XML|PDF|auto] 25 | Asset media-type. 26 | --with-proj / --without-proj Add the 'projection' extension and 27 | properties. [default: with-proj] 28 | --densify-geom INTEGER Densifies the number of points on each edges 29 | of the polygon geometry to account for non- 30 | linear transformation. 31 | --geom-precision INTEGER Round geometry coordinates to this number of 32 | decimal. By default, coordinates will not be 33 | rounded 34 | -o, --output PATH Output file name 35 | --help Show this message and exit. 36 | ➜ fio-stac git:(main) ✗ 37 | ``` 38 | 39 | ### How To 40 | 41 | The CLI can be run as is, just by passing a `source` vector data. You can also use options to customize the output STAC item: 42 | 43 | - **datetime** (-d, --datetime) 44 | 45 | By design, all STAC items must have a datetime in their properties. By default the CLI will set the time to the actual UTC Time. The CLI will accept any format supported by [`dateparser`](https://dateparser.readthedocs.io/en/latest/). 46 | 47 | You can also define `start_datetime` and `end_datetime` by using `--datetime {start}/{end}` notation. 48 | 49 | - **extension** (-e, --extension) 50 | 51 | STAC Item can have [extensions](https://github.com/radiantearth/stac-spec/tree/master/extensions) which indicates that the item has additional properties (e.g proj information). This option can be set multiple times. 52 | 53 | You can pass the extension option multiple times: `-e extension1 -e extension2`. 54 | 55 | - **projection extension** (--with-proj / --without-proj) 56 | 57 | By default the `projection` extension and properties will be added to the item. 58 | 59 | link: https://github.com/stac-extensions/projection/ 60 | 61 | ```json 62 | { 63 | "proj:epsg": 3857, 64 | "proj:geometry": {"type": "Polygon", "coordinates": [...]}, 65 | "proj:bbox": [...], 66 | "proj:shape": [8192, 8192], 67 | "proj:transform": [...], 68 | "datetime": "2021-03-19T02:27:33.266356Z" 69 | } 70 | ``` 71 | 72 | You can pass `--without-proj` to disable it. 73 | 74 | - **collection** (-c, --collection) 75 | 76 | Add a `collection` attribute to the item. 77 | 78 | - **collection link** (--collection-url) 79 | 80 | When adding a collection to the Item, the specification state that a Link must also be set. By default the `href` will be set with the collection id. You can specify a custom URL using this option. 81 | 82 | - **properties** (-p, --property) 83 | 84 | You can add multiple properties to the item using `-p {KEY}={VALUE}` notation. This option can be set multiple times. 85 | 86 | - **id** (--id) 87 | 88 | STAC Item id to set. Default to the source basename. 89 | 90 | - **asset name** (-n, --asset-name) 91 | 92 | Name to use in the assets section. Default to `asset`. 93 | 94 | ```json 95 | { 96 | "asset": { 97 | "href": "my.geojson" 98 | } 99 | } 100 | ``` 101 | 102 | - **asset href** (--asset-href) 103 | 104 | Overwrite the HREF in the `asset` object. Default to the source path. 105 | 106 | - **media type** (--asset-mediatype) 107 | 108 | Set the asset `mediatype`. 109 | 110 | If set to `auto`, `fio-stac` will try to find the mediatype. 111 | 112 | - **geometry density** (--densify-geom) 113 | 114 | When creating the GeoJSON geometry from the input dataset we usually take the `bounding box` of the data and construct a simple Polygon which then get reprojected to EPSG:4326. Sadly the world is neither flat and square, so doing a transformation using bounding box can lead to non-ideal result. To get better results and account for nonlinear transformation you can add `points` on each edge of the polygon using `--densify-geom` option. 115 | 116 | ### Example 117 | 118 | ```json 119 | // fio stac zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip | jq 120 | { 121 | "type": "Feature", 122 | "stac_version": "1.0.0", 123 | "id": "ne_10m_roads_north_america", 124 | "properties": { 125 | "proj:epsg": 4326, 126 | "proj:geometry": { 127 | "type": "Polygon", 128 | "coordinates": [ 129 | [ 130 | [ 131 | -176.7640084731439, 132 | 14.590750676565 133 | ], 134 | [ 135 | -52.64725244187383, 136 | 14.590750676565 137 | ], 138 | [ 139 | -52.64725244187383, 140 | 70.2966838677457 141 | ], 142 | [ 143 | -176.7640084731439, 144 | 70.2966838677457 145 | ], 146 | [ 147 | -176.7640084731439, 148 | 14.590750676565 149 | ] 150 | ] 151 | ] 152 | }, 153 | "proj:bbox": [ 154 | -176.7640084731439, 155 | 14.590750676565, 156 | -52.64725244187383, 157 | 70.2966838677457 158 | ], 159 | "proj:projjson": { 160 | "$schema": "https://proj.org/schemas/v0.4/projjson.schema.json", 161 | "type": "GeographicCRS", 162 | "name": "WGS 84", 163 | "datum": { 164 | "type": "GeodeticReferenceFrame", 165 | "name": "World Geodetic System 1984", 166 | "ellipsoid": { 167 | "name": "WGS 84", 168 | "semi_major_axis": 6378137, 169 | "inverse_flattening": 298.257223563 170 | } 171 | }, 172 | "coordinate_system": { 173 | "subtype": "ellipsoidal", 174 | "axis": [ 175 | { 176 | "name": "Geodetic latitude", 177 | "abbreviation": "Lat", 178 | "direction": "north", 179 | "unit": "degree" 180 | }, 181 | { 182 | "name": "Geodetic longitude", 183 | "abbreviation": "Lon", 184 | "direction": "east", 185 | "unit": "degree" 186 | } 187 | ] 188 | }, 189 | "id": { 190 | "authority": "EPSG", 191 | "code": 4326 192 | } 193 | }, 194 | "proj:wkt2": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]", 195 | "vector:layers": { 196 | "ne_10m_roads_north_america": { 197 | "properties": { 198 | "prefix": "str:5", 199 | "number": "str:5", 200 | "class": "str:10", 201 | "type": "str:12", 202 | "divided": "str:10", 203 | "country": "str:25", 204 | "state": "str:25", 205 | "note": "str:100", 206 | "scalerank": "int:4", 207 | "uident": "int:9", 208 | "length": "float:13.11", 209 | "rank": "int:4", 210 | "continent": "str:50" 211 | }, 212 | "geometry": "LineString" 213 | } 214 | }, 215 | "datetime": "2023-12-11T15:21:15.054810Z" 216 | }, 217 | "geometry": { 218 | "coordinates": [ 219 | [ 220 | [ 221 | -176.7640084731439, 222 | 14.590750676565 223 | ], 224 | [ 225 | -52.64725244187383, 226 | 14.590750676565 227 | ], 228 | [ 229 | -52.64725244187383, 230 | 70.2966838677457 231 | ], 232 | [ 233 | -176.7640084731439, 234 | 70.2966838677457 235 | ], 236 | [ 237 | -176.7640084731439, 238 | 14.590750676565 239 | ] 240 | ] 241 | ], 242 | "type": "Polygon" 243 | }, 244 | "links": [], 245 | "assets": { 246 | "ne_10m_roads_north_america": { 247 | "href": "zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip", 248 | "roles": [] 249 | } 250 | }, 251 | "bbox": [ 252 | -176.7640084731439, 253 | 14.590750676565, 254 | -52.64725244187383, 255 | 70.2966838677457 256 | ], 257 | "stac_extensions": [ 258 | "https://stac-extensions.github.io/projection/v1.1.0/schema.json" 259 | ] 260 | } 261 | ``` 262 | 263 | ```json 264 | // fio stac zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip \ 265 | // -d 2020-04-22 \ 266 | // --without-proj \ 267 | // -c myprivatecollection \ 268 | // -p comments:name=myfile \ 269 | // --id roads \ 270 | // -n america \ 271 | // --asset-href zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip | jq 272 | { 273 | "type": "Feature", 274 | "stac_version": "1.0.0", 275 | "id": "roads", 276 | "properties": { 277 | "comments:name": "myfile", 278 | "vector:layers": { 279 | "ne_10m_roads_north_america": { 280 | "properties": { 281 | "prefix": "str:5", 282 | "number": "str:5", 283 | "class": "str:10", 284 | "type": "str:12", 285 | "divided": "str:10", 286 | "country": "str:25", 287 | "state": "str:25", 288 | "note": "str:100", 289 | "scalerank": "int:4", 290 | "uident": "int:9", 291 | "length": "float:13.11", 292 | "rank": "int:4", 293 | "continent": "str:50" 294 | }, 295 | "geometry": "LineString" 296 | } 297 | }, 298 | "datetime": "2020-04-22T00:00:00Z" 299 | }, 300 | "geometry": { 301 | "coordinates": [ 302 | [ 303 | [ 304 | -176.7640084731439, 305 | 14.590750676565 306 | ], 307 | [ 308 | -52.64725244187383, 309 | 14.590750676565 310 | ], 311 | [ 312 | -52.64725244187383, 313 | 70.2966838677457 314 | ], 315 | [ 316 | -176.7640084731439, 317 | 70.2966838677457 318 | ], 319 | [ 320 | -176.7640084731439, 321 | 14.590750676565 322 | ] 323 | ] 324 | ], 325 | "type": "Polygon" 326 | }, 327 | "links": [ 328 | { 329 | "rel": "collection", 330 | "href": "myprivatecollection", 331 | "type": "application/json" 332 | } 333 | ], 334 | "assets": { 335 | "america": { 336 | "href": "zip+https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip", 337 | "roles": [] 338 | } 339 | }, 340 | "bbox": [ 341 | -176.7640084731439, 342 | 14.590750676565, 343 | -52.64725244187383, 344 | 70.2966838677457 345 | ], 346 | "stac_extensions": [], 347 | "collection": "myprivatecollection" 348 | } 349 | ``` 350 | 351 | 352 | # API 353 | 354 | see: [api](api/fio_stac/stac.md) 355 | -------------------------------------------------------------------------------- /docs/docs/release-notes.md: -------------------------------------------------------------------------------- 1 | ../../CHANGES.md -------------------------------------------------------------------------------- /docs/mkdocs.yml: -------------------------------------------------------------------------------- 1 | # Project Information 2 | site_name: 'fio-stac' 3 | site_description: 'Create a STAC Items from vector datasets.' 4 | 5 | # Repository 6 | repo_name: 'developmentseed/fio-stac' 7 | repo_url: 'http://github.com/developmentseed/fio-stac' 8 | edit_uri: 'blob/main/docs/src/' 9 | site_url: 'https://developmentseed.org/fio-stac/' 10 | 11 | # Social links 12 | extra: 13 | social: 14 | - icon: 'fontawesome/brands/github' 15 | link: 'https://github.com/developmentseed' 16 | - icon: 'fontawesome/brands/twitter' 17 | link: 'https://twitter.com/developmentseed' 18 | 19 | # Layout 20 | nav: 21 | - Home: 'index.md' 22 | - User Guide: 'intro.md' 23 | # - Examples: 24 | # - 25 | - API: 26 | - rio_stac.stac: api/fio_stac/stac.md 27 | - Development - Contributing: 'contributing.md' 28 | - Release Notes: 'release-notes.md' 29 | 30 | plugins: 31 | - search 32 | - mkdocs-jupyter: 33 | include_source: True 34 | 35 | # Theme 36 | theme: 37 | icon: 38 | logo: 'material/home' 39 | repo: 'fontawesome/brands/github' 40 | name: 'material' 41 | language: 'en' 42 | palette: 43 | primary: 'red' 44 | accent: 'light red' 45 | font: 46 | text: 'Nunito Sans' 47 | code: 'Fira Code' 48 | 49 | # These extensions are chosen to be a superset of Pandoc's Markdown. 50 | # This way, I can write in Pandoc's Markdown and have it be supported here. 51 | # https://pandoc.org/MANUAL.html 52 | markdown_extensions: 53 | - admonition 54 | - attr_list 55 | - codehilite: 56 | guess_lang: false 57 | - def_list 58 | - footnotes 59 | - pymdownx.arithmatex 60 | - pymdownx.betterem 61 | - pymdownx.caret: 62 | insert: false 63 | - pymdownx.details 64 | - pymdownx.emoji 65 | - pymdownx.escapeall: 66 | hardbreak: true 67 | nbsp: true 68 | - pymdownx.magiclink: 69 | hide_protocol: true 70 | repo_url_shortener: true 71 | - pymdownx.smartsymbols 72 | - pymdownx.superfences 73 | - pymdownx.tasklist: 74 | custom_checkbox: true 75 | - pymdownx.tilde 76 | - toc: 77 | permalink: true 78 | -------------------------------------------------------------------------------- /fio_stac/__init__.py: -------------------------------------------------------------------------------- 1 | """fio-stac: Create STAC items from vector file.""" 2 | 3 | __version__ = "0.1.0" 4 | 5 | from fio_stac.stac import create_stac_item # noqa 6 | -------------------------------------------------------------------------------- /fio_stac/scripts/__init__.py: -------------------------------------------------------------------------------- 1 | """rio-stac.scripts.cli.""" 2 | -------------------------------------------------------------------------------- /fio_stac/scripts/cli.py: -------------------------------------------------------------------------------- 1 | """fio_stac.scripts.cli.""" 2 | 3 | import json 4 | 5 | import click 6 | from pystac import MediaType 7 | from pystac.utils import datetime_to_str, str_to_datetime 8 | 9 | from fio_stac import create_stac_item 10 | 11 | 12 | def _cb_key_val(ctx, param, value): 13 | if not value: 14 | return {} 15 | else: 16 | out = {} 17 | for pair in value: 18 | if "=" not in pair: 19 | raise click.BadParameter( 20 | "Invalid syntax for KEY=VAL arg: {}".format(pair) 21 | ) 22 | else: 23 | k, v = pair.split("=", 1) 24 | out[k] = v 25 | return out 26 | 27 | 28 | @click.command() 29 | @click.argument("input", required=True) 30 | @click.option( 31 | "--datetime", 32 | "-d", 33 | "input_datetime", 34 | type=str, 35 | help="The date and time of the assets, in UTC (e.g 2020-01-01, 2020-01-01T01:01:01).", 36 | ) 37 | @click.option( 38 | "--extension", 39 | "-e", 40 | type=str, 41 | multiple=True, 42 | help="STAC extension URL the Item implements.", 43 | ) 44 | @click.option( 45 | "--collection", "-c", type=str, help="The Collection ID that this item belongs to." 46 | ) 47 | @click.option("--collection-url", type=str, help="Link to the STAC Collection.") 48 | @click.option( 49 | "--property", 50 | "-p", 51 | metavar="NAME=VALUE", 52 | multiple=True, 53 | callback=_cb_key_val, 54 | help="Additional property to add.", 55 | ) 56 | @click.option("--id", type=str, help="Item id.") 57 | @click.option( 58 | "--asset-name", 59 | "-n", 60 | type=str, 61 | help="Asset name.", 62 | show_default=True, 63 | ) 64 | @click.option("--asset-href", type=str, help="Overwrite asset href.") 65 | @click.option( 66 | "--asset-mediatype", 67 | type=click.Choice([it.name for it in MediaType] + ["auto"]), 68 | help="Asset media-type.", 69 | ) 70 | @click.option( 71 | "--with-proj/--without-proj", 72 | default=True, 73 | help="Add the 'projection' extension and properties.", 74 | show_default=True, 75 | ) 76 | @click.option( 77 | "--densify-geom", 78 | type=int, 79 | help="Densifies the number of points on each edges of the polygon geometry to account for non-linear transformation.", 80 | ) 81 | @click.option( 82 | "--geom-precision", 83 | type=int, 84 | default=-1, 85 | help="Round geometry coordinates to this number of decimal. By default, coordinates will not be rounded", 86 | ) 87 | @click.option("--output", "-o", type=click.Path(exists=False), help="Output file name") 88 | def stac( 89 | input, 90 | input_datetime, 91 | extension, 92 | collection, 93 | collection_url, 94 | property, 95 | id, 96 | asset_name, 97 | asset_href, 98 | asset_mediatype, 99 | with_proj, 100 | densify_geom, 101 | geom_precision, 102 | output, 103 | ): 104 | """Fiona STAC plugin: Create a STAC Item for Vector dataset.""" 105 | property = property or {} 106 | densify_geom = densify_geom or 0 107 | 108 | if input_datetime: 109 | if "/" in input_datetime: 110 | start_datetime, end_datetime = input_datetime.split("/") 111 | property["start_datetime"] = datetime_to_str( 112 | str_to_datetime(start_datetime) 113 | ) 114 | property["end_datetime"] = datetime_to_str(str_to_datetime(end_datetime)) 115 | input_datetime = None 116 | else: 117 | input_datetime = str_to_datetime(input_datetime) 118 | 119 | if asset_mediatype and asset_mediatype != "auto": 120 | asset_mediatype = MediaType[asset_mediatype] 121 | 122 | extensions = [e for e in extension if e] 123 | 124 | item = create_stac_item( 125 | input, 126 | input_datetime=input_datetime, 127 | extensions=extensions, 128 | collection=collection, 129 | collection_url=collection_url, 130 | properties=property, 131 | id=id, 132 | asset_name=asset_name, 133 | asset_href=asset_href, 134 | asset_media_type=asset_mediatype, 135 | with_proj=with_proj, 136 | geom_densify_pts=densify_geom, 137 | geom_precision=geom_precision, 138 | ) 139 | 140 | if output: 141 | with open(output, "w") as f: 142 | f.write(json.dumps(item.to_dict(), separators=(",", ":"))) 143 | else: 144 | click.echo(json.dumps(item.to_dict(), separators=(",", ":"))) 145 | -------------------------------------------------------------------------------- /fio_stac/stac.py: -------------------------------------------------------------------------------- 1 | """Create STAC Item from a vector dataset.""" 2 | 3 | import datetime 4 | import warnings 5 | from contextlib import ExitStack 6 | from typing import Dict, List, Optional, Tuple, Union 7 | 8 | import fiona 9 | import pystac 10 | from fiona.model import to_dict 11 | from fiona.transform import transform_geom 12 | 13 | PROJECTION_EXT_VERSION = "v1.1.0" 14 | 15 | EPSG_4326 = fiona.crs.CRS.from_epsg(4326) 16 | 17 | 18 | try: 19 | import numpy 20 | except ImportError: # pragma: nocover 21 | rioxarray = None # type: ignore 22 | 23 | 24 | def bbox_to_geom(bbox: Tuple[float, float, float, float]) -> Dict: 25 | """Return a geojson geometry from a bbox.""" 26 | return { 27 | "type": "Polygon", 28 | "coordinates": [ 29 | [ 30 | [bbox[0], bbox[1]], 31 | [bbox[2], bbox[1]], 32 | [bbox[2], bbox[3]], 33 | [bbox[0], bbox[3]], 34 | [bbox[0], bbox[1]], 35 | ] 36 | ], 37 | } 38 | 39 | 40 | def get_dataset_geom( 41 | src_dst: fiona.Collection, 42 | densify_pts: int = 0, 43 | precision: int = -1, 44 | ) -> Dict: 45 | """Get Raster Footprint.""" 46 | if densify_pts < 0: 47 | raise ValueError("`densify_pts` must be positive") 48 | 49 | try: 50 | bounds = src_dst.bounds 51 | except fiona.errors.DriverError: 52 | bounds = None 53 | 54 | if src_dst.crs and bounds is not None: 55 | # 1. Create Polygon from raster bounds 56 | geom = bbox_to_geom(bounds) 57 | 58 | # 2. Densify the Polygon geometry 59 | if src_dst.crs != EPSG_4326 and densify_pts and numpy is not None: 60 | # Derived from code found at 61 | # https://stackoverflow.com/questions/64995977/generating-equidistance-points-along-the-boundary-of-a-polygon-but-cw-ccw 62 | coordinates = numpy.asarray(geom["coordinates"][0]) 63 | 64 | densified_number = len(coordinates) * densify_pts 65 | existing_indices = numpy.arange(0, densified_number, densify_pts) 66 | interp_indices = numpy.arange(existing_indices[-1] + 1) 67 | interp_x = numpy.interp(interp_indices, existing_indices, coordinates[:, 0]) 68 | interp_y = numpy.interp(interp_indices, existing_indices, coordinates[:, 1]) 69 | geom = { 70 | "type": "Polygon", 71 | "coordinates": [[(x, y) for x, y in zip(interp_x, interp_y)]], 72 | } 73 | 74 | # 3. Reproject the geometry to "epsg:4326" 75 | geom = to_dict( 76 | transform_geom( 77 | src_dst.crs, 78 | EPSG_4326, 79 | geom, 80 | precision=precision, 81 | antimeridian_cutting=True, 82 | ) 83 | ) 84 | 85 | xs = [] 86 | ys = [] 87 | features = geom.get("features") or [geom] 88 | for _j, feat in enumerate(features): 89 | w, s, e, n = fiona.bounds(feat) 90 | xs.extend([w, e]) 91 | ys.extend([s, n]) 92 | 93 | bbox = (min(xs), min(ys), max(xs), max(ys)) 94 | 95 | else: 96 | warnings.warn( 97 | "Input file doesn't have CRS information, setting geometry and bbox to (-180,-90,180,90)." 98 | ) 99 | bbox = (-180.0, -90.0, 180.0, 90.0) 100 | geom = bbox_to_geom(bbox) 101 | 102 | return {"bbox": list(bbox), "footprint": geom} 103 | 104 | 105 | def get_projection_info(src_dst: fiona.Collection) -> Dict: 106 | """Get projection metadata. 107 | 108 | The STAC projection extension allows for three different ways to describe the coordinate reference system 109 | associated with a raster : 110 | - EPSG code 111 | - WKT2 112 | - PROJJSON 113 | 114 | All are optional, and they can be provided altogether as well. Therefore, as long as one can be obtained from 115 | the data, we add it to the returned dictionary. 116 | 117 | see: https://github.com/stac-extensions/projection 118 | 119 | """ 120 | projjson = None 121 | wkt2 = None 122 | epsg = None 123 | if src_dst.crs is not None: 124 | # EPSG 125 | epsg = src_dst.crs.to_epsg() if src_dst.crs.is_epsg_code else None 126 | 127 | # PROJJSON 128 | try: 129 | projjson = src_dst.crs.to_dict(projjson=True) 130 | except (AttributeError, TypeError) as ex: 131 | warnings.warn(f"Could not get PROJJSON from dataset : {ex}") 132 | pass 133 | 134 | # WKT2 135 | try: 136 | wkt2 = src_dst.crs.to_wkt() 137 | except Exception as ex: 138 | warnings.warn(f"Could not get WKT2 from dataset : {ex}") 139 | pass 140 | 141 | meta = { 142 | "epsg": epsg, 143 | "geometry": bbox_to_geom(src_dst.bounds), 144 | "bbox": list(src_dst.bounds), 145 | } 146 | 147 | if projjson is not None: 148 | meta["projjson"] = projjson 149 | 150 | if wkt2 is not None: 151 | meta["wkt2"] = wkt2 152 | 153 | return meta 154 | 155 | 156 | def get_media_type(src_dst: fiona.Collection) -> Optional[str]: 157 | """Find MediaType for a vector dataset.""" 158 | driver = src_dst.driver 159 | 160 | try: 161 | return pystac.MediaType[driver.upper()] 162 | except: # noqa 163 | pass 164 | 165 | warnings.warn("Could not determine the media type from GDAL driver.") 166 | return None 167 | 168 | 169 | def create_stac_item( 170 | source: str, 171 | input_datetime: Optional[datetime.datetime] = None, 172 | extensions: Optional[List[str]] = None, 173 | collection: Optional[str] = None, 174 | collection_url: Optional[str] = None, 175 | properties: Optional[Dict] = None, 176 | id: Optional[str] = None, 177 | assets: Optional[Dict[str, pystac.Asset]] = None, 178 | asset_name: Optional[str] = None, 179 | asset_roles: Optional[List[str]] = None, 180 | asset_media_type: Optional[Union[str, pystac.MediaType]] = "auto", 181 | asset_href: Optional[str] = None, 182 | with_proj: bool = False, 183 | geom_densify_pts: int = 0, 184 | geom_precision: int = -1, 185 | ) -> pystac.Item: 186 | """Create a Stac Item. 187 | 188 | Args: 189 | source (str): input path. 190 | input_datetime (datetime.datetime, optional): datetime associated with the item. 191 | extensions (list of str): input list of extensions to use in the item. 192 | collection (str, optional): name of collection the item belongs to. 193 | collection_url (str, optional): Link to the STAC Collection. 194 | properties (dict, optional): additional properties to add in the item. 195 | id (str, optional): id to assign to the item (default to the source basename). 196 | assets (dict, optional): Assets to set in the item. If set we won't create one from the source. 197 | asset_name (str, optional): asset name in the Assets object. 198 | asset_roles (list of str, optional): list of str | list of asset's roles. 199 | asset_media_type (str or pystac.MediaType, optional): asset's media type. 200 | asset_href (str, optional): asset's URI (default to input path). 201 | with_proj (bool): Add the `projection` extension and properties (default to False). 202 | geom_densify_pts (int): Number of points to add to each edge to account for nonlinear edges transformation (Note: GDAL uses 21). 203 | geom_precision (int): If >= 0, geometry coordinates will be rounded to this number of decimal. 204 | 205 | Returns: 206 | pystac.Item: valid STAC Item. 207 | 208 | """ 209 | properties = properties or {} 210 | extensions = extensions or [] 211 | asset_roles = asset_roles or [] 212 | 213 | layers = fiona.listlayers(source) 214 | 215 | with fiona.open(source) as src_dst: 216 | item_id = id or src_dst.name 217 | asset_name = asset_name or src_dst.name 218 | 219 | dataset_geom = get_dataset_geom( 220 | src_dst, 221 | densify_pts=geom_densify_pts, 222 | precision=geom_precision, 223 | ) 224 | 225 | media_type = ( 226 | get_media_type(src_dst) if asset_media_type == "auto" else asset_media_type 227 | ) 228 | 229 | if "start_datetime" not in properties and "end_datetime" not in properties: 230 | input_datetime = input_datetime or datetime.datetime.utcnow() 231 | 232 | # add projection properties 233 | if with_proj: 234 | extensions.append( 235 | f"https://stac-extensions.github.io/projection/{PROJECTION_EXT_VERSION}/schema.json", 236 | ) 237 | 238 | properties.update( 239 | { 240 | f"proj:{name}": value 241 | for name, value in get_projection_info(src_dst).items() 242 | } 243 | ) 244 | 245 | layer_schemas = {} 246 | for layer in layers: 247 | with fiona.open(source, layer=layer) as lyr_dst: 248 | schema = lyr_dst.schema 249 | layer_schemas.update({layer: schema}) 250 | 251 | properties.update({"vector:layers": layer_schemas}) 252 | 253 | # item 254 | item = pystac.Item( 255 | id=item_id, 256 | geometry=dataset_geom["footprint"], 257 | bbox=dataset_geom["bbox"], 258 | collection=collection, 259 | stac_extensions=extensions, 260 | datetime=input_datetime, 261 | properties=properties, 262 | ) 263 | 264 | # if we add a collection we MUST add a link 265 | if collection: 266 | item.add_link( 267 | pystac.Link( 268 | pystac.RelType.COLLECTION, 269 | collection_url or collection, 270 | media_type=pystac.MediaType.JSON, 271 | ) 272 | ) 273 | 274 | # item.assets 275 | if assets: 276 | for key, asset in assets.items(): 277 | item.add_asset(key=key, asset=asset) 278 | 279 | else: 280 | item.add_asset( 281 | key=asset_name, 282 | asset=pystac.Asset( 283 | href=asset_href or source, 284 | media_type=media_type, 285 | roles=asset_roles, 286 | ), 287 | ) 288 | 289 | return item 290 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "fio-stac" 3 | description = "Create STAC Items from Vector datasets." 4 | readme = "README.md" 5 | requires-python = ">=3.8" 6 | license = {file = "LICENSE"} 7 | authors = [ 8 | {name = "Vincent Sarago", email = "vincent@developmentseed.com"}, 9 | ] 10 | classifiers = [ 11 | "Intended Audience :: Information Technology", 12 | "Intended Audience :: Science/Research", 13 | "License :: OSI Approved :: BSD License", 14 | "Programming Language :: Python :: 3.8", 15 | "Programming Language :: Python :: 3.9", 16 | "Programming Language :: Python :: 3.10", 17 | "Programming Language :: Python :: 3.11", 18 | "Topic :: Scientific/Engineering :: GIS", 19 | ] 20 | dynamic = ["version"] 21 | dependencies = [ 22 | "fiona", 23 | "pystac>=1.0.0,<2.0.0", 24 | ] 25 | 26 | [project.optional-dependencies] 27 | numpy = [ 28 | "numpy", 29 | ] 30 | test = [ 31 | "pytest", 32 | "pytest-cov", 33 | "requests", 34 | "pystac[validation]>=1.0.0,<2.0.0" 35 | ] 36 | dev = [ 37 | "pre-commit", 38 | ] 39 | doc = [ 40 | "mkdocs", 41 | "mkdocs-material", 42 | "mkdocs-jupyter", 43 | "pygments", 44 | "pdocs", 45 | ] 46 | 47 | [project.urls] 48 | Source = "https://github.com/developmentseed/fio-stac" 49 | Documentation = "https://developmentseed.org/fio-stac/" 50 | 51 | [project.entry-points."fiona.fio_commands"] 52 | stac = "fio_stac.scripts.cli:stac" 53 | 54 | [build-system] 55 | requires = ["flit>=3.2,<4"] 56 | build-backend = "flit_core.buildapi" 57 | 58 | [tool.flit.module] 59 | name = "fio_stac" 60 | 61 | [tool.flit.sdist] 62 | exclude = [ 63 | "tests/", 64 | "docs/", 65 | ".github/", 66 | "CHANGES.md", 67 | "CONTRIBUTING.md", 68 | ] 69 | 70 | [tool.coverage.run] 71 | branch = true 72 | parallel = true 73 | 74 | [tool.coverage.report] 75 | exclude_lines = [ 76 | "no cov", 77 | "if __name__ == .__main__.:", 78 | "if TYPE_CHECKING:", 79 | ] 80 | 81 | [tool.isort] 82 | profile = "black" 83 | known_first_party = ["fio_stac"] 84 | known_third_party = ["fiona", "pystac"] 85 | default_section = "THIRDPARTY" 86 | 87 | [tool.mypy] 88 | no_strict_optional = true 89 | 90 | [tool.ruff] 91 | select = [ 92 | "D1", # pydocstyle errors 93 | "E", # pycodestyle errors 94 | "W", # pycodestyle warnings 95 | "C", # flake8-comprehensions 96 | "B", # flake8-bugbear 97 | ] 98 | ignore = [ 99 | "E501", # line too long, handled by black 100 | "B008", # do not perform function calls in argument defaults 101 | "B905", # ignore zip() without an explicit strict= parameter, only support with python >3.10 102 | ] 103 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | """rio-stac tests suite.""" 2 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | """``pytest`` configuration.""" 2 | 3 | 4 | import pytest 5 | 6 | 7 | @pytest.fixture 8 | def runner(): 9 | """CLI Runner fixture.""" 10 | from click.testing import CliRunner 11 | 12 | return CliRunner() 13 | -------------------------------------------------------------------------------- /tests/fixtures/!test.geojson: -------------------------------------------------------------------------------- 1 | {"features":[{"geometry":{"coordinates":[[[[-61.173214300000005,12.516654800000001],[-61.3827217,12.5301363],[-61.665747100000004,12.5966532],[-61.6661847,12.596],[-61.66814250000001,12.593],[-61.6700247,12.59],[-61.6718337,12.587],[-61.673571700000004,12.584],[-61.6752407,12.581],[-61.6768427,12.578],[-61.678379400000004,12.575000000000001],[-61.6803295,12.571],[-61.6830501,12.565000000000001],[-61.68553430000001,12.559000000000001],[-61.687063699999996,12.555000000000001],[-61.6884946,12.551],[-61.6898391,12.546999999999999],[-61.69209600000001,12.540999999999999],[-61.69413360000001,12.535],[-61.69595870000001,12.529],[-61.697577200000005,12.523],[-61.69899410000001,12.517],[-61.700213700000006,12.511],[-61.7012395,12.505],[-61.7020744,12.499],[-61.702626200000005,12.494],[-61.7033841,12.493],[-61.706211800000005,12.491],[-61.7089415,12.489],[-61.7141311,12.485000000000001],[-61.718995500000005,12.481],[-61.72356890000001,12.477],[-61.727879200000004,12.473],[-61.7319495,12.469000000000001],[-61.73579920000001,12.465000000000002],[-61.74032590000001,12.46],[-61.74373590000001,12.456000000000001],[-61.746971,12.452000000000002],[-61.7500412,12.447999999999999],[-61.75295580000001,12.443999999999999],[-61.753784499999995,12.443],[-61.756858300000005,12.44],[-61.7598054,12.437],[-61.762633400000006,12.434],[-61.76534870000001,12.431],[-61.767957200000005,12.427999999999999],[-61.7704641,12.425],[-61.7728741,12.422],[-61.775191500000005,12.419],[-61.7774201,12.416],[-61.7802595,12.412],[-61.782954800000006,12.408],[-61.78551270000001,12.404],[-61.7873446,12.401],[-61.789675900000006,12.397],[-61.7918847,12.393],[-61.79397550000001,12.389000000000001],[-61.794998400000004,12.388],[-61.79830060000001,12.386000000000001],[-61.8030062,12.383000000000001],[-61.8059936,12.381],[-61.810272399999995,12.378],[-61.8130009,12.376000000000001],[-61.815637599999995,12.374],[-61.8181882,12.372000000000002],[-61.82186339999999,12.369000000000002],[-61.8265048,12.365000000000002],[-61.830876599999996,12.361],[-61.8329692,12.359000000000002],[-61.835999,12.356000000000002],[-61.8413082,12.351],[-61.845319800000006,12.347],[-61.8464439,12.346],[-61.8501187,12.343],[-61.853625699999995,12.34],[-61.85697739999999,12.337],[-61.86122339999999,12.333],[-61.864252900000004,12.33],[-61.8671584,12.327],[-61.8699469,12.324],[-61.872645999999996,12.321],[-61.8754727,12.318],[-61.87906749999999,12.314],[-61.8833,12.309000000000001],[-61.88726319999999,12.304],[-61.88952,12.301],[-61.891690399999995,12.297999999999998],[-61.8937778,12.295],[-61.895785200000006,12.292],[-61.89771530000001,12.289],[-61.899570800000006,12.286],[-61.90251490000001,12.280999999999999],[-61.904753,12.277],[-61.9068719,12.273],[-61.908875900000005,12.269],[-61.911674299999994,12.263],[-61.9134062,12.259],[-61.9150578,12.255],[-61.9179797,12.248999999999999],[-61.920656900000004,12.242999999999999],[-61.92290190000001,12.238999999999999],[-61.925082,12.235],[-61.92666,12.232],[-61.9286637,12.227999999999998],[-61.930556100000004,12.223999999999998],[-61.9332651,12.217999999999998],[-61.936145100000005,12.212],[-61.938782200000006,12.206],[-61.943587599999994,12.193999999999999],[-61.94511500000001,12.19],[-61.9465439,12.186],[-61.9485074,12.18],[-61.95028749999999,12.174],[-61.95186999999999,12.168],[-61.9532519,12.162],[-61.95443739999999,12.156],[-61.954975999999995,12.154],[-61.9570107,12.147999999999998],[-61.9594482,12.139999999999999],[-61.961132600000006,12.133999999999999],[-61.962614,12.127999999999998],[-61.96295200000001,12.126999999999999],[-61.9668105,12.122],[-61.9704259,12.116999999999999],[-61.9738135,12.112],[-61.9769866,12.107],[-61.9799566,12.102],[-61.9827336,12.097],[-61.9853262,12.092],[-61.9882048,12.086],[-61.990875800000005,12.08],[-61.99252880000001,12.076],[-61.994819,12.07],[-61.996888999999996,12.064],[-61.99874590000001,12.058],[-62.000395600000004,12.052000000000001],[-62.0018433,12.046],[-62.0030933,12.04],[-62.003818700000004,12.036],[-62.0047472,12.03],[-62.0052609,12.026],[-62.005875200000006,12.02],[-62.0061812,12.016],[-62.0064861,12.01],[-62.0065868,12.006],[-62.006584499999995,12],[-62.006398100000006,11.994],[-62.0061714,11.99],[-62.0056768,11.984],[-62.0052436,11.98],[-62.004436999999996,11.974],[-62.003794,11.97],[-62.0026693,11.964],[-62.001811399999994,11.96],[-62.0003595,11.954],[-61.999279800000004,11.950000000000001],[-61.9974886,11.943999999999999],[-61.9961776,11.94],[-61.9940313,11.934],[-61.9924772,11.93],[-61.9908218,11.926],[-61.989062399999995,11.922],[-61.9871961,11.918],[-61.984707699999994,11.913],[-61.9825882,11.909],[-61.9803498,11.905000000000001],[-61.9773776,11.9],[-61.9748543,11.896],[-61.972195400000004,11.892000000000001],[-61.9693945,11.888],[-61.9664442,11.884],[-61.9641286,11.881],[-61.9617206,11.878],[-61.959215900000004,11.875000000000002],[-61.9557177,11.871],[-61.9520267,11.867],[-61.9496952,11.864],[-61.94728729999999,11.861],[-61.9430571,11.856000000000002],[-61.93853550000001,11.851],[-61.934690599999996,11.847],[-61.9306255,11.843],[-61.9274208,11.84],[-61.922921800000005,11.836],[-61.9193636,11.833],[-61.9156332,11.83],[-61.911715,11.827],[-61.9075906,11.824],[-61.903238,11.821],[-61.89863020000001,11.818],[-61.8937341,11.815000000000001],[-61.888507499999996,11.812000000000001],[-61.88481339999999,11.81],[-61.8789067,11.807],[-61.87468659999999,11.805000000000001],[-61.870200499999996,11.803],[-61.86540230000001,11.801],[-61.8602301,11.799],[-61.854597299999995,11.796999999999999],[-61.848375600000004,11.795],[-61.84498479999999,11.793999999999999],[-61.8413608,11.793],[-61.8374527,11.792],[-61.8331873,11.790999999999999],[-61.828452500000004,11.79],[-61.8230605,11.789],[-61.81664609999999,11.787999999999998],[-61.808274399999995,11.786999999999999],[-61.790283900000006,11.786],[-61.7840631,11.786],[-61.76607270000001,11.786999999999999],[-61.7573236,11.787999999999998],[-61.73933300000001,11.789],[-61.730961300000004,11.79],[-61.72079310000001,11.790999999999999],[-61.70280230000001,11.792],[-61.6944305,11.793],[-61.688016000000005,11.793999999999999],[-61.6826238,11.795],[-61.6732043,11.796999999999999],[-61.667812100000006,11.797999999999998],[-61.663077200000004,11.799],[-61.6588117,11.8],[-61.654903499999996,11.801],[-61.6512793,11.802000000000001],[-61.64788839999999,11.803],[-61.644693499999995,11.804],[-61.63878580000001,11.806000000000001],[-61.636033600000005,11.807],[-61.6308613,11.809000000000001],[-61.62841970000001,11.81],[-61.623784,11.812000000000001],[-61.621576700000006,11.813],[-61.6173564,11.815000000000001],[-61.6133668,11.817],[-61.60957990000001,11.819],[-61.6042318,11.822000000000001],[-61.6008621,11.824],[-61.5976324,11.826],[-61.5930244,11.829],[-61.590096,11.831],[-61.5872727,11.833],[-61.585739600000004,11.834],[-61.5816382,11.836],[-61.5758831,11.839],[-61.5705345,11.842],[-61.565532900000015,11.845],[-61.56375870000001,11.846],[-61.55785109999999,11.849],[-61.552374300000004,11.852000000000002],[-61.5472238,11.855000000000002],[-61.543925300000005,11.857000000000001],[-61.5407605,11.859000000000002],[-61.5362404,11.862000000000002],[-61.533365200000006,11.864],[-61.530591300000005,11.866000000000001],[-61.52791200000001,11.868],[-61.5240577,11.871],[-61.5215904,11.873000000000001],[-61.5180317,11.876000000000001],[-61.515748300000006,11.878],[-61.5124482,11.881],[-61.5103269,11.883000000000001],[-61.5072563,11.886000000000001],[-61.49835930000001,11.895000000000001],[-61.494617399999996,11.899000000000001],[-61.4902146,11.904],[-61.48533390000001,11.909],[-61.4816423,11.913],[-61.47729749999999,11.918],[-61.4732301,11.923],[-61.4694197,11.927999999999999],[-61.464353900000006,11.935],[-61.4615887,11.939],[-61.458328800000004,11.943999999999999],[-61.4552762,11.949],[-61.452420399999994,11.954],[-61.450271099999995,11.958],[-61.4482377,11.962000000000002],[-61.4454269,11.967],[-61.4438039,11.97],[-61.4412339,11.975000000000001],[-61.4388714,11.979000000000001],[-61.436091399999995,11.984],[-61.43451230000001,11.987],[-61.4329978,11.99],[-61.4310762,11.994],[-61.428396400000004,12],[-61.42595080000001,12.006],[-61.423730500000005,12.012],[-61.42313910000001,12.013],[-61.4211047,12.016],[-61.41851320000001,12.02],[-61.4166569,12.023],[-61.41487299999999,12.026],[-61.4131591,12.029],[-61.4109797,12.033],[-61.409422,12.036],[-61.40744449999999,12.04],[-61.405577300000004,12.043999999999999],[-61.4038171,12.047999999999998],[-61.402161,12.052000000000001],[-61.399865999999996,12.058],[-61.39845880000001,12.062000000000001],[-61.3971473,12.066],[-61.3959295,12.07],[-61.394275,12.076],[-61.393596300000006,12.078],[-61.3910564,12.081],[-61.38782199999999,12.085],[-61.3855047,12.088],[-61.382552100000005,12.092],[-61.3804362,12.095],[-61.37774039999999,12.099],[-61.3758089,12.102],[-61.3733493,12.106],[-61.37158839999999,12.109],[-61.369348200000005,12.113],[-61.367746499999996,12.116],[-61.36571180000001,12.12],[-61.3637893,12.123999999999999],[-61.3619754,12.127999999999998],[-61.360267099999994,12.132],[-61.35866139999999,12.136],[-61.35643999999999,12.142],[-61.35508039999999,12.145999999999999],[-61.3538123,12.15],[-61.3520543,12.156],[-61.3509963,12.16],[-61.35002769999999,12.164],[-61.3487397,12.17],[-61.34798939999999,12.174],[-61.34732449999999,12.177999999999999],[-61.3464859,12.184],[-61.346031399999994,12.187999999999999],[-61.345660099999996,12.192],[-61.3452579,12.197999999999999],[-61.3450925,12.202],[-61.3450091,12.206],[-61.345007599999995,12.209999999999999],[-61.345087899999996,12.213999999999999],[-61.3452502,12.217999999999998],[-61.345494599999995,12.222],[-61.34582149999999,12.225999999999999],[-61.3462313,12.229999999999999],[-61.347002499999995,12.235999999999999],[-61.34762189999999,12.239999999999998],[-61.3483264,12.243999999999998],[-61.3495448,12.25],[-61.345779300000004,12.253],[-61.3421596,12.256],[-61.339838,12.258],[-61.3364839,12.261],[-61.333273999999996,12.264],[-61.330199,12.267],[-61.3272505,12.27],[-61.324421099999995,12.273],[-61.3217043,12.276],[-61.31824699999999,12.28],[-61.3157713,12.283],[-61.3126179,12.286999999999999],[-61.30962449999999,12.290999999999999],[-61.3067826,12.295],[-61.30408469999999,12.299],[-61.301524099999995,12.303],[-61.300435,12.304],[-61.297963700000004,12.306000000000001],[-61.29439910000001,12.309000000000001],[-61.29211200000002,12.311],[-61.2888064,12.314],[-61.286681699999995,12.316],[-61.283606,12.319],[-61.280656900000004,12.322000000000001],[-61.277826999999995,12.325000000000001],[-61.27510960000001,12.328],[-61.272499,12.331],[-61.26999000000001,12.334],[-61.267577800000005,12.337],[-61.26525820000001,12.34],[-61.262302800000015,12.344],[-61.260184900000006,12.347],[-61.25748639999999,12.351],[-61.256502700000006,12.352000000000002],[-61.25251010000001,12.355000000000002],[-61.248711400000005,12.358],[-61.245090100000006,12.361],[-61.2416324,12.364],[-61.23832620000001,12.367],[-61.235161000000005,12.370000000000001],[-61.23212780000001,12.373000000000001],[-61.22827520000001,12.377],[-61.22552040000001,12.38],[-61.22287430000001,12.383000000000001],[-61.220331400000006,12.386000000000001],[-61.2170932,12.39],[-61.2147732,12.393],[-61.2118172,12.397],[-61.209698800000005,12.4],[-61.206999800000006,12.404],[-61.205066,12.407],[-61.20258810000001,12.411],[-61.2008015,12.414],[-61.199085100000005,12.417],[-61.19743690000001,12.42],[-61.19585520000001,12.423],[-61.19433810000001,12.426],[-61.19241330000001,12.43],[-61.1897291,12.436],[-61.1872793,12.442],[-61.18505530000001,12.447999999999999],[-61.1836941,12.452000000000002],[-61.1824277,12.456000000000001],[-61.18125439999999,12.46],[-61.180172500000005,12.464],[-61.1791805,12.468],[-61.178277,12.472000000000001],[-61.1770853,12.478],[-61.17603230000001,12.484],[-61.175387900000004,12.488],[-61.1745797,12.494],[-61.1741456,12.498],[-61.1737945,12.502],[-61.173526,12.506],[-61.17333980000001,12.51],[-61.17323580000001,12.514],[-61.173214300000005,12.516654800000001]]]],"type":"MultiPolygon"},"id":550727,"osm_type":"relation","type":"Feature","name":"Grenada","properties":{"flag":"http://upload.wikimedia.org/wikipedia/commons/b/bc/Flag_of_Grenada.svg","name":"Grenada","name:cs":"Grenada","name:de":"Grenada","name:en":"Grenada","name:eo":"Grenado","name:fr":"Grenade","name:fy":"Grenada","name:hr":"Grenada","name:nl":"Grenada","name:ru":"Гренада","name:sl":"Grenada","name:ta":"கிரெனடா","name:uk":"Гренада","boundary":"administrative","name:tzl":"Grenada","timezone":"America/Grenada","wikidata":"Q769","ISO3166-1":"GD","wikipedia":"en:Grenada","admin_level":"2","is_in:continent":"North America","ISO3166-1:alpha2":"GD","ISO3166-1:alpha3":"GRD","ISO3166-1:numeric":"308"}}],"type":"FeatureCollection","geocoding":{"creation_date":"2016-10-12","generator":{"author":{"name":"Mapzen"},"package":"fences-builder","version":"0.1.2"},"license":"ODbL (see http://www.openstreetmap.org/copyright)"}} 2 | -------------------------------------------------------------------------------- /tests/fixtures/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The coutwildrnp shapefile and all .txt files are extracts from the US National 2 | Map's 1:2M scale Wilderness Area boundaries [1] and are in the public domain. 3 | 4 | [1] http://nationalmap.gov/small_scale/atlasftp.html 5 | -------------------------------------------------------------------------------- /tests/fixtures/collection-pp.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { 5 | "geometry": { 6 | "type": "Polygon", 7 | "coordinates": [ 8 | [ 9 | [ 10 | -111.73527526855469, 11 | 41.995094299316406 12 | ], 13 | [ 14 | -111.65931701660156, 15 | 41.99627685546875 16 | ], 17 | [ 18 | -111.6587142944336, 19 | 41.9921875 20 | ], 21 | [ 22 | -111.65888977050781, 23 | 41.95676803588867 24 | ], 25 | [ 26 | -111.67082977294922, 27 | 41.91230010986328 28 | ], 29 | [ 30 | -111.67332458496094, 31 | 41.905494689941406 32 | ], 33 | [ 34 | -111.67088317871094, 35 | 41.90049362182617 36 | ], 37 | [ 38 | -111.66474914550781, 39 | 41.893211364746094 40 | ], 41 | [ 42 | -111.6506576538086, 43 | 41.875465393066406 44 | ], 45 | [ 46 | -111.64759826660156, 47 | 41.87091827392578 48 | ], 49 | [ 50 | -111.64640808105469, 51 | 41.86273956298828 52 | ], 53 | [ 54 | -111.64334869384766, 55 | 41.858192443847656 56 | ], 57 | [ 58 | -111.63720703125, 59 | 41.85499572753906 60 | ], 61 | [ 62 | -111.633544921875, 63 | 41.847267150878906 64 | ], 65 | [ 66 | -111.63053894042969, 67 | 41.83409118652344 68 | ], 69 | [ 70 | -111.6330337524414, 71 | 41.82728576660156 72 | ], 73 | [ 74 | -111.63983154296875, 75 | 41.8227653503418 76 | ], 77 | [ 78 | -111.6484603881836, 79 | 41.82188034057617 80 | ], 81 | [ 82 | -111.66077423095703, 83 | 41.82327651977539 84 | ], 85 | [ 86 | -111.6712417602539, 87 | 41.82330322265625 88 | ], 89 | [ 90 | -111.67618560791016, 91 | 41.82013702392578 92 | ], 93 | [ 94 | -111.68803405761719, 95 | 41.78792953491211 96 | ], 97 | [ 98 | -111.69361114501953, 99 | 41.77931594848633 100 | ], 101 | [ 102 | -111.70162200927734, 103 | 41.77797317504883 104 | ], 105 | [ 106 | -111.70901489257812, 107 | 41.77663040161133 108 | ], 109 | [ 110 | -111.71395111083984, 111 | 41.772098541259766 112 | ], 113 | [ 114 | -111.71891784667969, 115 | 41.763031005859375 116 | ], 117 | [ 118 | -111.72816467285156, 119 | 41.75851058959961 120 | ], 121 | [ 122 | -111.74726104736328, 123 | 41.75537109375 124 | ], 125 | [ 126 | -111.75650024414062, 127 | 41.752662658691406 128 | ], 129 | [ 130 | -111.77067565917969, 131 | 41.7445182800293 132 | ], 133 | [ 134 | -111.77064514160156, 135 | 41.75495910644531 136 | ], 137 | [ 138 | -111.75585174560547, 139 | 41.76219940185547 140 | ], 141 | [ 142 | -111.7330551147461, 143 | 41.766693115234375 144 | ], 145 | [ 146 | -111.72749328613281, 147 | 41.77212905883789 148 | ], 149 | [ 150 | -111.71883392333984, 151 | 41.7834587097168 152 | ], 153 | [ 154 | -111.71080780029297, 155 | 41.78889083862305 156 | ], 157 | [ 158 | -111.70340728759766, 159 | 41.79250717163086 160 | ], 161 | [ 162 | -111.70030212402344, 163 | 41.798404693603516 164 | ], 165 | [ 166 | -111.70210266113281, 167 | 41.8088493347168 168 | ], 169 | [ 170 | -111.70760345458984, 171 | 41.819759368896484 172 | ], 173 | [ 174 | -111.71312713623047, 175 | 41.82340621948242 176 | ], 177 | [ 178 | -111.71929168701172, 179 | 41.82341766357422 180 | ], 181 | [ 182 | -111.72545623779297, 183 | 41.8225212097168 184 | ], 185 | [ 186 | -111.7341537475586, 187 | 41.803016662597656 188 | ], 189 | [ 190 | -111.740966796875, 191 | 41.79213333129883 192 | ], 193 | [ 194 | -111.74531555175781, 195 | 41.78215408325195 196 | ], 197 | [ 198 | -111.77122497558594, 199 | 41.7658576965332 200 | ], 201 | [ 202 | -111.77056884765625, 203 | 41.77811813354492 204 | ], 205 | [ 206 | -111.7662582397461, 207 | 41.778106689453125 208 | ], 209 | [ 210 | -111.76746368408203, 211 | 41.78628158569336 212 | ], 213 | [ 214 | -111.76253509521484, 215 | 41.78627395629883 216 | ], 217 | [ 218 | -111.76241302490234, 219 | 41.82259750366211 220 | ], 221 | [ 222 | -111.77104187011719, 223 | 41.8221549987793 224 | ], 225 | [ 226 | -111.77161407470703, 227 | 41.83351135253906 228 | ], 229 | [ 230 | -111.7333755493164, 231 | 41.84524154663086 232 | ], 233 | [ 234 | -111.73274993896484, 235 | 41.847511291503906 236 | ], 237 | [ 238 | -111.7376708984375, 239 | 41.84979248046875 240 | ], 241 | [ 242 | -111.77157592773438, 243 | 41.845767974853516 244 | ], 245 | [ 246 | -111.77215576171875, 247 | 41.85802459716797 248 | ], 249 | [ 250 | -111.75243377685547, 251 | 41.85844802856445 252 | ], 253 | [ 254 | -111.72467803955078, 255 | 41.86384201049805 256 | ], 257 | [ 258 | -111.71109771728516, 259 | 41.868804931640625 260 | ], 261 | [ 262 | -111.70182037353516, 263 | 41.87604904174805 264 | ], 265 | [ 266 | -111.69624328613281, 267 | 41.88193893432617 268 | ], 269 | [ 270 | -111.69497680664062, 271 | 41.88874816894531 272 | ], 273 | [ 274 | -111.70053100585938, 275 | 41.89057540893555 276 | ], 277 | [ 278 | -111.70793151855469, 279 | 41.88923263549805 280 | ], 281 | [ 282 | -111.72091674804688, 283 | 41.87972640991211 284 | ], 285 | [ 286 | -111.73388671875, 287 | 41.87384796142578 288 | ], 289 | [ 290 | -111.75301361083984, 291 | 41.86888885498047 292 | ], 293 | [ 294 | -111.75350952148438, 295 | 41.90249252319336 296 | ], 297 | [ 298 | -111.74364471435547, 299 | 41.90247344970703 300 | ], 301 | [ 302 | -111.74463653564453, 303 | 41.967864990234375 304 | ], 305 | [ 306 | -111.7119369506836, 307 | 41.96416473388672 308 | ], 309 | [ 310 | -111.69283294677734, 311 | 41.95912551879883 312 | ], 313 | [ 314 | -111.68911743164062, 315 | 41.96047592163086 316 | ], 317 | [ 318 | -111.6891098022461, 319 | 41.96320343017578 320 | ], 321 | [ 322 | -111.69341278076172, 323 | 41.96684646606445 324 | ], 325 | [ 326 | -111.70449829101562, 327 | 41.972320556640625 328 | ], 329 | [ 330 | -111.7341079711914, 331 | 41.97828674316406 332 | ], 333 | [ 334 | -111.73527526855469, 335 | 41.995094299316406 336 | ] 337 | ] 338 | ] 339 | }, 340 | "type": "Feature", 341 | "id": "0", 342 | "properties": { 343 | "PERIMETER": 1.22107, 344 | "FEATURE2": null, 345 | "NAME": "Mount Naomi Wilderness", 346 | "FEATURE1": "Wilderness", 347 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Naomi", 348 | "AGBUR": "FS", 349 | "AREA": 0.0179264, 350 | "STATE_FIPS": "49", 351 | "WILDRNP020": 332, 352 | "STATE": "UT" 353 | } 354 | }, 355 | { 356 | "geometry": { 357 | "type": "Polygon", 358 | "coordinates": [ 359 | [ 360 | [ 361 | -112.00384521484375, 362 | 41.552703857421875 363 | ], 364 | [ 365 | -112.00446319580078, 366 | 41.56586456298828 367 | ], 368 | [ 369 | -112.0112075805664, 370 | 41.56586456298828 371 | ], 372 | [ 373 | -112.01121520996094, 374 | 41.57902526855469 375 | ], 376 | [ 377 | -112.01734924316406, 378 | 41.57902526855469 379 | ], 380 | [ 381 | -112.0173568725586, 382 | 41.594459533691406 383 | ], 384 | [ 385 | -112.02779388427734, 386 | 41.5940055847168 387 | ], 388 | [ 389 | -112.02779388427734, 390 | 41.60171890258789 391 | ], 392 | [ 393 | -112.03945922851562, 394 | 41.60126495361328 395 | ], 396 | [ 397 | -112.04007720947266, 398 | 41.608524322509766 399 | ], 400 | [ 401 | -112.04744720458984, 402 | 41.608524322509766 403 | ], 404 | [ 405 | -112.0474624633789, 406 | 41.62804412841797 407 | ], 408 | [ 409 | -112.05974578857422, 410 | 41.62758255004883 411 | ], 412 | [ 413 | -112.05975341796875, 414 | 41.640296936035156 415 | ], 416 | [ 417 | -112.050537109375, 418 | 41.64030075073242 419 | ], 420 | [ 421 | -112.05054473876953, 422 | 41.64983367919922 423 | ], 424 | [ 425 | -112.04132843017578, 426 | 41.64983367919922 427 | ], 428 | [ 429 | -112.04195404052734, 430 | 41.66299819946289 431 | ], 432 | [ 433 | -112.05793762207031, 434 | 41.662540435791016 435 | ], 436 | [ 437 | -112.0579605102539, 438 | 41.692047119140625 439 | ], 440 | [ 441 | -112.07394409179688, 442 | 41.692039489746094 443 | ], 444 | [ 445 | -112.07459259033203, 446 | 41.72381591796875 447 | ], 448 | [ 449 | -112.06167602539062, 450 | 41.72382354736328 451 | ], 452 | [ 453 | -112.0616683959961, 454 | 41.71383285522461 455 | ], 456 | [ 457 | -112.05490112304688, 458 | 41.713836669921875 459 | ], 460 | [ 461 | -112.04137420654297, 462 | 41.71384048461914 463 | ], 464 | [ 465 | -112.04138946533203, 466 | 41.7379035949707 467 | ], 468 | [ 469 | -112.0376968383789, 470 | 41.74108123779297 471 | ], 472 | [ 473 | -112.03339385986328, 474 | 41.741085052490234 475 | ], 476 | [ 477 | -112.02908325195312, 478 | 41.729736328125 479 | ], 480 | [ 481 | -112.02599334716797, 482 | 41.71657180786133 483 | ], 484 | [ 485 | -112.0241470336914, 486 | 41.71157455444336 487 | ], 488 | [ 489 | -112.0272216796875, 490 | 41.704769134521484 491 | ], 492 | [ 493 | -112.02413940429688, 494 | 41.70068359375 495 | ], 496 | [ 497 | -112.01676177978516, 498 | 41.69977951049805 499 | ], 500 | [ 501 | -112.01615142822266, 502 | 41.7070426940918 503 | ], 504 | [ 505 | -112.00508117675781, 506 | 41.707496643066406 507 | ], 508 | [ 509 | -112.00508117675781, 510 | 41.66618347167969 511 | ], 512 | [ 513 | -111.9792709350586, 514 | 41.6666374206543 515 | ], 516 | [ 517 | -111.9786605834961, 518 | 41.653926849365234 519 | ], 520 | [ 521 | -111.96821594238281, 522 | 41.65346908569336 523 | ], 524 | [ 525 | -111.96760559082031, 526 | 41.6407585144043 527 | ], 528 | [ 529 | -111.96146392822266, 530 | 41.6407585144043 531 | ], 532 | [ 533 | -111.96025085449219, 534 | 41.61125183105469 535 | ], 536 | [ 537 | -111.95042419433594, 538 | 41.61124801635742 539 | ], 540 | [ 541 | -111.94796752929688, 542 | 41.60988235473633 543 | ], 544 | [ 545 | -111.94735717773438, 546 | 41.60761260986328 547 | ], 548 | [ 549 | -111.9522705078125, 550 | 41.60443878173828 551 | ], 552 | [ 553 | -111.96455383300781, 554 | 41.60262680053711 555 | ], 556 | [ 557 | -111.9682388305664, 558 | 41.60398864746094 559 | ], 560 | [ 561 | -111.9725341796875, 562 | 41.60807418823242 563 | ], 564 | [ 565 | -111.97560119628906, 566 | 41.60943603515625 567 | ], 568 | [ 569 | -111.97928619384766, 570 | 41.61034393310547 571 | ], 572 | [ 573 | -111.98542785644531, 574 | 41.609439849853516 575 | ], 576 | [ 577 | -111.98481750488281, 578 | 41.58356475830078 579 | ], 580 | [ 581 | -111.97868347167969, 582 | 41.58356857299805 583 | ], 584 | [ 585 | -111.97745513916016, 586 | 41.570404052734375 587 | ], 588 | [ 589 | -111.97132110595703, 590 | 41.57085418701172 591 | ], 592 | [ 593 | -111.97132110595703, 594 | 41.56450271606445 595 | ], 596 | [ 597 | -111.98297882080078, 598 | 41.564048767089844 599 | ], 600 | [ 601 | -111.98175811767578, 602 | 41.54090118408203 603 | ], 604 | [ 605 | -111.98176574707031, 606 | 41.53545379638672 607 | ], 608 | [ 609 | -112.00323486328125, 610 | 41.53545379638672 611 | ], 612 | [ 613 | -112.00384521484375, 614 | 41.552703857421875 615 | ] 616 | ] 617 | ] 618 | }, 619 | "type": "Feature", 620 | "id": "1", 621 | "properties": { 622 | "PERIMETER": 0.755827, 623 | "FEATURE2": null, 624 | "NAME": "Wellsville Mountain Wilderness", 625 | "FEATURE1": "Wilderness", 626 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Wellsville%20Mountain", 627 | "AGBUR": "FS", 628 | "AREA": 0.0104441, 629 | "STATE_FIPS": "49", 630 | "WILDRNP020": 336, 631 | "STATE": "UT" 632 | } 633 | } 634 | ] 635 | } 636 | -------------------------------------------------------------------------------- /tests/fixtures/collection.txt: -------------------------------------------------------------------------------- 1 | {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[-111.73527526855469, 41.995094299316406], [-111.65931701660156, 41.99627685546875], [-111.6587142944336, 41.9921875], [-111.65888977050781, 41.95676803588867], [-111.67082977294922, 41.91230010986328], [-111.67332458496094, 41.905494689941406], [-111.67088317871094, 41.90049362182617], [-111.66474914550781, 41.893211364746094], [-111.6506576538086, 41.875465393066406], [-111.64759826660156, 41.87091827392578], [-111.64640808105469, 41.86273956298828], [-111.64334869384766, 41.858192443847656], [-111.63720703125, 41.85499572753906], [-111.633544921875, 41.847267150878906], [-111.63053894042969, 41.83409118652344], [-111.6330337524414, 41.82728576660156], [-111.63983154296875, 41.8227653503418], [-111.6484603881836, 41.82188034057617], [-111.66077423095703, 41.82327651977539], [-111.6712417602539, 41.82330322265625], [-111.67618560791016, 41.82013702392578], [-111.68803405761719, 41.78792953491211], [-111.69361114501953, 41.77931594848633], [-111.70162200927734, 41.77797317504883], [-111.70901489257812, 41.77663040161133], [-111.71395111083984, 41.772098541259766], [-111.71891784667969, 41.763031005859375], [-111.72816467285156, 41.75851058959961], [-111.74726104736328, 41.75537109375], [-111.75650024414062, 41.752662658691406], [-111.77067565917969, 41.7445182800293], [-111.77064514160156, 41.75495910644531], [-111.75585174560547, 41.76219940185547], [-111.7330551147461, 41.766693115234375], [-111.72749328613281, 41.77212905883789], [-111.71883392333984, 41.7834587097168], [-111.71080780029297, 41.78889083862305], [-111.70340728759766, 41.79250717163086], [-111.70030212402344, 41.798404693603516], [-111.70210266113281, 41.8088493347168], [-111.70760345458984, 41.819759368896484], [-111.71312713623047, 41.82340621948242], [-111.71929168701172, 41.82341766357422], [-111.72545623779297, 41.8225212097168], [-111.7341537475586, 41.803016662597656], [-111.740966796875, 41.79213333129883], [-111.74531555175781, 41.78215408325195], [-111.77122497558594, 41.7658576965332], [-111.77056884765625, 41.77811813354492], [-111.7662582397461, 41.778106689453125], [-111.76746368408203, 41.78628158569336], [-111.76253509521484, 41.78627395629883], [-111.76241302490234, 41.82259750366211], [-111.77104187011719, 41.8221549987793], [-111.77161407470703, 41.83351135253906], [-111.7333755493164, 41.84524154663086], [-111.73274993896484, 41.847511291503906], [-111.7376708984375, 41.84979248046875], [-111.77157592773438, 41.845767974853516], [-111.77215576171875, 41.85802459716797], [-111.75243377685547, 41.85844802856445], [-111.72467803955078, 41.86384201049805], [-111.71109771728516, 41.868804931640625], [-111.70182037353516, 41.87604904174805], [-111.69624328613281, 41.88193893432617], [-111.69497680664062, 41.88874816894531], [-111.70053100585938, 41.89057540893555], [-111.70793151855469, 41.88923263549805], [-111.72091674804688, 41.87972640991211], [-111.73388671875, 41.87384796142578], [-111.75301361083984, 41.86888885498047], [-111.75350952148438, 41.90249252319336], [-111.74364471435547, 41.90247344970703], [-111.74463653564453, 41.967864990234375], [-111.7119369506836, 41.96416473388672], [-111.69283294677734, 41.95912551879883], [-111.68911743164062, 41.96047592163086], [-111.6891098022461, 41.96320343017578], [-111.69341278076172, 41.96684646606445], [-111.70449829101562, 41.972320556640625], [-111.7341079711914, 41.97828674316406], [-111.73527526855469, 41.995094299316406]]]}, "type": "Feature", "id": "0", "properties": {"PERIMETER": 1.22107, "FEATURE2": null, "NAME": "Mount Naomi Wilderness", "FEATURE1": "Wilderness", "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Naomi", "AGBUR": "FS", "AREA": 0.0179264, "STATE_FIPS": "49", "WILDRNP020": 332, "STATE": "UT"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-112.00384521484375, 41.552703857421875], [-112.00446319580078, 41.56586456298828], [-112.0112075805664, 41.56586456298828], [-112.01121520996094, 41.57902526855469], [-112.01734924316406, 41.57902526855469], [-112.0173568725586, 41.594459533691406], [-112.02779388427734, 41.5940055847168], [-112.02779388427734, 41.60171890258789], [-112.03945922851562, 41.60126495361328], [-112.04007720947266, 41.608524322509766], [-112.04744720458984, 41.608524322509766], [-112.0474624633789, 41.62804412841797], [-112.05974578857422, 41.62758255004883], [-112.05975341796875, 41.640296936035156], [-112.050537109375, 41.64030075073242], [-112.05054473876953, 41.64983367919922], [-112.04132843017578, 41.64983367919922], [-112.04195404052734, 41.66299819946289], [-112.05793762207031, 41.662540435791016], [-112.0579605102539, 41.692047119140625], [-112.07394409179688, 41.692039489746094], [-112.07459259033203, 41.72381591796875], [-112.06167602539062, 41.72382354736328], [-112.0616683959961, 41.71383285522461], [-112.05490112304688, 41.713836669921875], [-112.04137420654297, 41.71384048461914], [-112.04138946533203, 41.7379035949707], [-112.0376968383789, 41.74108123779297], [-112.03339385986328, 41.741085052490234], [-112.02908325195312, 41.729736328125], [-112.02599334716797, 41.71657180786133], [-112.0241470336914, 41.71157455444336], [-112.0272216796875, 41.704769134521484], [-112.02413940429688, 41.70068359375], [-112.01676177978516, 41.69977951049805], [-112.01615142822266, 41.7070426940918], [-112.00508117675781, 41.707496643066406], [-112.00508117675781, 41.66618347167969], [-111.9792709350586, 41.6666374206543], [-111.9786605834961, 41.653926849365234], [-111.96821594238281, 41.65346908569336], [-111.96760559082031, 41.6407585144043], [-111.96146392822266, 41.6407585144043], [-111.96025085449219, 41.61125183105469], [-111.95042419433594, 41.61124801635742], [-111.94796752929688, 41.60988235473633], [-111.94735717773438, 41.60761260986328], [-111.9522705078125, 41.60443878173828], [-111.96455383300781, 41.60262680053711], [-111.9682388305664, 41.60398864746094], [-111.9725341796875, 41.60807418823242], [-111.97560119628906, 41.60943603515625], [-111.97928619384766, 41.61034393310547], [-111.98542785644531, 41.609439849853516], [-111.98481750488281, 41.58356475830078], [-111.97868347167969, 41.58356857299805], [-111.97745513916016, 41.570404052734375], [-111.97132110595703, 41.57085418701172], [-111.97132110595703, 41.56450271606445], [-111.98297882080078, 41.564048767089844], [-111.98175811767578, 41.54090118408203], [-111.98176574707031, 41.53545379638672], [-112.00323486328125, 41.53545379638672], [-112.00384521484375, 41.552703857421875]]]}, "type": "Feature", "id": "1", "properties": {"PERIMETER": 0.755827, "FEATURE2": null, "NAME": "Wellsville Mountain Wilderness", "FEATURE1": "Wilderness", "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Wellsville%20Mountain", "AGBUR": "FS", "AREA": 0.0104441, "STATE_FIPS": "49", "WILDRNP020": 336, "STATE": "UT"}}]} -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.cpg: -------------------------------------------------------------------------------- 1 | ISO-8859-1 2 | -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/coutwildrnp.dbf -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/coutwildrnp.shp -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/coutwildrnp.shx -------------------------------------------------------------------------------- /tests/fixtures/coutwildrnp.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/coutwildrnp.zip -------------------------------------------------------------------------------- /tests/fixtures/curves_line.csv: -------------------------------------------------------------------------------- 1 | WKT,SHAPE_Length 2 | "MULTILINESTRING ((-1.02439 48.4878,2.471545 48.45528))",3.49608621305261 3 | "MULTICURVE (COMPOUNDCURVE ((-0.9105691 47.21951,1.414634 47.17073),CIRCULARSTRING (1.414634 47.17073,2.423818 47.48377,1.407531 46.72668),(1.407531 46.72668,-0.9243407 46.72668)))",8.39459167219456 4 | "MULTICURVE (COMPOUNDCURVE (CIRCULARSTRING (-0.3902439 46.42109,0.2422325 45.78862,-0.3902439 45.15614,-1.02272 45.78862,-0.3902439 46.42109)))",3.97396663612273 5 | "MULTILINESTRING ((2.404137 38.88428,2.475991 38.93491,2.54878 38.98351,2.622149 39.02986,2.69574 39.07372,2.769195 39.11488,2.842157 39.15314,2.914269 39.18832,2.98518 39.22023,3.054546 39.24874,3.122027 39.2737,3.187295 39.29498,3.250033 39.31248,3.309934 39.32613,3.366707 39.33584,3.420075 39.34158,3.469778 39.34331,3.515575 39.34104,3.557241 39.33476,3.594574 39.32451,3.627391 39.31034,3.655534 39.29232,3.678865 39.27053,3.697271 39.24509,3.710661 39.21612,3.71897 39.18375,3.722158 39.14814,3.72021 39.10948,3.713135 39.06794,3.700967 39.02373,3.683765 38.97707,3.661614 38.92818,3.634622 38.87729,3.602919 38.82467,3.566661 38.77056,3.526023 38.71523,3.481205 38.65895,3.432424 38.60199,3.379918 38.54462,3.323942 38.48714,3.26477 38.42982,3.20269 38.37293,3.138004 38.31676,3.071028 38.26158,3.002087 38.20766,2.931517 38.15525,2.859663 38.10463,2.786874 38.05602,2.713506 38.00968,2.639914 37.96582,2.566459 37.92466,2.493498 37.88639,2.421386 37.85122,2.350474 37.8193,2.281109 37.79079,2.213628 37.76584,2.148359 37.74456,2.085621 37.72705,2.02572 37.71341,1.968947 37.70369,1.915579 37.69795,1.865876 37.69622,1.82008 37.6985,1.778414 37.70477,1.741081 37.71502,1.708263 37.72919,1.68012 37.74721,1.656789 37.769,1.638384 37.79444,1.624994 37.82342,1.616684 37.85579,1.613496 37.89139,1.615444 37.93006,1.62252 37.97159,1.634688 38.0158,1.651889 38.06247,1.67404 38.11136,1.701033 38.16224,1.732735 38.21486,1.768994 38.26897,1.809631 38.3243,1.854449 38.38059,1.90323 38.43755,1.955737 38.49491,2.011712 38.55239,2.070884 38.60972,2.132964 38.6666,2.19765 38.72277,2.264627 38.77795,2.333568 38.83188,2.404137 38.88428))",5.67762431364471 6 | "MULTILINESTRING ((-0.6666667 44.03252,-0.6056813 44.10943,-0.5428571 44.18257,-0.4782797 44.25197,-0.4120346 44.31763,-0.3442073 44.37959,-0.2748833 44.43785,-0.2041482 44.49243,-0.1320875 44.54336,-0.0587867 44.59064,0.0156686 44.63431,0.091193 44.67437,0.167701 44.71084,0.2451069 44.74375,0.3233253 44.77311,0.4022706 44.79894,0.4818574 44.82125,0.5620001 44.84007,0.6426132 44.85542,0.7236111 44.8673,0.8049083 44.87574,0.8864194 44.88076,0.9680587 44.88238,1.049741 44.88061,1.13138 44.87547,1.212891 44.86698,1.294188 44.85516,1.375186 44.84003,1.455799 44.8216,1.535942 44.79989,1.615529 44.77492,1.694474 44.74671,1.772693 44.71528,1.850099 44.68064,1.926607 44.64281,2.002131 44.60182,2.076586 44.55767,2.149887 44.51039,2.221948 44.46,2.292683 44.4065))",3.34511332340398 7 | "MULTICURVE (COMPOUNDCURVE ((-1.300813 42.89431,0.3902439 43.31707),CIRCULARSTRING (0.3902439 43.31707,1.4163 43.74383,2.455285 43.34959),(2.455285 43.34959,2.455121 43.34941,2.454636 43.34885,2.453842 43.34794,2.452751 43.34666,2.451373 43.34503,2.44972 43.34305,2.447803 43.34073,2.445634 43.33807,2.443223 43.33507,2.440583 43.33175,2.437724 43.3281,2.434658 43.32413,2.431396 43.31985,2.42795 43.31526,2.42433 43.31037,2.420549 43.30517,2.416617 43.29968,2.412546 43.2939,2.408347 43.28784,2.404032 43.28149,2.399611 43.27487,2.395096 43.26799,2.390499 43.26083,2.385831 43.25342,2.381103 43.24575,2.376327 43.23783,2.371513 43.22966,2.366673 43.22126,2.361819 43.21262,2.356962 43.20374,2.352112 43.19465,2.347283 43.18533,2.342484 43.17579,2.337727 43.16605,2.333023 43.1561,2.328385 43.14594,2.323822 43.13559,2.319347 43.12505,2.314971 43.11433,2.310704 43.10342,2.30656 43.09233,2.302547 43.08108,2.29868 43.06965,2.294967 43.05807,2.291421 43.04633,2.288054 43.03443,2.284875 43.02239,2.281898 43.01021,2.279132 42.99789,2.27659 42.98543,2.274283 42.97285,2.272222 42.96015,2.270418 42.94733,2.268883 42.9344,2.267628 42.92136,2.266664 42.90821,2.266003 42.89497,2.265657 42.88164,2.265635 42.86821,2.265951 42.85471,2.266614 42.84112,2.267637 42.82747,2.26903 42.81374,2.270806 42.79995,2.272975 42.7861,2.275548 42.7722,2.278538 42.75825,2.281955 42.74426,2.28581 42.73022,2.290116 42.71616,2.294883 42.70206,2.300123 42.68794,2.305847 42.6738,2.312066 42.65965,2.318792 42.64548,2.326036 42.63132,2.333809 42.61715,2.342123 42.60299,2.350989 42.58883,2.360418 42.5747,2.370422 42.56058,2.381012 42.54649,2.392199 42.53243,2.403995 42.5184,2.416411 42.50442,2.429458 42.49047,2.443148 42.47658,2.457492 42.46274,2.472501 42.44896,2.488187 42.43525,2.504561 42.4216,2.521634 42.40803,2.539418 42.39454,2.557924 42.38113,2.577163 42.36781,2.597146 42.35459,2.617886 42.34146),(2.617886 42.34146,2.636783 42.32997,2.656209 42.31853,2.676146 42.30716,2.696577 42.29584,2.717483 42.28458,2.738844 42.27338,2.760644 42.26223,2.782863 42.25113,2.805484 42.24007,2.828486 42.22907,2.851854 42.21811,2.875567 42.2072,2.899607 42.19633,2.923957 42.18549,2.948598 42.1747,2.97351 42.16394,2.998677 42.15321,3.024079 42.14252,3.049698 42.13186,3.075516 42.12122,3.101515 42.11062,3.127675 42.10003,3.153979 42.08947,3.180407 42.07893,3.206943 42.06841,3.233567 42.0579,3.260261 42.04741,3.287006 42.03694,3.313785 42.02647,3.340578 42.01602,3.367367 42.00557,3.394135 41.99512,3.420862 41.98468,3.44753 41.97424,3.474121 41.96381,3.500616 41.95336,3.526997 41.94292,3.553246 41.93247,3.579344 41.92201,3.605273 41.91154,3.631014 41.90106,3.656549 41.89057,3.681859 41.88006,3.706927 41.86953,3.731733 41.85898,3.75626 41.84841,3.780489 41.83782,3.804401 41.82721,3.827979 41.81656,3.851203 41.80589,3.874056 41.79519,3.896518 41.78445,3.918573 41.77368,3.9402 41.76288,3.961382 41.75203,3.982101 41.74115,4.002337 41.73022,4.022073 41.71925,4.041291 41.70823,4.059971 41.69717,4.078095 41.68605,4.095646 41.67488,4.112604 41.66366,4.128951 41.65239,4.144669 41.64105,4.15974 41.62966,4.174144 41.6182,4.187864 41.60669,4.200882 41.5951,4.213178 41.58345,4.224734 41.57174,4.235533 41.55995,4.245555 41.54808,4.254783 41.53615,4.263197 41.52413,4.27078 41.51204,4.277512 41.49987,4.283376 41.48762,4.288354 41.47528,4.292426 41.46285,4.295575 41.45034,4.297782 41.43774,4.299028 41.42504,4.299296 41.41226,4.298567 41.39937,4.296822 41.38639,4.294043 41.37331,4.290211 41.36013,4.285309 41.34685,4.279318 41.33346,4.272219 41.31996,4.263995 41.30635,4.254626 41.29264,4.244094 41.27881,4.232381 41.26486,4.219468 41.2508,4.205338 41.23662,4.189971 41.22232,4.17335 41.2079,4.155455 41.19336,4.136269 41.17868,4.115773 41.16388,4.093948 41.14896,4.070777 41.13389,4.046241 41.1187,4.020321 41.10337,3.993 41.0879,3.964258 41.07229,3.934077 41.05654,3.902439 41.04065),CIRCULARSTRING (3.902439 41.04065,1.775383 40.65987,0.3414634 42.27642)))",12.2623236074563 8 | "MULTILINESTRING ((-0.2762998 38.32375,-0.2637102 38.43947,-0.2447018 38.55117,-0.2193601 38.65833,-0.1877989 38.76047,-0.1501601 38.85714,-0.1066131 38.94789,-0.0573536 39.03233,-0.002603 39.11007,0.0573925 39.18076,0.1223631 39.24409,0.1920168 39.29976,0.2660403 39.34754,0.3441008 39.3872))",1.29261161044762 9 | "MULTICURVE (COMPOUNDCURVE (CIRCULARSTRING (-1.389372 40.02584,-1.109435 40.65503,-0.4250745 40.73184),CIRCULARSTRING (-0.4250745 40.73184,-0.2233581 40.09231,0.4014657 40.33579)),COMPOUNDCURVE (CIRCULARSTRING (0.9008338 40.26691,1.138662 40.45594,1.434641 40.38745)))",3.57349361227513 10 | "MULTILINESTRING ((1.383736 39.35035,1.012627 38.5647,0.5434618 37.97689,-0.0220862 37.58902))",2.3133339931156 11 | -------------------------------------------------------------------------------- /tests/fixtures/example.topojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "Topology", 3 | "objects": { 4 | "example": { 5 | "type": "GeometryCollection", 6 | "geometries": [ 7 | { 8 | "type": "Point", 9 | "properties": { 10 | "prop0": "value0" 11 | }, 12 | "coordinates": [102, 0.5] 13 | }, 14 | { 15 | "type": "LineString", 16 | "properties": { 17 | "prop0": "value0", 18 | "prop1": 0 19 | }, 20 | "arcs": [0] 21 | }, 22 | { 23 | "type": "Polygon", 24 | "properties": { 25 | "prop0": "value0", 26 | "prop1": { 27 | "this": "that" 28 | } 29 | }, 30 | "arcs": [[-2]] 31 | } 32 | ] 33 | } 34 | }, 35 | "arcs": [ 36 | [[102, 0], [103, 1], [104, 0], [105, 1]], 37 | [[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]] 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /tests/fixtures/gre.cpg: -------------------------------------------------------------------------------- 1 | UTF-8 2 | -------------------------------------------------------------------------------- /tests/fixtures/gre.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/gre.dbf -------------------------------------------------------------------------------- /tests/fixtures/gre.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /tests/fixtures/gre.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/gre.shp -------------------------------------------------------------------------------- /tests/fixtures/gre.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/gre.shx -------------------------------------------------------------------------------- /tests/fixtures/grenada.geojson: -------------------------------------------------------------------------------- 1 | {"features":[{"geometry":{"coordinates":[[[[-61.173214300000005,12.516654800000001],[-61.3827217,12.5301363],[-61.665747100000004,12.5966532],[-61.6661847,12.596],[-61.66814250000001,12.593],[-61.6700247,12.59],[-61.6718337,12.587],[-61.673571700000004,12.584],[-61.6752407,12.581],[-61.6768427,12.578],[-61.678379400000004,12.575000000000001],[-61.6803295,12.571],[-61.6830501,12.565000000000001],[-61.68553430000001,12.559000000000001],[-61.687063699999996,12.555000000000001],[-61.6884946,12.551],[-61.6898391,12.546999999999999],[-61.69209600000001,12.540999999999999],[-61.69413360000001,12.535],[-61.69595870000001,12.529],[-61.697577200000005,12.523],[-61.69899410000001,12.517],[-61.700213700000006,12.511],[-61.7012395,12.505],[-61.7020744,12.499],[-61.702626200000005,12.494],[-61.7033841,12.493],[-61.706211800000005,12.491],[-61.7089415,12.489],[-61.7141311,12.485000000000001],[-61.718995500000005,12.481],[-61.72356890000001,12.477],[-61.727879200000004,12.473],[-61.7319495,12.469000000000001],[-61.73579920000001,12.465000000000002],[-61.74032590000001,12.46],[-61.74373590000001,12.456000000000001],[-61.746971,12.452000000000002],[-61.7500412,12.447999999999999],[-61.75295580000001,12.443999999999999],[-61.753784499999995,12.443],[-61.756858300000005,12.44],[-61.7598054,12.437],[-61.762633400000006,12.434],[-61.76534870000001,12.431],[-61.767957200000005,12.427999999999999],[-61.7704641,12.425],[-61.7728741,12.422],[-61.775191500000005,12.419],[-61.7774201,12.416],[-61.7802595,12.412],[-61.782954800000006,12.408],[-61.78551270000001,12.404],[-61.7873446,12.401],[-61.789675900000006,12.397],[-61.7918847,12.393],[-61.79397550000001,12.389000000000001],[-61.794998400000004,12.388],[-61.79830060000001,12.386000000000001],[-61.8030062,12.383000000000001],[-61.8059936,12.381],[-61.810272399999995,12.378],[-61.8130009,12.376000000000001],[-61.815637599999995,12.374],[-61.8181882,12.372000000000002],[-61.82186339999999,12.369000000000002],[-61.8265048,12.365000000000002],[-61.830876599999996,12.361],[-61.8329692,12.359000000000002],[-61.835999,12.356000000000002],[-61.8413082,12.351],[-61.845319800000006,12.347],[-61.8464439,12.346],[-61.8501187,12.343],[-61.853625699999995,12.34],[-61.85697739999999,12.337],[-61.86122339999999,12.333],[-61.864252900000004,12.33],[-61.8671584,12.327],[-61.8699469,12.324],[-61.872645999999996,12.321],[-61.8754727,12.318],[-61.87906749999999,12.314],[-61.8833,12.309000000000001],[-61.88726319999999,12.304],[-61.88952,12.301],[-61.891690399999995,12.297999999999998],[-61.8937778,12.295],[-61.895785200000006,12.292],[-61.89771530000001,12.289],[-61.899570800000006,12.286],[-61.90251490000001,12.280999999999999],[-61.904753,12.277],[-61.9068719,12.273],[-61.908875900000005,12.269],[-61.911674299999994,12.263],[-61.9134062,12.259],[-61.9150578,12.255],[-61.9179797,12.248999999999999],[-61.920656900000004,12.242999999999999],[-61.92290190000001,12.238999999999999],[-61.925082,12.235],[-61.92666,12.232],[-61.9286637,12.227999999999998],[-61.930556100000004,12.223999999999998],[-61.9332651,12.217999999999998],[-61.936145100000005,12.212],[-61.938782200000006,12.206],[-61.943587599999994,12.193999999999999],[-61.94511500000001,12.19],[-61.9465439,12.186],[-61.9485074,12.18],[-61.95028749999999,12.174],[-61.95186999999999,12.168],[-61.9532519,12.162],[-61.95443739999999,12.156],[-61.954975999999995,12.154],[-61.9570107,12.147999999999998],[-61.9594482,12.139999999999999],[-61.961132600000006,12.133999999999999],[-61.962614,12.127999999999998],[-61.96295200000001,12.126999999999999],[-61.9668105,12.122],[-61.9704259,12.116999999999999],[-61.9738135,12.112],[-61.9769866,12.107],[-61.9799566,12.102],[-61.9827336,12.097],[-61.9853262,12.092],[-61.9882048,12.086],[-61.990875800000005,12.08],[-61.99252880000001,12.076],[-61.994819,12.07],[-61.996888999999996,12.064],[-61.99874590000001,12.058],[-62.000395600000004,12.052000000000001],[-62.0018433,12.046],[-62.0030933,12.04],[-62.003818700000004,12.036],[-62.0047472,12.03],[-62.0052609,12.026],[-62.005875200000006,12.02],[-62.0061812,12.016],[-62.0064861,12.01],[-62.0065868,12.006],[-62.006584499999995,12],[-62.006398100000006,11.994],[-62.0061714,11.99],[-62.0056768,11.984],[-62.0052436,11.98],[-62.004436999999996,11.974],[-62.003794,11.97],[-62.0026693,11.964],[-62.001811399999994,11.96],[-62.0003595,11.954],[-61.999279800000004,11.950000000000001],[-61.9974886,11.943999999999999],[-61.9961776,11.94],[-61.9940313,11.934],[-61.9924772,11.93],[-61.9908218,11.926],[-61.989062399999995,11.922],[-61.9871961,11.918],[-61.984707699999994,11.913],[-61.9825882,11.909],[-61.9803498,11.905000000000001],[-61.9773776,11.9],[-61.9748543,11.896],[-61.972195400000004,11.892000000000001],[-61.9693945,11.888],[-61.9664442,11.884],[-61.9641286,11.881],[-61.9617206,11.878],[-61.959215900000004,11.875000000000002],[-61.9557177,11.871],[-61.9520267,11.867],[-61.9496952,11.864],[-61.94728729999999,11.861],[-61.9430571,11.856000000000002],[-61.93853550000001,11.851],[-61.934690599999996,11.847],[-61.9306255,11.843],[-61.9274208,11.84],[-61.922921800000005,11.836],[-61.9193636,11.833],[-61.9156332,11.83],[-61.911715,11.827],[-61.9075906,11.824],[-61.903238,11.821],[-61.89863020000001,11.818],[-61.8937341,11.815000000000001],[-61.888507499999996,11.812000000000001],[-61.88481339999999,11.81],[-61.8789067,11.807],[-61.87468659999999,11.805000000000001],[-61.870200499999996,11.803],[-61.86540230000001,11.801],[-61.8602301,11.799],[-61.854597299999995,11.796999999999999],[-61.848375600000004,11.795],[-61.84498479999999,11.793999999999999],[-61.8413608,11.793],[-61.8374527,11.792],[-61.8331873,11.790999999999999],[-61.828452500000004,11.79],[-61.8230605,11.789],[-61.81664609999999,11.787999999999998],[-61.808274399999995,11.786999999999999],[-61.790283900000006,11.786],[-61.7840631,11.786],[-61.76607270000001,11.786999999999999],[-61.7573236,11.787999999999998],[-61.73933300000001,11.789],[-61.730961300000004,11.79],[-61.72079310000001,11.790999999999999],[-61.70280230000001,11.792],[-61.6944305,11.793],[-61.688016000000005,11.793999999999999],[-61.6826238,11.795],[-61.6732043,11.796999999999999],[-61.667812100000006,11.797999999999998],[-61.663077200000004,11.799],[-61.6588117,11.8],[-61.654903499999996,11.801],[-61.6512793,11.802000000000001],[-61.64788839999999,11.803],[-61.644693499999995,11.804],[-61.63878580000001,11.806000000000001],[-61.636033600000005,11.807],[-61.6308613,11.809000000000001],[-61.62841970000001,11.81],[-61.623784,11.812000000000001],[-61.621576700000006,11.813],[-61.6173564,11.815000000000001],[-61.6133668,11.817],[-61.60957990000001,11.819],[-61.6042318,11.822000000000001],[-61.6008621,11.824],[-61.5976324,11.826],[-61.5930244,11.829],[-61.590096,11.831],[-61.5872727,11.833],[-61.585739600000004,11.834],[-61.5816382,11.836],[-61.5758831,11.839],[-61.5705345,11.842],[-61.565532900000015,11.845],[-61.56375870000001,11.846],[-61.55785109999999,11.849],[-61.552374300000004,11.852000000000002],[-61.5472238,11.855000000000002],[-61.543925300000005,11.857000000000001],[-61.5407605,11.859000000000002],[-61.5362404,11.862000000000002],[-61.533365200000006,11.864],[-61.530591300000005,11.866000000000001],[-61.52791200000001,11.868],[-61.5240577,11.871],[-61.5215904,11.873000000000001],[-61.5180317,11.876000000000001],[-61.515748300000006,11.878],[-61.5124482,11.881],[-61.5103269,11.883000000000001],[-61.5072563,11.886000000000001],[-61.49835930000001,11.895000000000001],[-61.494617399999996,11.899000000000001],[-61.4902146,11.904],[-61.48533390000001,11.909],[-61.4816423,11.913],[-61.47729749999999,11.918],[-61.4732301,11.923],[-61.4694197,11.927999999999999],[-61.464353900000006,11.935],[-61.4615887,11.939],[-61.458328800000004,11.943999999999999],[-61.4552762,11.949],[-61.452420399999994,11.954],[-61.450271099999995,11.958],[-61.4482377,11.962000000000002],[-61.4454269,11.967],[-61.4438039,11.97],[-61.4412339,11.975000000000001],[-61.4388714,11.979000000000001],[-61.436091399999995,11.984],[-61.43451230000001,11.987],[-61.4329978,11.99],[-61.4310762,11.994],[-61.428396400000004,12],[-61.42595080000001,12.006],[-61.423730500000005,12.012],[-61.42313910000001,12.013],[-61.4211047,12.016],[-61.41851320000001,12.02],[-61.4166569,12.023],[-61.41487299999999,12.026],[-61.4131591,12.029],[-61.4109797,12.033],[-61.409422,12.036],[-61.40744449999999,12.04],[-61.405577300000004,12.043999999999999],[-61.4038171,12.047999999999998],[-61.402161,12.052000000000001],[-61.399865999999996,12.058],[-61.39845880000001,12.062000000000001],[-61.3971473,12.066],[-61.3959295,12.07],[-61.394275,12.076],[-61.393596300000006,12.078],[-61.3910564,12.081],[-61.38782199999999,12.085],[-61.3855047,12.088],[-61.382552100000005,12.092],[-61.3804362,12.095],[-61.37774039999999,12.099],[-61.3758089,12.102],[-61.3733493,12.106],[-61.37158839999999,12.109],[-61.369348200000005,12.113],[-61.367746499999996,12.116],[-61.36571180000001,12.12],[-61.3637893,12.123999999999999],[-61.3619754,12.127999999999998],[-61.360267099999994,12.132],[-61.35866139999999,12.136],[-61.35643999999999,12.142],[-61.35508039999999,12.145999999999999],[-61.3538123,12.15],[-61.3520543,12.156],[-61.3509963,12.16],[-61.35002769999999,12.164],[-61.3487397,12.17],[-61.34798939999999,12.174],[-61.34732449999999,12.177999999999999],[-61.3464859,12.184],[-61.346031399999994,12.187999999999999],[-61.345660099999996,12.192],[-61.3452579,12.197999999999999],[-61.3450925,12.202],[-61.3450091,12.206],[-61.345007599999995,12.209999999999999],[-61.345087899999996,12.213999999999999],[-61.3452502,12.217999999999998],[-61.345494599999995,12.222],[-61.34582149999999,12.225999999999999],[-61.3462313,12.229999999999999],[-61.347002499999995,12.235999999999999],[-61.34762189999999,12.239999999999998],[-61.3483264,12.243999999999998],[-61.3495448,12.25],[-61.345779300000004,12.253],[-61.3421596,12.256],[-61.339838,12.258],[-61.3364839,12.261],[-61.333273999999996,12.264],[-61.330199,12.267],[-61.3272505,12.27],[-61.324421099999995,12.273],[-61.3217043,12.276],[-61.31824699999999,12.28],[-61.3157713,12.283],[-61.3126179,12.286999999999999],[-61.30962449999999,12.290999999999999],[-61.3067826,12.295],[-61.30408469999999,12.299],[-61.301524099999995,12.303],[-61.300435,12.304],[-61.297963700000004,12.306000000000001],[-61.29439910000001,12.309000000000001],[-61.29211200000002,12.311],[-61.2888064,12.314],[-61.286681699999995,12.316],[-61.283606,12.319],[-61.280656900000004,12.322000000000001],[-61.277826999999995,12.325000000000001],[-61.27510960000001,12.328],[-61.272499,12.331],[-61.26999000000001,12.334],[-61.267577800000005,12.337],[-61.26525820000001,12.34],[-61.262302800000015,12.344],[-61.260184900000006,12.347],[-61.25748639999999,12.351],[-61.256502700000006,12.352000000000002],[-61.25251010000001,12.355000000000002],[-61.248711400000005,12.358],[-61.245090100000006,12.361],[-61.2416324,12.364],[-61.23832620000001,12.367],[-61.235161000000005,12.370000000000001],[-61.23212780000001,12.373000000000001],[-61.22827520000001,12.377],[-61.22552040000001,12.38],[-61.22287430000001,12.383000000000001],[-61.220331400000006,12.386000000000001],[-61.2170932,12.39],[-61.2147732,12.393],[-61.2118172,12.397],[-61.209698800000005,12.4],[-61.206999800000006,12.404],[-61.205066,12.407],[-61.20258810000001,12.411],[-61.2008015,12.414],[-61.199085100000005,12.417],[-61.19743690000001,12.42],[-61.19585520000001,12.423],[-61.19433810000001,12.426],[-61.19241330000001,12.43],[-61.1897291,12.436],[-61.1872793,12.442],[-61.18505530000001,12.447999999999999],[-61.1836941,12.452000000000002],[-61.1824277,12.456000000000001],[-61.18125439999999,12.46],[-61.180172500000005,12.464],[-61.1791805,12.468],[-61.178277,12.472000000000001],[-61.1770853,12.478],[-61.17603230000001,12.484],[-61.175387900000004,12.488],[-61.1745797,12.494],[-61.1741456,12.498],[-61.1737945,12.502],[-61.173526,12.506],[-61.17333980000001,12.51],[-61.17323580000001,12.514],[-61.173214300000005,12.516654800000001]]]],"type":"MultiPolygon"},"id":550727,"osm_type":"relation","type":"Feature","name":"Grenada","properties":{"flag":"http://upload.wikimedia.org/wikipedia/commons/b/bc/Flag_of_Grenada.svg","name":"Grenada","name:cs":"Grenada","name:de":"Grenada","name:en":"Grenada","name:eo":"Grenado","name:fr":"Grenade","name:fy":"Grenada","name:hr":"Grenada","name:nl":"Grenada","name:ru":"Гренада","name:sl":"Grenada","name:ta":"கிரெனடா","name:uk":"Гренада","boundary":"administrative","name:tzl":"Grenada","timezone":"America/Grenada","wikidata":"Q769","ISO3166-1":"GD","wikipedia":"en:Grenada","admin_level":"2","is_in:continent":"North America","ISO3166-1:alpha2":"GD","ISO3166-1:alpha3":"GRD","ISO3166-1:numeric":"308"}}],"type":"FeatureCollection","geocoding":{"creation_date":"2016-10-12","generator":{"author":{"name":"Mapzen"},"package":"fences-builder","version":"0.1.2"},"license":"ODbL (see http://www.openstreetmap.org/copyright)"}} 2 | -------------------------------------------------------------------------------- /tests/fixtures/issue627.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "features": [{ 3 | "geometry": { 4 | "coordinates": [ 5 | [ 6 | [ 7 | -111.73527526855469, 8 | 41.995094299316406 9 | ], 10 | [ 11 | -111.65931701660156, 12 | 41.99627685546875 13 | ], 14 | [ 15 | -111.6587142944336, 16 | 41.9921875 17 | ], 18 | [ 19 | -111.65888977050781, 20 | 41.95676803588867 21 | ], 22 | [ 23 | -111.67082977294922, 24 | 41.91230010986328 25 | ], 26 | [ 27 | -111.67332458496094, 28 | 41.905494689941406 29 | ], 30 | [ 31 | -111.67088317871094, 32 | 41.90049362182617 33 | ], 34 | [ 35 | -111.66474914550781, 36 | 41.893211364746094 37 | ], 38 | [ 39 | -111.6506576538086, 40 | 41.875465393066406 41 | ], 42 | [ 43 | -111.64759826660156, 44 | 41.87091827392578 45 | ], 46 | [ 47 | -111.64640808105469, 48 | 41.86273956298828 49 | ], 50 | [ 51 | -111.64334869384766, 52 | 41.858192443847656 53 | ], 54 | [ 55 | -111.63720703125, 56 | 41.85499572753906 57 | ], 58 | [ 59 | -111.633544921875, 60 | 41.847267150878906 61 | ], 62 | [ 63 | -111.63053894042969, 64 | 41.83409118652344 65 | ], 66 | [ 67 | -111.6330337524414, 68 | 41.82728576660156 69 | ], 70 | [ 71 | -111.63983154296875, 72 | 41.8227653503418 73 | ], 74 | [ 75 | -111.6484603881836, 76 | 41.82188034057617 77 | ], 78 | [ 79 | -111.66077423095703, 80 | 41.82327651977539 81 | ], 82 | [ 83 | -111.6712417602539, 84 | 41.82330322265625 85 | ], 86 | [ 87 | -111.67618560791016, 88 | 41.82013702392578 89 | ], 90 | [ 91 | -111.68803405761719, 92 | 41.78792953491211 93 | ], 94 | [ 95 | -111.69361114501953, 96 | 41.77931594848633 97 | ], 98 | [ 99 | -111.70162200927734, 100 | 41.77797317504883 101 | ], 102 | [ 103 | -111.70901489257812, 104 | 41.77663040161133 105 | ], 106 | [ 107 | -111.71395111083984, 108 | 41.772098541259766 109 | ], 110 | [ 111 | -111.71891784667969, 112 | 41.763031005859375 113 | ], 114 | [ 115 | -111.72816467285156, 116 | 41.75851058959961 117 | ], 118 | [ 119 | -111.74726104736328, 120 | 41.75537109375 121 | ], 122 | [ 123 | -111.75650024414062, 124 | 41.752662658691406 125 | ], 126 | [ 127 | -111.77067565917969, 128 | 41.7445182800293 129 | ], 130 | [ 131 | -111.77064514160156, 132 | 41.75495910644531 133 | ], 134 | [ 135 | -111.75585174560547, 136 | 41.76219940185547 137 | ], 138 | [ 139 | -111.7330551147461, 140 | 41.766693115234375 141 | ], 142 | [ 143 | -111.72749328613281, 144 | 41.77212905883789 145 | ], 146 | [ 147 | -111.71883392333984, 148 | 41.7834587097168 149 | ], 150 | [ 151 | -111.71080780029297, 152 | 41.78889083862305 153 | ], 154 | [ 155 | -111.70340728759766, 156 | 41.79250717163086 157 | ], 158 | [ 159 | -111.70030212402344, 160 | 41.798404693603516 161 | ], 162 | [ 163 | -111.70210266113281, 164 | 41.8088493347168 165 | ], 166 | [ 167 | -111.70760345458984, 168 | 41.819759368896484 169 | ], 170 | [ 171 | -111.71312713623047, 172 | 41.82340621948242 173 | ], 174 | [ 175 | -111.71929168701172, 176 | 41.82341766357422 177 | ], 178 | [ 179 | -111.72545623779297, 180 | 41.8225212097168 181 | ], 182 | [ 183 | -111.7341537475586, 184 | 41.803016662597656 185 | ], 186 | [ 187 | -111.740966796875, 188 | 41.79213333129883 189 | ], 190 | [ 191 | -111.74531555175781, 192 | 41.78215408325195 193 | ], 194 | [ 195 | -111.77122497558594, 196 | 41.7658576965332 197 | ], 198 | [ 199 | -111.77056884765625, 200 | 41.77811813354492 201 | ], 202 | [ 203 | -111.7662582397461, 204 | 41.778106689453125 205 | ], 206 | [ 207 | -111.76746368408203, 208 | 41.78628158569336 209 | ], 210 | [ 211 | -111.76253509521484, 212 | 41.78627395629883 213 | ], 214 | [ 215 | -111.76241302490234, 216 | 41.82259750366211 217 | ], 218 | [ 219 | -111.77104187011719, 220 | 41.8221549987793 221 | ], 222 | [ 223 | -111.77161407470703, 224 | 41.83351135253906 225 | ], 226 | [ 227 | -111.7333755493164, 228 | 41.84524154663086 229 | ], 230 | [ 231 | -111.73274993896484, 232 | 41.847511291503906 233 | ], 234 | [ 235 | -111.7376708984375, 236 | 41.84979248046875 237 | ], 238 | [ 239 | -111.77157592773438, 240 | 41.845767974853516 241 | ], 242 | [ 243 | -111.77215576171875, 244 | 41.85802459716797 245 | ], 246 | [ 247 | -111.75243377685547, 248 | 41.85844802856445 249 | ], 250 | [ 251 | -111.72467803955078, 252 | 41.86384201049805 253 | ], 254 | [ 255 | -111.71109771728516, 256 | 41.868804931640625 257 | ], 258 | [ 259 | -111.70182037353516, 260 | 41.87604904174805 261 | ], 262 | [ 263 | -111.69624328613281, 264 | 41.88193893432617 265 | ], 266 | [ 267 | -111.69497680664062, 268 | 41.88874816894531 269 | ], 270 | [ 271 | -111.70053100585938, 272 | 41.89057540893555 273 | ], 274 | [ 275 | -111.70793151855469, 276 | 41.88923263549805 277 | ], 278 | [ 279 | -111.72091674804688, 280 | 41.87972640991211 281 | ], 282 | [ 283 | -111.73388671875, 284 | 41.87384796142578 285 | ], 286 | [ 287 | -111.75301361083984, 288 | 41.86888885498047 289 | ], 290 | [ 291 | -111.75350952148438, 292 | 41.90249252319336 293 | ], 294 | [ 295 | -111.74364471435547, 296 | 41.90247344970703 297 | ], 298 | [ 299 | -111.74463653564453, 300 | 41.967864990234375 301 | ], 302 | [ 303 | -111.7119369506836, 304 | 41.96416473388672 305 | ], 306 | [ 307 | -111.69283294677734, 308 | 41.95912551879883 309 | ], 310 | [ 311 | -111.68911743164062, 312 | 41.96047592163086 313 | ], 314 | [ 315 | -111.6891098022461, 316 | 41.96320343017578 317 | ], 318 | [ 319 | -111.69341278076172, 320 | 41.96684646606445 321 | ], 322 | [ 323 | -111.70449829101562, 324 | 41.972320556640625 325 | ], 326 | [ 327 | -111.7341079711914, 328 | 41.97828674316406 329 | ], 330 | [ 331 | -111.73527526855469, 332 | 41.995094299316406 333 | ] 334 | ] 335 | ], 336 | "type": "Polygon" 337 | }, 338 | "id": "0", 339 | "properties": { 340 | "skip_me": [1, 2, 3, 4], 341 | "AGBUR": "FS", 342 | "AREA": 0.0179264, 343 | "FEATURE1": "Wilderness", 344 | "FEATURE2": null, 345 | "NAME": "Mount Naomi Wilderness", 346 | "PERIMETER": 1.22107, 347 | "STATE": "UT", 348 | "STATE_FIPS": "49", 349 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Naomi", 350 | "WILDRNP020": 332 351 | }, 352 | "type": "Feature" 353 | },{ 354 | "geometry": { 355 | "coordinates": [ 356 | [ 357 | [ 358 | -112.00384521484375, 359 | 41.552703857421875 360 | ], 361 | [ 362 | -112.00446319580078, 363 | 41.56586456298828 364 | ], 365 | [ 366 | -112.0112075805664, 367 | 41.56586456298828 368 | ], 369 | [ 370 | -112.01121520996094, 371 | 41.57902526855469 372 | ], 373 | [ 374 | -112.01734924316406, 375 | 41.57902526855469 376 | ], 377 | [ 378 | -112.0173568725586, 379 | 41.594459533691406 380 | ], 381 | [ 382 | -112.02779388427734, 383 | 41.5940055847168 384 | ], 385 | [ 386 | -112.02779388427734, 387 | 41.60171890258789 388 | ], 389 | [ 390 | -112.03945922851562, 391 | 41.60126495361328 392 | ], 393 | [ 394 | -112.04007720947266, 395 | 41.608524322509766 396 | ], 397 | [ 398 | -112.04744720458984, 399 | 41.608524322509766 400 | ], 401 | [ 402 | -112.0474624633789, 403 | 41.62804412841797 404 | ], 405 | [ 406 | -112.05974578857422, 407 | 41.62758255004883 408 | ], 409 | [ 410 | -112.05975341796875, 411 | 41.640296936035156 412 | ], 413 | [ 414 | -112.050537109375, 415 | 41.64030075073242 416 | ], 417 | [ 418 | -112.05054473876953, 419 | 41.64983367919922 420 | ], 421 | [ 422 | -112.04132843017578, 423 | 41.64983367919922 424 | ], 425 | [ 426 | -112.04195404052734, 427 | 41.66299819946289 428 | ], 429 | [ 430 | -112.05793762207031, 431 | 41.662540435791016 432 | ], 433 | [ 434 | -112.0579605102539, 435 | 41.692047119140625 436 | ], 437 | [ 438 | -112.07394409179688, 439 | 41.692039489746094 440 | ], 441 | [ 442 | -112.07459259033203, 443 | 41.72381591796875 444 | ], 445 | [ 446 | -112.06167602539062, 447 | 41.72382354736328 448 | ], 449 | [ 450 | -112.0616683959961, 451 | 41.71383285522461 452 | ], 453 | [ 454 | -112.05490112304688, 455 | 41.713836669921875 456 | ], 457 | [ 458 | -112.04137420654297, 459 | 41.71384048461914 460 | ], 461 | [ 462 | -112.04138946533203, 463 | 41.7379035949707 464 | ], 465 | [ 466 | -112.0376968383789, 467 | 41.74108123779297 468 | ], 469 | [ 470 | -112.03339385986328, 471 | 41.741085052490234 472 | ], 473 | [ 474 | -112.02908325195312, 475 | 41.729736328125 476 | ], 477 | [ 478 | -112.02599334716797, 479 | 41.71657180786133 480 | ], 481 | [ 482 | -112.0241470336914, 483 | 41.71157455444336 484 | ], 485 | [ 486 | -112.0272216796875, 487 | 41.704769134521484 488 | ], 489 | [ 490 | -112.02413940429688, 491 | 41.70068359375 492 | ], 493 | [ 494 | -112.01676177978516, 495 | 41.69977951049805 496 | ], 497 | [ 498 | -112.01615142822266, 499 | 41.7070426940918 500 | ], 501 | [ 502 | -112.00508117675781, 503 | 41.707496643066406 504 | ], 505 | [ 506 | -112.00508117675781, 507 | 41.66618347167969 508 | ], 509 | [ 510 | -111.9792709350586, 511 | 41.6666374206543 512 | ], 513 | [ 514 | -111.9786605834961, 515 | 41.653926849365234 516 | ], 517 | [ 518 | -111.96821594238281, 519 | 41.65346908569336 520 | ], 521 | [ 522 | -111.96760559082031, 523 | 41.6407585144043 524 | ], 525 | [ 526 | -111.96146392822266, 527 | 41.6407585144043 528 | ], 529 | [ 530 | -111.96025085449219, 531 | 41.61125183105469 532 | ], 533 | [ 534 | -111.95042419433594, 535 | 41.61124801635742 536 | ], 537 | [ 538 | -111.94796752929688, 539 | 41.60988235473633 540 | ], 541 | [ 542 | -111.94735717773438, 543 | 41.60761260986328 544 | ], 545 | [ 546 | -111.9522705078125, 547 | 41.60443878173828 548 | ], 549 | [ 550 | -111.96455383300781, 551 | 41.60262680053711 552 | ], 553 | [ 554 | -111.9682388305664, 555 | 41.60398864746094 556 | ], 557 | [ 558 | -111.9725341796875, 559 | 41.60807418823242 560 | ], 561 | [ 562 | -111.97560119628906, 563 | 41.60943603515625 564 | ], 565 | [ 566 | -111.97928619384766, 567 | 41.61034393310547 568 | ], 569 | [ 570 | -111.98542785644531, 571 | 41.609439849853516 572 | ], 573 | [ 574 | -111.98481750488281, 575 | 41.58356475830078 576 | ], 577 | [ 578 | -111.97868347167969, 579 | 41.58356857299805 580 | ], 581 | [ 582 | -111.97745513916016, 583 | 41.570404052734375 584 | ], 585 | [ 586 | -111.97132110595703, 587 | 41.57085418701172 588 | ], 589 | [ 590 | -111.97132110595703, 591 | 41.56450271606445 592 | ], 593 | [ 594 | -111.98297882080078, 595 | 41.564048767089844 596 | ], 597 | [ 598 | -111.98175811767578, 599 | 41.54090118408203 600 | ], 601 | [ 602 | -111.98176574707031, 603 | 41.53545379638672 604 | ], 605 | [ 606 | -112.00323486328125, 607 | 41.53545379638672 608 | ], 609 | [ 610 | -112.00384521484375, 611 | 41.552703857421875 612 | ] 613 | ] 614 | ], 615 | "type": "Polygon" 616 | }, 617 | "id": "1", 618 | "properties": { 619 | "skip_me": [1, 2, 3, 4], 620 | "AGBUR": "FS", 621 | "AREA": 0.0104441, 622 | "FEATURE1": "Wilderness", 623 | "FEATURE2": null, 624 | "NAME": "Wellsville Mountain Wilderness", 625 | "PERIMETER": 0.755827, 626 | "STATE": "UT", 627 | "STATE_FIPS": "49", 628 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Wellsville%20Mountain", 629 | "WILDRNP020": 336 630 | }, 631 | "type": "Feature" 632 | },{ 633 | "geometry": { 634 | "coordinates": [ 635 | [ 636 | [ 637 | -106.79289245605469, 638 | 40.98352813720703 639 | ], 640 | [ 641 | -106.78697204589844, 642 | 40.979736328125 643 | ], 644 | [ 645 | -106.77783966064453, 646 | 40.98030471801758 647 | ], 648 | [ 649 | -106.76583862304688, 650 | 40.976890563964844 651 | ], 652 | [ 653 | -106.74164581298828, 654 | 40.98578643798828 655 | ], 656 | [ 657 | -106.73485565185547, 658 | 40.98528289794922 659 | ], 660 | [ 661 | -106.72955322265625, 662 | 40.981449127197266 663 | ], 664 | [ 665 | -106.70484924316406, 666 | 40.97372817993164 667 | ], 668 | [ 669 | -106.69345092773438, 670 | 40.964256286621094 671 | ], 672 | [ 673 | -106.68531799316406, 674 | 40.95088577270508 675 | ], 676 | [ 677 | -106.6842269897461, 678 | 40.9403190612793 679 | ], 680 | [ 681 | -106.67102813720703, 682 | 40.9429817199707 683 | ], 684 | [ 685 | -106.65811157226562, 686 | 40.9423828125 687 | ], 688 | [ 689 | -106.62374114990234, 690 | 40.93569564819336 691 | ], 692 | [ 693 | -106.62068939208984, 694 | 40.92386245727539 695 | ], 696 | [ 697 | -106.62251281738281, 698 | 40.91773986816406 699 | ], 700 | [ 701 | -106.62690734863281, 702 | 40.91284942626953 703 | ], 704 | [ 705 | -106.63843536376953, 706 | 40.909149169921875 707 | ], 708 | [ 709 | -106.63716888427734, 710 | 40.90835189819336 711 | ], 712 | [ 713 | -106.63470458984375, 714 | 40.90473937988281 715 | ], 716 | [ 717 | -106.63285064697266, 718 | 40.90202713012695 719 | ], 720 | [ 721 | -106.62979125976562, 722 | 40.89977264404297 723 | ], 724 | [ 725 | -106.62614440917969, 726 | 40.8997917175293 727 | ], 728 | [ 729 | -106.62005615234375, 730 | 40.8989143371582 731 | ], 732 | [ 733 | -106.61578369140625, 734 | 40.897117614746094 735 | ], 736 | [ 737 | -106.60540771484375, 738 | 40.891727447509766 739 | ], 740 | [ 741 | -106.59563446044922, 742 | 40.886329650878906 743 | ], 744 | [ 745 | -106.59073638916016, 746 | 40.882266998291016 747 | ], 748 | [ 749 | -106.5852279663086, 750 | 40.87685012817383 751 | ], 752 | [ 753 | -106.5809097290039, 754 | 40.86960983276367 755 | ], 756 | [ 757 | -106.57662963867188, 758 | 40.86600112915039 759 | ], 760 | [ 761 | -106.57352447509766, 762 | 40.85739517211914 763 | ], 764 | [ 765 | -106.5728759765625, 766 | 40.85240936279297 767 | ], 768 | [ 769 | -106.57404327392578, 770 | 40.84695816040039 771 | ], 772 | [ 773 | -106.57461547851562, 774 | 40.842872619628906 775 | ], 776 | [ 777 | -106.5751953125, 778 | 40.83924102783203 779 | ], 780 | [ 781 | -106.57881927490234, 782 | 40.83650588989258 783 | ], 784 | [ 785 | -106.58184051513672, 786 | 40.83467483520508 787 | ], 788 | [ 789 | -106.58241271972656, 790 | 40.83013916015625 791 | ], 792 | [ 793 | -106.58171844482422, 794 | 40.820159912109375 795 | ], 796 | [ 797 | -106.5792236328125, 798 | 40.812007904052734 799 | ], 800 | [ 801 | -106.57978820800781, 802 | 40.80610656738281 803 | ], 804 | [ 805 | -106.58213806152344, 806 | 40.79656982421875 807 | ], 808 | [ 809 | -106.58269500732422, 810 | 40.79066848754883 811 | ], 812 | [ 813 | -106.57960510253906, 814 | 40.783878326416016 815 | ], 816 | [ 817 | -106.57835388183594, 818 | 40.77935028076172 819 | ], 820 | [ 821 | -106.58013916015625, 822 | 40.7752571105957 823 | ], 824 | [ 825 | -106.58430480957031, 826 | 40.7652587890625 827 | ], 828 | [ 829 | -106.58670043945312, 830 | 40.76071548461914 831 | ], 832 | [ 833 | -106.58545684814453, 834 | 40.7570915222168 835 | ], 836 | [ 837 | -106.5848159790039, 838 | 40.75346374511719 839 | ], 840 | [ 841 | -106.58174896240234, 842 | 40.74894332885742 843 | ], 844 | [ 845 | -106.58234405517578, 846 | 40.74803161621094 847 | ], 848 | [ 849 | -106.58658599853516, 850 | 40.74755859375 851 | ], 852 | [ 853 | -106.59872436523438, 854 | 40.747955322265625 855 | ], 856 | [ 857 | -106.60479736328125, 858 | 40.748382568359375 859 | ], 860 | [ 861 | -106.60721588134766, 862 | 40.74746322631836 863 | ], 864 | [ 865 | -106.60900115966797, 866 | 40.74382400512695 867 | ], 868 | [ 869 | -106.60894775390625, 870 | 40.73747634887695 871 | ], 872 | [ 873 | -106.6070785522461, 874 | 40.73158645629883 875 | ], 876 | [ 877 | -106.60218811035156, 878 | 40.727073669433594 879 | ], 880 | [ 881 | -106.5967025756836, 882 | 40.72392654418945 883 | ], 884 | [ 885 | -106.59486389160156, 886 | 40.72166442871094 887 | ], 888 | [ 889 | -106.5942153930664, 890 | 40.716678619384766 891 | ], 892 | [ 893 | -106.5947494506836, 894 | 40.70760726928711 895 | ], 896 | [ 897 | -106.5953140258789, 898 | 40.70307159423828 899 | ], 900 | [ 901 | -106.59712219238281, 902 | 40.70124816894531 903 | ], 904 | [ 905 | -106.6073989868164, 906 | 40.69802474975586 907 | ], 908 | [ 909 | -106.6146469116211, 910 | 40.6948127746582 911 | ], 912 | [ 913 | -106.61764526367188, 914 | 40.69116973876953 915 | ], 916 | [ 917 | -106.61882019042969, 918 | 40.68708038330078 919 | ], 920 | [ 921 | -106.6175765991211, 922 | 40.6834602355957 923 | ], 924 | [ 925 | -106.61328887939453, 926 | 40.678035736083984 927 | ], 928 | [ 929 | -106.60779571533203, 930 | 40.673980712890625 931 | ], 932 | [ 933 | -106.59989929199219, 934 | 40.6717529296875 935 | ], 936 | [ 937 | -106.59384155273438, 938 | 40.67177963256836 939 | ], 940 | [ 941 | -106.59019470214844, 942 | 40.67043685913086 943 | ], 944 | [ 945 | -106.5895767211914, 946 | 40.66862487792969 947 | ], 948 | [ 949 | -106.59136962890625, 950 | 40.66634750366211 951 | ], 952 | [ 953 | -106.59799194335938, 954 | 40.66041946411133 955 | ], 956 | [ 957 | -106.59857177734375, 958 | 40.65769577026367 959 | ], 960 | [ 961 | -106.59490203857422, 962 | 40.65363311767578 963 | ], 964 | [ 965 | -106.59366607666016, 966 | 40.65046310424805 967 | ], 968 | [ 969 | -106.59303283691406, 970 | 40.647743225097656 971 | ], 972 | [ 973 | -106.59422302246094, 974 | 40.645015716552734 975 | ], 976 | [ 977 | -106.59963989257812, 978 | 40.640907287597656 979 | ], 980 | [ 981 | -106.60326385498047, 982 | 40.639530181884766 983 | ], 984 | [ 985 | -106.61173248291016, 986 | 40.63813018798828 987 | ], 988 | [ 989 | -106.61901092529297, 990 | 40.638999938964844 991 | ], 992 | [ 993 | -106.62630462646484, 994 | 40.64213943481445 995 | ], 996 | [ 997 | -106.63054656982422, 998 | 40.642574310302734 999 | ], 1000 | [ 1001 | -106.63539123535156, 1002 | 40.64209747314453 1003 | ], 1004 | [ 1005 | -106.63960266113281, 1006 | 40.63935470581055 1007 | ], 1008 | [ 1009 | -106.64500427246094, 1010 | 40.63343048095703 1011 | ], 1012 | [ 1013 | -106.6498031616211, 1014 | 40.628414154052734 1015 | ], 1016 | [ 1017 | -106.6497802734375, 1018 | 40.625694274902344 1019 | ], 1020 | [ 1021 | -106.63697052001953, 1022 | 40.615325927734375 1023 | ], 1024 | [ 1025 | -106.63512420654297, 1026 | 40.612613677978516 1027 | ], 1028 | [ 1029 | -106.63632202148438, 1030 | 40.61124801635742 1031 | ], 1032 | [ 1033 | -106.64175415039062, 1034 | 40.608951568603516 1035 | ], 1036 | [ 1037 | -106.64354705810547, 1038 | 40.606224060058594 1039 | ], 1040 | [ 1041 | -106.64291381835938, 1042 | 40.6035041809082 1043 | ], 1044 | [ 1045 | -106.6392593383789, 1046 | 40.60080337524414 1047 | ], 1048 | [ 1049 | -106.63076782226562, 1050 | 40.599029541015625 1051 | ], 1052 | [ 1053 | -106.61563873291016, 1054 | 40.59955978393555 1055 | ], 1056 | [ 1057 | -106.60778045654297, 1058 | 40.600502014160156 1059 | ], 1060 | [ 1061 | -106.6053466796875, 1062 | 40.599605560302734 1063 | ], 1064 | [ 1065 | -106.60411071777344, 1066 | 40.596893310546875 1067 | ], 1068 | [ 1069 | -106.60340881347656, 1070 | 40.58555603027344 1071 | ], 1072 | [ 1073 | -106.60521697998047, 1074 | 40.58373260498047 1075 | ], 1076 | [ 1077 | -106.61064147949219, 1078 | 40.58143997192383 1079 | ], 1080 | [ 1081 | -106.613037109375, 1082 | 40.57870864868164 1083 | ], 1084 | [ 1085 | -106.61483001708984, 1086 | 40.57643127441406 1087 | ], 1088 | [ 1089 | -106.61785125732422, 1090 | 40.57505416870117 1091 | ], 1092 | [ 1093 | -106.6250991821289, 1094 | 40.57365798950195 1095 | ], 1096 | [ 1097 | -106.62934112548828, 1098 | 40.574546813964844 1099 | ], 1100 | [ 1101 | -106.63177490234375, 1102 | 40.57634735107422 1103 | ], 1104 | [ 1105 | -106.63542175292969, 1106 | 40.57769012451172 1107 | ], 1108 | [ 1109 | -106.63965606689453, 1110 | 40.57721710205078 1111 | ], 1112 | [ 1113 | -106.64266204833984, 1114 | 40.57538604736328 1115 | ], 1116 | [ 1117 | -106.64685821533203, 1118 | 40.57128143310547 1119 | ], 1120 | [ 1121 | -106.64983367919922, 1122 | 40.56536865234375 1123 | ], 1124 | [ 1125 | -106.65398406982422, 1126 | 40.556278228759766 1127 | ], 1128 | [ 1129 | -106.65937805175781, 1130 | 40.55035400390625 1131 | ], 1132 | [ 1133 | -106.66238403320312, 1134 | 40.54852294921875 1135 | ], 1136 | [ 1137 | -106.67203521728516, 1138 | 40.545753479003906 1139 | ], 1140 | [ 1141 | -106.68049621582031, 1142 | 40.54389190673828 1143 | ], 1144 | [ 1145 | -106.68592834472656, 1146 | 40.5429573059082 1147 | ], 1148 | [ 1149 | -106.69017028808594, 1150 | 40.54338836669922 1151 | ], 1152 | [ 1153 | -106.69866180419922, 1154 | 40.54606246948242 1155 | ], 1156 | [ 1157 | -106.7083740234375, 1158 | 40.5491828918457 1159 | ], 1160 | [ 1161 | -106.71505737304688, 1162 | 40.55232238769531 1163 | ], 1164 | [ 1165 | -106.71932983398438, 1166 | 40.55592346191406 1167 | ], 1168 | [ 1169 | -106.72181701660156, 1170 | 40.562713623046875 1171 | ], 1172 | [ 1173 | -106.72555541992188, 1174 | 40.573123931884766 1175 | ], 1176 | [ 1177 | -106.7274169921875, 1178 | 40.5776481628418 1179 | ], 1180 | [ 1181 | -106.72985076904297, 1182 | 40.57944869995117 1183 | ], 1184 | [ 1185 | -106.73593139648438, 1186 | 40.58168029785156 1187 | ], 1188 | [ 1189 | -106.74137878417969, 1190 | 40.58164978027344 1191 | ], 1192 | [ 1193 | -106.75103759765625, 1194 | 40.57978057861328 1195 | ], 1196 | [ 1197 | -106.7564926147461, 1198 | 40.5802001953125 1199 | ], 1200 | [ 1201 | -106.76197052001953, 1202 | 40.583343505859375 1203 | ], 1204 | [ 1205 | -106.77957153320312, 1206 | 40.587772369384766 1207 | ], 1208 | [ 1209 | -106.78685760498047, 1210 | 40.589542388916016 1211 | ], 1212 | [ 1213 | -106.79415130615234, 1214 | 40.59267044067383 1215 | ], 1216 | [ 1217 | -106.79841613769531, 1218 | 40.59490966796875 1219 | ], 1220 | [ 1221 | -106.80142974853516, 1222 | 40.59353256225586 1223 | ], 1224 | [ 1225 | -106.80381774902344, 1226 | 40.59079360961914 1227 | ], 1228 | [ 1229 | -106.80681610107422, 1230 | 40.58805465698242 1231 | ], 1232 | [ 1233 | -106.81224822998047, 1234 | 40.58711242675781 1235 | ], 1236 | [ 1237 | -106.81649780273438, 1238 | 40.58799362182617 1239 | ], 1240 | [ 1241 | -106.82198333740234, 1242 | 40.59158706665039 1243 | ], 1244 | [ 1245 | -106.83171844482422, 1246 | 40.59560012817383 1247 | ], 1248 | [ 1249 | -106.83780670166016, 1250 | 40.59873580932617 1251 | ], 1252 | [ 1253 | -106.84148406982422, 1254 | 40.60234069824219 1255 | ], 1256 | [ 1257 | -106.8421401977539, 1258 | 40.60687255859375 1259 | ], 1260 | [ 1261 | -106.84039306640625, 1262 | 40.612327575683594 1263 | ], 1264 | [ 1265 | -106.83265686035156, 1266 | 40.624168395996094 1267 | ], 1268 | [ 1269 | -106.82845306396484, 1270 | 40.62737274169922 1271 | ], 1272 | [ 1273 | -106.82423400878906, 1274 | 40.628761291503906 1275 | ], 1276 | [ 1277 | -106.81940460205078, 1278 | 40.63060760498047 1279 | ], 1280 | [ 1281 | -106.8182144165039, 1282 | 40.63242721557617 1283 | ], 1284 | [ 1285 | -106.81886291503906, 1286 | 40.636051177978516 1287 | ], 1288 | [ 1289 | -106.8231430053711, 1290 | 40.639652252197266 1291 | ], 1292 | [ 1293 | -106.82379913330078, 1294 | 40.64373016357422 1295 | ], 1296 | [ 1297 | -106.822021484375, 1298 | 40.647369384765625 1299 | ], 1300 | [ 1301 | -106.8154296875, 1302 | 40.65376281738281 1303 | ], 1304 | [ 1305 | -106.8112564086914, 1306 | 40.65923309326172 1307 | ], 1308 | [ 1309 | -106.80648803710938, 1310 | 40.66606903076172 1311 | ], 1312 | [ 1313 | -106.80532836914062, 1314 | 40.67106628417969 1315 | ], 1316 | [ 1317 | -106.80181121826172, 1318 | 40.6815185546875 1319 | ], 1320 | [ 1321 | -106.79650115966797, 1322 | 40.694252014160156 1323 | ], 1324 | [ 1325 | -106.79470825195312, 1326 | 40.69698715209961 1327 | ], 1328 | [ 1329 | -106.79168701171875, 1330 | 40.69791030883789 1331 | ], 1332 | [ 1333 | -106.7862319946289, 1334 | 40.69749450683594 1335 | ], 1336 | [ 1337 | -106.78018188476562, 1338 | 40.69843673706055 1339 | ], 1340 | [ 1341 | -106.77717590332031, 1342 | 40.701175689697266 1343 | ], 1344 | [ 1345 | -106.77783203125, 1346 | 40.70570755004883 1347 | ], 1348 | [ 1349 | -106.78404235839844, 1350 | 40.71882629394531 1351 | ], 1352 | [ 1353 | -106.78651428222656, 1354 | 40.72289276123047 1355 | ], 1356 | [ 1357 | -106.78714752197266, 1358 | 40.725608825683594 1359 | ], 1360 | [ 1361 | -106.78474426269531, 1362 | 40.7278938293457 1363 | ], 1364 | [ 1365 | -106.77869415283203, 1366 | 40.72929000854492 1367 | ], 1368 | [ 1369 | -106.7666244506836, 1370 | 40.73435592651367 1371 | ], 1372 | [ 1373 | -106.76301574707031, 1374 | 40.737552642822266 1375 | ], 1376 | [ 1377 | -106.76185607910156, 1378 | 40.742095947265625 1379 | ], 1380 | [ 1381 | -106.75950622558594, 1382 | 40.749366760253906 1383 | ], 1384 | [ 1385 | -106.75529479980469, 1386 | 40.753021240234375 1387 | ], 1388 | [ 1389 | -106.7498779296875, 1390 | 40.75713348388672 1391 | ], 1392 | [ 1393 | -106.74443054199219, 1394 | 40.75807189941406 1395 | ], 1396 | [ 1397 | -106.73834228515625, 1398 | 40.75674819946289 1399 | ], 1400 | [ 1401 | -106.72919464111328, 1402 | 40.75226593017578 1403 | ], 1404 | [ 1405 | -106.72676849365234, 1406 | 40.75227737426758 1407 | ], 1408 | [ 1409 | -106.71226501464844, 1410 | 40.75780487060547 1411 | ], 1412 | [ 1413 | -106.70623016357422, 1414 | 40.76146697998047 1415 | ], 1416 | [ 1417 | -106.7044448852539, 1418 | 40.764652252197266 1419 | ], 1420 | [ 1421 | -106.70579528808594, 1422 | 40.77870559692383 1423 | ], 1424 | [ 1425 | -106.70585632324219, 1426 | 40.784603118896484 1427 | ], 1428 | [ 1429 | -106.70348358154297, 1430 | 40.7905158996582 1431 | ], 1432 | [ 1433 | -106.7041244506836, 1434 | 40.79368591308594 1435 | ], 1436 | [ 1437 | -106.70658111572266, 1438 | 40.79684829711914 1439 | ], 1440 | [ 1441 | -106.71088409423828, 1442 | 40.801815032958984 1443 | ], 1444 | [ 1445 | -106.71340942382812, 1446 | 40.81132507324219 1447 | ], 1448 | [ 1449 | -106.71715545654297, 1450 | 40.821739196777344 1451 | ], 1452 | [ 1453 | -106.71839904785156, 1454 | 40.8244514465332 1455 | ], 1456 | [ 1457 | -106.72084045410156, 1458 | 40.825801849365234 1459 | ], 1460 | [ 1461 | -106.73668670654297, 1462 | 40.83160400390625 1463 | ], 1464 | [ 1465 | -106.7427978515625, 1466 | 40.834747314453125 1467 | ], 1468 | [ 1469 | -106.75139617919922, 1470 | 40.84422302246094 1471 | ], 1472 | [ 1473 | -106.7538833618164, 1474 | 40.84965133666992 1475 | ], 1476 | [ 1477 | -106.75150299072266, 1478 | 40.8537483215332 1479 | ], 1480 | [ 1481 | -106.74608612060547, 1482 | 40.858768463134766 1483 | ], 1484 | [ 1485 | -106.74429321289062, 1486 | 40.86150360107422 1487 | ], 1488 | [ 1489 | -106.74491882324219, 1490 | 40.863311767578125 1491 | ], 1492 | [ 1493 | -106.74796295166016, 1494 | 40.86420440673828 1495 | ], 1496 | [ 1497 | -106.75586700439453, 1498 | 40.86460494995117 1499 | ], 1500 | [ 1501 | -106.76317596435547, 1502 | 40.86637878417969 1503 | ], 1504 | [ 1505 | -106.76990509033203, 1506 | 40.870418548583984 1507 | ], 1508 | [ 1509 | -106.77301788330078, 1510 | 40.87629699707031 1511 | ], 1512 | [ 1513 | -106.77313232421875, 1514 | 40.887638092041016 1515 | ], 1516 | [ 1517 | -106.77294158935547, 1518 | 40.90522384643555 1519 | ], 1520 | [ 1521 | -106.78055572509766, 1522 | 40.90708541870117 1523 | ], 1524 | [ 1525 | -106.7989501953125, 1526 | 40.89576721191406 1527 | ], 1528 | [ 1529 | -106.8059310913086, 1530 | 40.898101806640625 1531 | ], 1532 | [ 1533 | -106.80464172363281, 1534 | 40.90327072143555 1535 | ], 1536 | [ 1537 | -106.80973815917969, 1538 | 40.91682052612305 1539 | ], 1540 | [ 1541 | -106.8172378540039, 1542 | 40.9182014465332 1543 | ], 1544 | [ 1545 | -106.81767272949219, 1546 | 40.92233657836914 1547 | ], 1548 | [ 1549 | -106.823486328125, 1550 | 40.925209045410156 1551 | ], 1552 | [ 1553 | -106.83625793457031, 1554 | 40.924407958984375 1555 | ], 1556 | [ 1557 | -106.84684753417969, 1558 | 40.92605209350586 1559 | ], 1560 | [ 1561 | -106.85509490966797, 1562 | 40.940330505371094 1563 | ], 1564 | [ 1565 | -106.8475570678711, 1566 | 40.96160888671875 1567 | ], 1568 | [ 1569 | -106.84174346923828, 1570 | 40.970298767089844 1571 | ], 1572 | [ 1573 | -106.83457946777344, 1574 | 40.97213363647461 1575 | ], 1576 | [ 1577 | -106.82674407958984, 1578 | 40.9675407409668 1579 | ], 1580 | [ 1581 | -106.81885528564453, 1582 | 40.97404479980469 1583 | ], 1584 | [ 1585 | -106.79289245605469, 1586 | 40.98352813720703 1587 | ] 1588 | ] 1589 | ], 1590 | "type": "Polygon" 1591 | }, 1592 | "id": "2", 1593 | "properties": { 1594 | "skip_me": [1, 2, 3, 4], 1595 | "AGBUR": "FS", 1596 | "AREA": 0.0714955, 1597 | "FEATURE1": "Wilderness", 1598 | "FEATURE2": null, 1599 | "NAME": "Mount Zirkel Wilderness", 1600 | "PERIMETER": 1.70851, 1601 | "STATE": "CO", 1602 | "STATE_FIPS": "08", 1603 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Zirkel", 1604 | "WILDRNP020": 357 1605 | }, 1606 | "type": "Feature" 1607 | }], 1608 | "type": "FeatureCollection" 1609 | } 1610 | -------------------------------------------------------------------------------- /tests/fixtures/sequence-pp.txt: -------------------------------------------------------------------------------- 1 | { 2 | "geometry": { 3 | "type": "Polygon", 4 | "coordinates": [ 5 | [ 6 | [ 7 | -111.73527526855469, 8 | 41.995094299316406 9 | ], 10 | [ 11 | -111.65931701660156, 12 | 41.99627685546875 13 | ], 14 | [ 15 | -111.6587142944336, 16 | 41.9921875 17 | ], 18 | [ 19 | -111.65888977050781, 20 | 41.95676803588867 21 | ], 22 | [ 23 | -111.67082977294922, 24 | 41.91230010986328 25 | ], 26 | [ 27 | -111.67332458496094, 28 | 41.905494689941406 29 | ], 30 | [ 31 | -111.67088317871094, 32 | 41.90049362182617 33 | ], 34 | [ 35 | -111.66474914550781, 36 | 41.893211364746094 37 | ], 38 | [ 39 | -111.6506576538086, 40 | 41.875465393066406 41 | ], 42 | [ 43 | -111.64759826660156, 44 | 41.87091827392578 45 | ], 46 | [ 47 | -111.64640808105469, 48 | 41.86273956298828 49 | ], 50 | [ 51 | -111.64334869384766, 52 | 41.858192443847656 53 | ], 54 | [ 55 | -111.63720703125, 56 | 41.85499572753906 57 | ], 58 | [ 59 | -111.633544921875, 60 | 41.847267150878906 61 | ], 62 | [ 63 | -111.63053894042969, 64 | 41.83409118652344 65 | ], 66 | [ 67 | -111.6330337524414, 68 | 41.82728576660156 69 | ], 70 | [ 71 | -111.63983154296875, 72 | 41.8227653503418 73 | ], 74 | [ 75 | -111.6484603881836, 76 | 41.82188034057617 77 | ], 78 | [ 79 | -111.66077423095703, 80 | 41.82327651977539 81 | ], 82 | [ 83 | -111.6712417602539, 84 | 41.82330322265625 85 | ], 86 | [ 87 | -111.67618560791016, 88 | 41.82013702392578 89 | ], 90 | [ 91 | -111.68803405761719, 92 | 41.78792953491211 93 | ], 94 | [ 95 | -111.69361114501953, 96 | 41.77931594848633 97 | ], 98 | [ 99 | -111.70162200927734, 100 | 41.77797317504883 101 | ], 102 | [ 103 | -111.70901489257812, 104 | 41.77663040161133 105 | ], 106 | [ 107 | -111.71395111083984, 108 | 41.772098541259766 109 | ], 110 | [ 111 | -111.71891784667969, 112 | 41.763031005859375 113 | ], 114 | [ 115 | -111.72816467285156, 116 | 41.75851058959961 117 | ], 118 | [ 119 | -111.74726104736328, 120 | 41.75537109375 121 | ], 122 | [ 123 | -111.75650024414062, 124 | 41.752662658691406 125 | ], 126 | [ 127 | -111.77067565917969, 128 | 41.7445182800293 129 | ], 130 | [ 131 | -111.77064514160156, 132 | 41.75495910644531 133 | ], 134 | [ 135 | -111.75585174560547, 136 | 41.76219940185547 137 | ], 138 | [ 139 | -111.7330551147461, 140 | 41.766693115234375 141 | ], 142 | [ 143 | -111.72749328613281, 144 | 41.77212905883789 145 | ], 146 | [ 147 | -111.71883392333984, 148 | 41.7834587097168 149 | ], 150 | [ 151 | -111.71080780029297, 152 | 41.78889083862305 153 | ], 154 | [ 155 | -111.70340728759766, 156 | 41.79250717163086 157 | ], 158 | [ 159 | -111.70030212402344, 160 | 41.798404693603516 161 | ], 162 | [ 163 | -111.70210266113281, 164 | 41.8088493347168 165 | ], 166 | [ 167 | -111.70760345458984, 168 | 41.819759368896484 169 | ], 170 | [ 171 | -111.71312713623047, 172 | 41.82340621948242 173 | ], 174 | [ 175 | -111.71929168701172, 176 | 41.82341766357422 177 | ], 178 | [ 179 | -111.72545623779297, 180 | 41.8225212097168 181 | ], 182 | [ 183 | -111.7341537475586, 184 | 41.803016662597656 185 | ], 186 | [ 187 | -111.740966796875, 188 | 41.79213333129883 189 | ], 190 | [ 191 | -111.74531555175781, 192 | 41.78215408325195 193 | ], 194 | [ 195 | -111.77122497558594, 196 | 41.7658576965332 197 | ], 198 | [ 199 | -111.77056884765625, 200 | 41.77811813354492 201 | ], 202 | [ 203 | -111.7662582397461, 204 | 41.778106689453125 205 | ], 206 | [ 207 | -111.76746368408203, 208 | 41.78628158569336 209 | ], 210 | [ 211 | -111.76253509521484, 212 | 41.78627395629883 213 | ], 214 | [ 215 | -111.76241302490234, 216 | 41.82259750366211 217 | ], 218 | [ 219 | -111.77104187011719, 220 | 41.8221549987793 221 | ], 222 | [ 223 | -111.77161407470703, 224 | 41.83351135253906 225 | ], 226 | [ 227 | -111.7333755493164, 228 | 41.84524154663086 229 | ], 230 | [ 231 | -111.73274993896484, 232 | 41.847511291503906 233 | ], 234 | [ 235 | -111.7376708984375, 236 | 41.84979248046875 237 | ], 238 | [ 239 | -111.77157592773438, 240 | 41.845767974853516 241 | ], 242 | [ 243 | -111.77215576171875, 244 | 41.85802459716797 245 | ], 246 | [ 247 | -111.75243377685547, 248 | 41.85844802856445 249 | ], 250 | [ 251 | -111.72467803955078, 252 | 41.86384201049805 253 | ], 254 | [ 255 | -111.71109771728516, 256 | 41.868804931640625 257 | ], 258 | [ 259 | -111.70182037353516, 260 | 41.87604904174805 261 | ], 262 | [ 263 | -111.69624328613281, 264 | 41.88193893432617 265 | ], 266 | [ 267 | -111.69497680664062, 268 | 41.88874816894531 269 | ], 270 | [ 271 | -111.70053100585938, 272 | 41.89057540893555 273 | ], 274 | [ 275 | -111.70793151855469, 276 | 41.88923263549805 277 | ], 278 | [ 279 | -111.72091674804688, 280 | 41.87972640991211 281 | ], 282 | [ 283 | -111.73388671875, 284 | 41.87384796142578 285 | ], 286 | [ 287 | -111.75301361083984, 288 | 41.86888885498047 289 | ], 290 | [ 291 | -111.75350952148438, 292 | 41.90249252319336 293 | ], 294 | [ 295 | -111.74364471435547, 296 | 41.90247344970703 297 | ], 298 | [ 299 | -111.74463653564453, 300 | 41.967864990234375 301 | ], 302 | [ 303 | -111.7119369506836, 304 | 41.96416473388672 305 | ], 306 | [ 307 | -111.69283294677734, 308 | 41.95912551879883 309 | ], 310 | [ 311 | -111.68911743164062, 312 | 41.96047592163086 313 | ], 314 | [ 315 | -111.6891098022461, 316 | 41.96320343017578 317 | ], 318 | [ 319 | -111.69341278076172, 320 | 41.96684646606445 321 | ], 322 | [ 323 | -111.70449829101562, 324 | 41.972320556640625 325 | ], 326 | [ 327 | -111.7341079711914, 328 | 41.97828674316406 329 | ], 330 | [ 331 | -111.73527526855469, 332 | 41.995094299316406 333 | ] 334 | ] 335 | ] 336 | }, 337 | "type": "Feature", 338 | "id": "0", 339 | "properties": { 340 | "PERIMETER": 1.22107, 341 | "FEATURE2": null, 342 | "NAME": "Mount Naomi Wilderness", 343 | "FEATURE1": "Wilderness", 344 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Naomi", 345 | "AGBUR": "FS", 346 | "AREA": 0.0179264, 347 | "STATE_FIPS": "49", 348 | "WILDRNP020": 332, 349 | "STATE": "UT" 350 | } 351 | } 352 | { 353 | "geometry": { 354 | "type": "Polygon", 355 | "coordinates": [ 356 | [ 357 | [ 358 | -112.00384521484375, 359 | 41.552703857421875 360 | ], 361 | [ 362 | -112.00446319580078, 363 | 41.56586456298828 364 | ], 365 | [ 366 | -112.0112075805664, 367 | 41.56586456298828 368 | ], 369 | [ 370 | -112.01121520996094, 371 | 41.57902526855469 372 | ], 373 | [ 374 | -112.01734924316406, 375 | 41.57902526855469 376 | ], 377 | [ 378 | -112.0173568725586, 379 | 41.594459533691406 380 | ], 381 | [ 382 | -112.02779388427734, 383 | 41.5940055847168 384 | ], 385 | [ 386 | -112.02779388427734, 387 | 41.60171890258789 388 | ], 389 | [ 390 | -112.03945922851562, 391 | 41.60126495361328 392 | ], 393 | [ 394 | -112.04007720947266, 395 | 41.608524322509766 396 | ], 397 | [ 398 | -112.04744720458984, 399 | 41.608524322509766 400 | ], 401 | [ 402 | -112.0474624633789, 403 | 41.62804412841797 404 | ], 405 | [ 406 | -112.05974578857422, 407 | 41.62758255004883 408 | ], 409 | [ 410 | -112.05975341796875, 411 | 41.640296936035156 412 | ], 413 | [ 414 | -112.050537109375, 415 | 41.64030075073242 416 | ], 417 | [ 418 | -112.05054473876953, 419 | 41.64983367919922 420 | ], 421 | [ 422 | -112.04132843017578, 423 | 41.64983367919922 424 | ], 425 | [ 426 | -112.04195404052734, 427 | 41.66299819946289 428 | ], 429 | [ 430 | -112.05793762207031, 431 | 41.662540435791016 432 | ], 433 | [ 434 | -112.0579605102539, 435 | 41.692047119140625 436 | ], 437 | [ 438 | -112.07394409179688, 439 | 41.692039489746094 440 | ], 441 | [ 442 | -112.07459259033203, 443 | 41.72381591796875 444 | ], 445 | [ 446 | -112.06167602539062, 447 | 41.72382354736328 448 | ], 449 | [ 450 | -112.0616683959961, 451 | 41.71383285522461 452 | ], 453 | [ 454 | -112.05490112304688, 455 | 41.713836669921875 456 | ], 457 | [ 458 | -112.04137420654297, 459 | 41.71384048461914 460 | ], 461 | [ 462 | -112.04138946533203, 463 | 41.7379035949707 464 | ], 465 | [ 466 | -112.0376968383789, 467 | 41.74108123779297 468 | ], 469 | [ 470 | -112.03339385986328, 471 | 41.741085052490234 472 | ], 473 | [ 474 | -112.02908325195312, 475 | 41.729736328125 476 | ], 477 | [ 478 | -112.02599334716797, 479 | 41.71657180786133 480 | ], 481 | [ 482 | -112.0241470336914, 483 | 41.71157455444336 484 | ], 485 | [ 486 | -112.0272216796875, 487 | 41.704769134521484 488 | ], 489 | [ 490 | -112.02413940429688, 491 | 41.70068359375 492 | ], 493 | [ 494 | -112.01676177978516, 495 | 41.69977951049805 496 | ], 497 | [ 498 | -112.01615142822266, 499 | 41.7070426940918 500 | ], 501 | [ 502 | -112.00508117675781, 503 | 41.707496643066406 504 | ], 505 | [ 506 | -112.00508117675781, 507 | 41.66618347167969 508 | ], 509 | [ 510 | -111.9792709350586, 511 | 41.6666374206543 512 | ], 513 | [ 514 | -111.9786605834961, 515 | 41.653926849365234 516 | ], 517 | [ 518 | -111.96821594238281, 519 | 41.65346908569336 520 | ], 521 | [ 522 | -111.96760559082031, 523 | 41.6407585144043 524 | ], 525 | [ 526 | -111.96146392822266, 527 | 41.6407585144043 528 | ], 529 | [ 530 | -111.96025085449219, 531 | 41.61125183105469 532 | ], 533 | [ 534 | -111.95042419433594, 535 | 41.61124801635742 536 | ], 537 | [ 538 | -111.94796752929688, 539 | 41.60988235473633 540 | ], 541 | [ 542 | -111.94735717773438, 543 | 41.60761260986328 544 | ], 545 | [ 546 | -111.9522705078125, 547 | 41.60443878173828 548 | ], 549 | [ 550 | -111.96455383300781, 551 | 41.60262680053711 552 | ], 553 | [ 554 | -111.9682388305664, 555 | 41.60398864746094 556 | ], 557 | [ 558 | -111.9725341796875, 559 | 41.60807418823242 560 | ], 561 | [ 562 | -111.97560119628906, 563 | 41.60943603515625 564 | ], 565 | [ 566 | -111.97928619384766, 567 | 41.61034393310547 568 | ], 569 | [ 570 | -111.98542785644531, 571 | 41.609439849853516 572 | ], 573 | [ 574 | -111.98481750488281, 575 | 41.58356475830078 576 | ], 577 | [ 578 | -111.97868347167969, 579 | 41.58356857299805 580 | ], 581 | [ 582 | -111.97745513916016, 583 | 41.570404052734375 584 | ], 585 | [ 586 | -111.97132110595703, 587 | 41.57085418701172 588 | ], 589 | [ 590 | -111.97132110595703, 591 | 41.56450271606445 592 | ], 593 | [ 594 | -111.98297882080078, 595 | 41.564048767089844 596 | ], 597 | [ 598 | -111.98175811767578, 599 | 41.54090118408203 600 | ], 601 | [ 602 | -111.98176574707031, 603 | 41.53545379638672 604 | ], 605 | [ 606 | -112.00323486328125, 607 | 41.53545379638672 608 | ], 609 | [ 610 | -112.00384521484375, 611 | 41.552703857421875 612 | ] 613 | ] 614 | ] 615 | }, 616 | "type": "Feature", 617 | "id": "1", 618 | "properties": { 619 | "PERIMETER": 0.755827, 620 | "FEATURE2": null, 621 | "NAME": "Wellsville Mountain Wilderness", 622 | "FEATURE1": "Wilderness", 623 | "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Wellsville%20Mountain", 624 | "AGBUR": "FS", 625 | "AREA": 0.0104441, 626 | "STATE_FIPS": "49", 627 | "WILDRNP020": 336, 628 | "STATE": "UT" 629 | } 630 | } 631 | -------------------------------------------------------------------------------- /tests/fixtures/sequence.txt: -------------------------------------------------------------------------------- 1 | {"geometry": {"type": "Polygon", "coordinates": [[[-111.73527526855469, 41.995094299316406], [-111.65931701660156, 41.99627685546875], [-111.6587142944336, 41.9921875], [-111.65888977050781, 41.95676803588867], [-111.67082977294922, 41.91230010986328], [-111.67332458496094, 41.905494689941406], [-111.67088317871094, 41.90049362182617], [-111.66474914550781, 41.893211364746094], [-111.6506576538086, 41.875465393066406], [-111.64759826660156, 41.87091827392578], [-111.64640808105469, 41.86273956298828], [-111.64334869384766, 41.858192443847656], [-111.63720703125, 41.85499572753906], [-111.633544921875, 41.847267150878906], [-111.63053894042969, 41.83409118652344], [-111.6330337524414, 41.82728576660156], [-111.63983154296875, 41.8227653503418], [-111.6484603881836, 41.82188034057617], [-111.66077423095703, 41.82327651977539], [-111.6712417602539, 41.82330322265625], [-111.67618560791016, 41.82013702392578], [-111.68803405761719, 41.78792953491211], [-111.69361114501953, 41.77931594848633], [-111.70162200927734, 41.77797317504883], [-111.70901489257812, 41.77663040161133], [-111.71395111083984, 41.772098541259766], [-111.71891784667969, 41.763031005859375], [-111.72816467285156, 41.75851058959961], [-111.74726104736328, 41.75537109375], [-111.75650024414062, 41.752662658691406], [-111.77067565917969, 41.7445182800293], [-111.77064514160156, 41.75495910644531], [-111.75585174560547, 41.76219940185547], [-111.7330551147461, 41.766693115234375], [-111.72749328613281, 41.77212905883789], [-111.71883392333984, 41.7834587097168], [-111.71080780029297, 41.78889083862305], [-111.70340728759766, 41.79250717163086], [-111.70030212402344, 41.798404693603516], [-111.70210266113281, 41.8088493347168], [-111.70760345458984, 41.819759368896484], [-111.71312713623047, 41.82340621948242], [-111.71929168701172, 41.82341766357422], [-111.72545623779297, 41.8225212097168], [-111.7341537475586, 41.803016662597656], [-111.740966796875, 41.79213333129883], [-111.74531555175781, 41.78215408325195], [-111.77122497558594, 41.7658576965332], [-111.77056884765625, 41.77811813354492], [-111.7662582397461, 41.778106689453125], [-111.76746368408203, 41.78628158569336], [-111.76253509521484, 41.78627395629883], [-111.76241302490234, 41.82259750366211], [-111.77104187011719, 41.8221549987793], [-111.77161407470703, 41.83351135253906], [-111.7333755493164, 41.84524154663086], [-111.73274993896484, 41.847511291503906], [-111.7376708984375, 41.84979248046875], [-111.77157592773438, 41.845767974853516], [-111.77215576171875, 41.85802459716797], [-111.75243377685547, 41.85844802856445], [-111.72467803955078, 41.86384201049805], [-111.71109771728516, 41.868804931640625], [-111.70182037353516, 41.87604904174805], [-111.69624328613281, 41.88193893432617], [-111.69497680664062, 41.88874816894531], [-111.70053100585938, 41.89057540893555], [-111.70793151855469, 41.88923263549805], [-111.72091674804688, 41.87972640991211], [-111.73388671875, 41.87384796142578], [-111.75301361083984, 41.86888885498047], [-111.75350952148438, 41.90249252319336], [-111.74364471435547, 41.90247344970703], [-111.74463653564453, 41.967864990234375], [-111.7119369506836, 41.96416473388672], [-111.69283294677734, 41.95912551879883], [-111.68911743164062, 41.96047592163086], [-111.6891098022461, 41.96320343017578], [-111.69341278076172, 41.96684646606445], [-111.70449829101562, 41.972320556640625], [-111.7341079711914, 41.97828674316406], [-111.73527526855469, 41.995094299316406]]]}, "type": "Feature", "id": "0", "properties": {"PERIMETER": 1.22107, "FEATURE2": null, "NAME": "Mount Naomi Wilderness", "FEATURE1": "Wilderness", "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Mount%20Naomi", "AGBUR": "FS", "AREA": 0.0179264, "STATE_FIPS": "49", "WILDRNP020": 332, "STATE": "UT"}} 2 | {"geometry": {"type": "Polygon", "coordinates": [[[-112.00384521484375, 41.552703857421875], [-112.00446319580078, 41.56586456298828], [-112.0112075805664, 41.56586456298828], [-112.01121520996094, 41.57902526855469], [-112.01734924316406, 41.57902526855469], [-112.0173568725586, 41.594459533691406], [-112.02779388427734, 41.5940055847168], [-112.02779388427734, 41.60171890258789], [-112.03945922851562, 41.60126495361328], [-112.04007720947266, 41.608524322509766], [-112.04744720458984, 41.608524322509766], [-112.0474624633789, 41.62804412841797], [-112.05974578857422, 41.62758255004883], [-112.05975341796875, 41.640296936035156], [-112.050537109375, 41.64030075073242], [-112.05054473876953, 41.64983367919922], [-112.04132843017578, 41.64983367919922], [-112.04195404052734, 41.66299819946289], [-112.05793762207031, 41.662540435791016], [-112.0579605102539, 41.692047119140625], [-112.07394409179688, 41.692039489746094], [-112.07459259033203, 41.72381591796875], [-112.06167602539062, 41.72382354736328], [-112.0616683959961, 41.71383285522461], [-112.05490112304688, 41.713836669921875], [-112.04137420654297, 41.71384048461914], [-112.04138946533203, 41.7379035949707], [-112.0376968383789, 41.74108123779297], [-112.03339385986328, 41.741085052490234], [-112.02908325195312, 41.729736328125], [-112.02599334716797, 41.71657180786133], [-112.0241470336914, 41.71157455444336], [-112.0272216796875, 41.704769134521484], [-112.02413940429688, 41.70068359375], [-112.01676177978516, 41.69977951049805], [-112.01615142822266, 41.7070426940918], [-112.00508117675781, 41.707496643066406], [-112.00508117675781, 41.66618347167969], [-111.9792709350586, 41.6666374206543], [-111.9786605834961, 41.653926849365234], [-111.96821594238281, 41.65346908569336], [-111.96760559082031, 41.6407585144043], [-111.96146392822266, 41.6407585144043], [-111.96025085449219, 41.61125183105469], [-111.95042419433594, 41.61124801635742], [-111.94796752929688, 41.60988235473633], [-111.94735717773438, 41.60761260986328], [-111.9522705078125, 41.60443878173828], [-111.96455383300781, 41.60262680053711], [-111.9682388305664, 41.60398864746094], [-111.9725341796875, 41.60807418823242], [-111.97560119628906, 41.60943603515625], [-111.97928619384766, 41.61034393310547], [-111.98542785644531, 41.609439849853516], [-111.98481750488281, 41.58356475830078], [-111.97868347167969, 41.58356857299805], [-111.97745513916016, 41.570404052734375], [-111.97132110595703, 41.57085418701172], [-111.97132110595703, 41.56450271606445], [-111.98297882080078, 41.564048767089844], [-111.98175811767578, 41.54090118408203], [-111.98176574707031, 41.53545379638672], [-112.00323486328125, 41.53545379638672], [-112.00384521484375, 41.552703857421875]]]}, "type": "Feature", "id": "1", "properties": {"PERIMETER": 0.755827, "FEATURE2": null, "NAME": "Wellsville Mountain Wilderness", "FEATURE1": "Wilderness", "URL": "http://www.wilderness.net/index.cfm?fuse=NWPS&sec=wildView&wname=Wellsville%20Mountain", "AGBUR": "FS", "AREA": 0.0104441, "STATE_FIPS": "49", "WILDRNP020": 336, "STATE": "UT"}} 3 | -------------------------------------------------------------------------------- /tests/fixtures/test_gpx.gpx: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 11.0 14 | 10.9 15 | 10.7 16 | 10.5 17 | 10.4 18 | 10.2 19 | 10.0 20 | 10.0 21 | 10.0 22 | 10.2 23 | 10.4 24 | 10.5 25 | 10.5 26 | 10.1 27 | 9.6 28 | 9.1 29 | 8.3 30 | 7.2 31 | 6.6 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/fixtures/test_tin.csv: -------------------------------------------------------------------------------- 1 | WKT,id 2 | "TIN (((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0)))",1 3 | "TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0))",2 4 | "GEOMETRYCOLLECTION (TIN (((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0))), TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0)))",3 5 | -------------------------------------------------------------------------------- /tests/fixtures/test_tin.dbf: -------------------------------------------------------------------------------- 1 | v AQWidCP 1  -------------------------------------------------------------------------------- /tests/fixtures/test_tin.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/test_tin.shp -------------------------------------------------------------------------------- /tests/fixtures/test_tin.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/test_tin.shx -------------------------------------------------------------------------------- /tests/fixtures/test_tz.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { 5 | "type": "Feature", 6 | "properties": { 7 | "test": "2015-04-22T00:00:00+07:00" 8 | }, 9 | "geometry": { 10 | "type": "Point", 11 | "coordinates": [ 12 | -79.4, 13 | 43.6 14 | ] 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/testopenfilegdb.gdb.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentseed/fio-stac/0c9d39853b52d2d12c65c7b8a00f4596205bceeb/tests/fixtures/testopenfilegdb.gdb.zip -------------------------------------------------------------------------------- /tests/test_cli.py: -------------------------------------------------------------------------------- 1 | """tests fio_stac.cli.""" 2 | 3 | import json 4 | import os 5 | 6 | from fio_stac.scripts.cli import stac 7 | 8 | PREFIX = os.path.join(os.path.dirname(__file__), "fixtures") 9 | 10 | 11 | def test_rio_stac_cli(runner): 12 | """Should work as expected.""" 13 | with runner.isolated_filesystem(): 14 | src_path = os.path.join(PREFIX, "coutwildrnp.shp") 15 | result = runner.invoke(stac, [src_path]) 16 | assert not result.exception 17 | assert result.exit_code == 0 18 | stac_item = json.loads(result.output) 19 | assert stac_item["type"] == "Feature" 20 | assert stac_item["id"] == "coutwildrnp" 21 | assert stac_item["assets"]["coutwildrnp"] 22 | assert stac_item["assets"]["coutwildrnp"]["href"] == src_path 23 | assert stac_item["links"] == [] 24 | assert stac_item["stac_extensions"] == [ 25 | "https://stac-extensions.github.io/projection/v1.1.0/schema.json", 26 | ] 27 | assert "datetime" in stac_item["properties"] 28 | assert "proj:epsg" in stac_item["properties"] 29 | -------------------------------------------------------------------------------- /tests/test_create_item.py: -------------------------------------------------------------------------------- 1 | """test create_stac_item functions.""" 2 | 3 | import datetime 4 | import os 5 | 6 | import pytest 7 | 8 | from fio_stac.stac import create_stac_item 9 | 10 | PREFIX = os.path.join(os.path.dirname(__file__), "fixtures") 11 | input_date = datetime.datetime.utcnow() 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "file", 16 | [ 17 | "!test.geojson", 18 | "collection-pp.txt", 19 | "collection.txt", 20 | "coutwildrnp.shp", 21 | "coutwildrnp.zip", 22 | "curves_line.csv", 23 | "example.topojson", 24 | "gre.shp", 25 | "grenada.geojson", 26 | "issue627.geojson", 27 | "sequence-pp.txt", 28 | "sequence.txt", 29 | "test_gpx.gpx", 30 | "test_tin.csv", 31 | "test_tin.shp", 32 | "test_tz.geojson", 33 | "testopenfilegdb.gdb.zip", 34 | ], 35 | ) 36 | def test_create_item(file): 37 | """Should run without exceptions.""" 38 | src_path = os.path.join(PREFIX, file) 39 | if src_path.endswith(".zip"): 40 | src_path = f"zip+file://{src_path}" 41 | 42 | assert create_stac_item( 43 | src_path, input_datetime=input_date, with_proj=False 44 | ).validate() 45 | --------------------------------------------------------------------------------