Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from rasterio/gdal to pyproj #58

Merged
merged 16 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyproj only supports >=3.7


steps:
- uses: actions/checkout@v2
Expand All @@ -30,9 +30,9 @@ jobs:
- name: Run Tox
run: tox -e py

# Run pre-commit (only for python-3.7)
# Run pre-commit (only for python-3.8)
- name: run pre-commit
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
run: pre-commit run --all-files

- name: Upload Results
Expand All @@ -44,32 +44,8 @@ jobs:
name: ${{ matrix.platform }}-${{ matrix.tox-env }}
fail_ci_if_error: false

gdal:
needs: [tests]
runs-on: ubuntu-latest
strategy:
matrix:
# Rasterio 1.1.8 wheels come with GDAL 2
# Rasterio 1.2.3 wheels come with GDAL 3.2
rasterio-version: ["==1.1.8", ">=1.2"]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .["test"] rasterio${{ matrix.rasterio-version }}

- name: Run Test
run: python -m pytest --cov morecantile --cov-report term-missing --ignore=venv

publish:
needs: [tests, gdal]
needs: [tests]
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
steps:
Expand Down
11 changes: 10 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

## 3.0.0a0

* add `.rasterio_crs` properties to TMS for compatibility with rasterio (https://github.com/developmentseed/morecantile/pull/58)

**breaking changes**

* switch from rasterio to PyProj for CRS definition and projection transformation (https://github.com/developmentseed/morecantile/pull/58)
* remove python 3.6 supports (because of pyproj)


## 2.1.4 (2021-08-20)

* add **NZTM2000Quad** tile matrix set from LINZ (author @blacha, https://github.com/developmentseed/morecantile/pull/57)
Expand All @@ -20,7 +30,6 @@

* update `NZTM2000*` CRS uri from `https://www.opengis.net/def/crs/EPSG/0/2193` to `urn:ogc:def:crs:EPSG:2193` (https://github.com/developmentseed/morecantile/pull/61)


## 2.1.3 - Doesn't exists

## 2.1.2 (2021-05-18)
Expand Down
2 changes: 1 addition & 1 deletion morecantile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"""

__version__ = "2.1.4"
__version__ = "3.0.0a0"

from .commons import BoundingBox, Coords, Tile # noqa
from .defaults import tms # noqa
Expand Down
36 changes: 26 additions & 10 deletions morecantile/commons.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
"""Morecantile commons."""

from collections import OrderedDict, namedtuple
from typing import NamedTuple

from rasterio.coords import BoundingBox # noqa

_Tile = namedtuple("_Tile", ["x", "y", "z"])
_Coords = namedtuple("_Coords", ["x", "y"])
class BoundingBox(NamedTuple):
"""A xmin,ymin,xmax,ymax coordinates tuple.

Args:
left (number): min horizontal coordinate.
bottom (number):min vertical coordinate.
right (number): max horizontal coordinate.
top (number): max vertical coordinate.

Examples:
>>> BoundingBox(-180.0, -90.0, 180.0, 90.0)

"""

left: float
bottom: float
right: float
top: float


class Coords(_Coords):
class Coords(NamedTuple):
"""A x,y Coordinates pair.

Args:
Expand All @@ -20,11 +35,11 @@ class Coords(_Coords):

"""

def _asdict(self):
return OrderedDict(zip(self._fields, self))
x: float
y: float


class Tile(_Tile):
class Tile(NamedTuple):
"""TileMatrixSet X,Y,Z tile indices.

Args:
Expand All @@ -37,5 +52,6 @@ class Tile(_Tile):

"""

def _asdict(self):
return OrderedDict(zip(self._fields, self))
x: int
y: int
z: int
6 changes: 3 additions & 3 deletions morecantile/data/CanadianNAD83_LCC.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "CanadianNAD83_LCC",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/3978",
"crs": "urn:ogc:def:crs:EPSG::3978",
vincentsarago marked this conversation as resolved.
Show resolved Hide resolved
"lowerCorner": [
-7786476.885838887,
-5153821.09213678
Expand All @@ -14,7 +14,7 @@
7928343.534071138
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/3978",
"supportedCRS": "urn:ogc:def:crs:EPSG::3978",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -355,4 +355,4 @@
"matrixHeight": 2625811
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/EuropeanETRS89_LAEAQuad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "EuropeanETRS89_LAEAQuad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/3035",
"crs": "urn:ogc:def:crs:EPSG::3035",
"lowerCorner": [
1000000.0,
2000000.0
Expand All @@ -14,7 +14,7 @@
5500000.0
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/3035",
"supportedCRS": "urn:ogc:def:crs:EPSG::3035",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -225,4 +225,4 @@
"matrixHeight": 32768
}
]
}
}
4 changes: 2 additions & 2 deletions morecantile/data/LINZAntarticaMapTilegrid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "TileMatrixSetType",
"title": "LINZ Antarctic Map Tile Grid (Ross Sea Region)",
"identifier": "LINZAntarticaMapTilegrid",
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/5482",
"supportedCRS": "urn:ogc:def:crs:EPSG::5482",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -187,4 +187,4 @@
"matrixHeight": 3303
}
]
}
}
4 changes: 2 additions & 2 deletions morecantile/data/NZTM2000.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"title": "LINZ NZTM2000 Map Tile Grid",
"abstract": "See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",
"identifier": "NZTM2000",
"supportedCRS": "urn:ogc:def:crs:EPSG:2193",
"supportedCRS": "urn:ogc:def:crs:EPSG::2193",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "urn:ogc:def:crs:EPSG:2193",
"crs": "urn:ogc:def:crs:EPSG::2193",
"lowerCorner": [
3087000,
274000
Expand Down
4 changes: 2 additions & 2 deletions morecantile/data/NZTM2000Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"title": "LINZ NZTM2000Quad Map Tile Grid",
"abstract": "See https://github.com/linz/NZTM2000TileMatrixSet",
"identifier": "NZTM2000Quad",
"supportedCRS": "urn:ogc:def:crs:EPSG:2193",
"supportedCRS": "urn:ogc:def:crs:EPSG::2193",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "urn:ogc:def:crs:EPSG:2193",
"crs": "urn:ogc:def:crs:EPSG::2193",
"lowerCorner": [
419435.9938,
-3260586.7284
Expand Down
6 changes: 3 additions & 3 deletions morecantile/data/UPSAntarcticWGS84Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "UPSAntarcticWGS84Quad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/5042",
"crs": "urn:ogc:def:crs:EPSG::5042",
"lowerCorner": [
-14440759.350252,
-14440759.350252
Expand All @@ -14,7 +14,7 @@
18440759.350252
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/5042",
"supportedCRS": "urn:ogc:def:crs:EPSG::5042",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -342,4 +342,4 @@
"matrixHeight": 16777216
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/UPSArcticWGS84Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "UPSArcticWGS84Quad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/5041",
"crs": "urn:ogc:def:crs:EPSG::5041",
"lowerCorner": [
-14440759.350252,
-14440759.350252
Expand All @@ -14,7 +14,7 @@
18440759.350252
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/5041",
"supportedCRS": "urn:ogc:def:crs:EPSG::5041",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -342,4 +342,4 @@
"matrixHeight": 16777216
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/UTM31WGS84Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "UTM31WGS84Quad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/32631",
"crs": "urn:ogc:def:crs:EPSG::32631",
"lowerCorner": [
-9501965.72931276,
-20003931.4586255
Expand All @@ -14,7 +14,7 @@
20003931.4586255
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/32631",
"supportedCRS": "urn:ogc:def:crs:EPSG::32631",
"tileMatrix": [
{
"type": "TileMatrixType",
Expand Down Expand Up @@ -329,4 +329,4 @@
"matrixHeight": 16777216
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/WebMercatorQuad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "WebMercatorQuad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857",
"crs": "urn:ogc:def:crs:EPSG::3857",
"lowerCorner": [
-20037508.3427892,
-20037508.3427892
Expand All @@ -14,7 +14,7 @@
20037508.3427892
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/3857",
"supportedCRS": "urn:ogc:def:crs:EPSG::3857",
"wellKnownScaleSet": "http://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
"tileMatrix": [
{
Expand Down Expand Up @@ -343,4 +343,4 @@
"matrixHeight": 16777216
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/WorldCRS84Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "WorldCRS84Quad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84",
vincentsarago marked this conversation as resolved.
Show resolved Hide resolved
"crs": "urn:ogc:def:crs:OGC::CRS84",
"lowerCorner": [
-180,
-90
Expand All @@ -14,7 +14,7 @@
90
]
},
"supportedCRS": "http://www.opengis.net/def/crs/OGC/1.3/CRS84",
"supportedCRS": "urn:ogc:def:crs:OGC::CRS84",
"wellKnownScaleSet": "http://www.opengis.net/def/wkss/OGC/1.0/GoogleCRS84Quad",
"tileMatrix": [
{
Expand Down Expand Up @@ -252,4 +252,4 @@
"matrixHeight": 131072
}
]
}
}
6 changes: 3 additions & 3 deletions morecantile/data/WorldMercatorWGS84Quad.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "WorldMercatorWGS84Quad",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "http://www.opengis.net/def/crs/EPSG/0/3395",
"crs": "urn:ogc:def:crs:EPSG::3395",
"lowerCorner": [
-20037508.3427892,
-20037508.3427892
Expand All @@ -14,7 +14,7 @@
20037508.3427892
]
},
"supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/3395",
"supportedCRS": "urn:ogc:def:crs:EPSG::3395",
"wellKnownScaleSet": "http://www.opengis.net/def/wkss/OGC/1.0/WorldMercatorWGS84",
"tileMatrix": [
{
Expand Down Expand Up @@ -252,4 +252,4 @@
"matrixHeight": 131072
}
]
}
}
Loading