Skip to content

Commit

Permalink
Merge pull request #57 from blacha/nztm2000quad
Browse files Browse the repository at this point in the history
add NZTM2000Quad tile matrix set
  • Loading branch information
vincentsarago authored Aug 20, 2021
2 parents 3c3ca1d + f90cbc1 commit 1c92874
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ $ pip install git+https://github.com/developmentseed/morecantile.git
- **EuropeanETRS89_LAEAQuad**: ETRS89-extended / LAEA Europe - EPGS:3035
- **LINZAntarticaMapTilegrid**: LINZ Antarctic Map Tile Grid (Ross Sea Region) - EPSG:5482
- **NZTM2000**: LINZ NZTM2000 Map Tile Grid - EPSG:2193
- **NZTM2000Quad**: LINZ NZTM2000 Map Tile Grid - EPSG:2193
- **UPSAntarcticWGS84Quad**: Universal Polar Stereographic WGS 84 Quad for Antarctic - EPSG:5042
- **UPSArcticWGS84Quad**: Universal Polar Stereographic WGS 84 Quad for Arctic - EPSG:5041
- **UTM31WGS84Quad**: Example of UTM grid - EPSG:32631
Expand Down
3 changes: 3 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Options:
- CanadianNAD83_LCC
- UPSArcticWGS84Quad
- NZTM2000
- NZTM2000Quad
- UTM31WGS84Quad
- UPSAntarcticWGS84Quad
- WorldMercatorWGS84Quad
Expand Down Expand Up @@ -91,6 +92,7 @@ Options:
- CanadianNAD83_LCC
- UPSArcticWGS84Quad
- NZTM2000
- NZTM2000Quad
- UTM31WGS84Quad
- UPSAntarcticWGS84Quad
- WorldMercatorWGS84Quad
Expand Down Expand Up @@ -149,6 +151,7 @@ Options:
- CanadianNAD83_LCC
- UPSArcticWGS84Quad
- NZTM2000
- NZTM2000Quad
- UTM31WGS84Quad
- UPSAntarcticWGS84Quad
- WorldMercatorWGS84Quad
Expand Down
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ print(morecantile.tms.list())
'CanadianNAD83_LCC',
'UPSArcticWGS84Quad',
'NZTM2000',
'NZTM2000Quad',
'UTM31WGS84Quad',
'UPSAntarcticWGS84Quad',
'WorldMercatorWGS84Quad',
Expand Down
307 changes: 307 additions & 0 deletions morecantile/data/NZTM2000Quad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
{
"type": "TileMatrixSetType",
"title": "LINZ NZTM2000Quad Map Tile Grid",
"abstract": "See https://github.com/linz/NZTM2000TileMatrixSet",
"identifier": "NZTM2000Quad",
"supportedCRS": "https://www.opengis.net/def/crs/EPSG/0/2193",
"boundingBox": {
"type": "BoundingBoxType",
"crs": "https://www.opengis.net/def/crs/EPSG/0/2193",
"lowerCorner": [
419435.9938,
-3260586.7284
],
"upperCorner": [
10438190.1652,
6758167.443
]
},
"tileMatrix": [
{
"type": "TileMatrixType",
"identifier": "0",
"scaleDenominator": 139770566.007179,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 1,
"matrixHeight": 1
},
{
"type": "TileMatrixType",
"identifier": "1",
"scaleDenominator": 69885283.0035895,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 2,
"matrixHeight": 2
},
{
"type": "TileMatrixType",
"identifier": "2",
"scaleDenominator": 34942641.50179475,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 4,
"matrixHeight": 4
},
{
"type": "TileMatrixType",
"identifier": "3",
"scaleDenominator": 17471320.750897374,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 8,
"matrixHeight": 8
},
{
"type": "TileMatrixType",
"identifier": "4",
"scaleDenominator": 8735660.375448687,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 16,
"matrixHeight": 16
},
{
"type": "TileMatrixType",
"identifier": "5",
"scaleDenominator": 4367830.1877243435,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 32,
"matrixHeight": 32
},
{
"type": "TileMatrixType",
"identifier": "6",
"scaleDenominator": 2183915.0938621718,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 64,
"matrixHeight": 64
},
{
"type": "TileMatrixType",
"identifier": "7",
"scaleDenominator": 1091957.5469310859,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 128,
"matrixHeight": 128
},
{
"type": "TileMatrixType",
"identifier": "8",
"scaleDenominator": 545978.7734655429,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 256,
"matrixHeight": 256
},
{
"type": "TileMatrixType",
"identifier": "9",
"scaleDenominator": 272989.38673277147,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 512,
"matrixHeight": 512
},
{
"type": "TileMatrixType",
"identifier": "10",
"scaleDenominator": 136494.69336638573,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 1024,
"matrixHeight": 1024
},
{
"type": "TileMatrixType",
"identifier": "11",
"scaleDenominator": 68247.34668319287,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 2048,
"matrixHeight": 2048
},
{
"type": "TileMatrixType",
"identifier": "12",
"scaleDenominator": 34123.67334159643,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 4096,
"matrixHeight": 4096
},
{
"type": "TileMatrixType",
"identifier": "13",
"scaleDenominator": 17061.836670798217,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 8192,
"matrixHeight": 8192
},
{
"type": "TileMatrixType",
"identifier": "14",
"scaleDenominator": 8530.918335399108,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 16384,
"matrixHeight": 16384
},
{
"type": "TileMatrixType",
"identifier": "15",
"scaleDenominator": 4265.459167699554,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 32768,
"matrixHeight": 32768
},
{
"type": "TileMatrixType",
"identifier": "16",
"scaleDenominator": 2132.729583849777,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 65536,
"matrixHeight": 65536
},
{
"type": "TileMatrixType",
"identifier": "17",
"scaleDenominator": 1066.3647919248886,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 131072,
"matrixHeight": 131072
},
{
"type": "TileMatrixType",
"identifier": "18",
"scaleDenominator": 533.1823959624443,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 262144,
"matrixHeight": 262144
},
{
"type": "TileMatrixType",
"identifier": "19",
"scaleDenominator": 266.59119798122214,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 524288,
"matrixHeight": 524288
},
{
"type": "TileMatrixType",
"identifier": "20",
"scaleDenominator": 133.29559899061107,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 1048576,
"matrixHeight": 1048576
},
{
"type": "TileMatrixType",
"identifier": "21",
"scaleDenominator": 66.64779949530553,
"topLeftCorner": [
10438190.1652,
-3260586.7284
],
"tileWidth": 256,
"tileHeight": 256,
"matrixWidth": 2097152,
"matrixHeight": 2097152
}
]
}
25 changes: 25 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,31 @@ def test_custom_tms_bounds_user_crs():
assert custom_tms.bounds(0, 0, 0) == (-120, 30, -110, 40)


def test_nztm_quad_is_quad():
tms = morecantile.tms.get("NZTM2000Quad")
bound = tms.xy_bounds(morecantile.Tile(0, 0, 0))
expected = (-3260586.7284, 419435.9938, 6758167.443, 10438190.1652)
for a, b in zip(expected, bound):
assert round(a - b, 4) == 0


# NZTM2000Quad should use all the WebMercatorQuad zoom scales
def test_nztm_quad_scales():
nztm_tms = morecantile.tms.get("NZTM2000Quad")
google_tms = morecantile.tms.get("WebMercatorQuad")
print(dir(google_tms))

for z in range(2, nztm_tms.maxzoom + 2):
assert (
round(
google_tms.matrix(z).scaleDenominator
- nztm_tms.matrix(z - 2).scaleDenominator,
4,
)
== 0
)


def test_InvertedLatLonGrids():
"""Check Inverted LatLon grids."""
tms = morecantile.tms.get("NZTM2000")
Expand Down
Loading

0 comments on commit 1c92874

Please sign in to comment.