Add support for 512 sized raster tiles (#1)
* Enable setting tilesize for raster tiles * Serve correct endpoint for raster tiles * Add 256 & 512 sized raster layers to wmts getCapabilities document * Update wmts getCapabilities tileMatrixSets * Add rendered tiles format for getTileUrls method * Update endpoints documentation
This commit is contained in:
parent
6ff4cae9b9
commit
a4800aa226
5 changed files with 407 additions and 25 deletions
|
|
@ -13,10 +13,11 @@ Styles
|
||||||
|
|
||||||
Rendered tiles
|
Rendered tiles
|
||||||
==============
|
==============
|
||||||
* Rendered tiles are served at ``/styles/{id}/{z}/{x}/{y}[@2x].{format}``
|
* Rendered tiles are served at ``/styles/{id}/{tileSize}/{z}/{x}/{y}[@2x].{format}``
|
||||||
|
|
||||||
* The optional ``@2x`` (or ``@3x``, ``@4x``) part can be used to render HiDPI (retina) tiles
|
* The optional ``@2x`` (or ``@3x``, ``@4x``) part can be used to render HiDPI (retina) tiles
|
||||||
* Available formats: ``png``, ``jpg`` (``jpeg``), ``webp``
|
* Available formats: ``png``, ``jpg`` (``jpeg``), ``webp``
|
||||||
|
* Tile sizes: ``256``, ``512``
|
||||||
* TileJSON at ``/styles/{id}.json``
|
* TileJSON at ``/styles/{id}.json``
|
||||||
|
|
||||||
* The rendered tiles are not available in the ``tileserver-gl-light`` version.
|
* The rendered tiles are not available in the ``tileserver-gl-light`` version.
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@
|
||||||
</ows:Operation>
|
</ows:Operation>
|
||||||
</ows:OperationsMetadata>
|
</ows:OperationsMetadata>
|
||||||
<Contents>
|
<Contents>
|
||||||
<Layer>
|
<Layer>
|
||||||
<ows:Title>{{name}}</ows:Title>
|
<ows:Title>{{name}}-256</ows:Title>
|
||||||
<ows:Identifier>{{id}}</ows:Identifier>
|
<ows:Identifier>{{id}}</ows:Identifier>
|
||||||
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
|
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
|
||||||
<ows:LowerCorner>-180 -85.051128779807</ows:LowerCorner>
|
<ows:LowerCorner>-180 -85.051128779807</ows:LowerCorner>
|
||||||
|
|
@ -48,13 +48,30 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Format>image/png</Format>
|
<Format>image/png</Format>
|
||||||
<TileMatrixSetLink>
|
<TileMatrixSetLink>
|
||||||
<TileMatrixSet>GoogleMapsCompatible</TileMatrixSet>
|
<TileMatrixSet>GoogleMapsCompatible_256</TileMatrixSet>
|
||||||
</TileMatrixSetLink>
|
</TileMatrixSetLink>
|
||||||
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/styles/{{id}}/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/styles/{{id}}/256/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
||||||
</Layer><TileMatrixSet>
|
</Layer>
|
||||||
<ows:Title>GoogleMapsCompatible</ows:Title>
|
<Layer>
|
||||||
<ows:Abstract>GoogleMapsCompatible EPSG:3857</ows:Abstract>
|
<ows:Title>{{name}}-512</ows:Title>
|
||||||
<ows:Identifier>GoogleMapsCompatible</ows:Identifier>
|
<ows:Identifier>{{id}}</ows:Identifier>
|
||||||
|
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
|
||||||
|
<ows:LowerCorner>-180 -85.051128779807</ows:LowerCorner>
|
||||||
|
<ows:UpperCorner>180 85.051128779807</ows:UpperCorner>
|
||||||
|
</ows:WGS84BoundingBox>
|
||||||
|
<Style isDefault="true">
|
||||||
|
<ows:Identifier>default</ows:Identifier>
|
||||||
|
</Style>
|
||||||
|
<Format>image/png</Format>
|
||||||
|
<TileMatrixSetLink>
|
||||||
|
<TileMatrixSet>GoogleMapsCompatible_512</TileMatrixSet>
|
||||||
|
</TileMatrixSetLink>
|
||||||
|
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/styles/{{id}}/512/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
||||||
|
</Layer>
|
||||||
|
<TileMatrixSet>
|
||||||
|
<ows:Title>GoogleMapsCompatible_256</ows:Title>
|
||||||
|
<ows:Abstract>GoogleMapsCompatible_256 EPSG:3857</ows:Abstract>
|
||||||
|
<ows:Identifier>GoogleMapsCompatible_256</ows:Identifier>
|
||||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::3857</ows:SupportedCRS>
|
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::3857</ows:SupportedCRS>
|
||||||
<TileMatrix>
|
<TileMatrix>
|
||||||
<ows:Identifier>0</ows:Identifier>
|
<ows:Identifier>0</ows:Identifier>
|
||||||
|
|
@ -226,10 +243,189 @@
|
||||||
<TileHeight>256</TileHeight>
|
<TileHeight>256</TileHeight>
|
||||||
<MatrixWidth>262144</MatrixWidth>
|
<MatrixWidth>262144</MatrixWidth>
|
||||||
<MatrixHeight>262144</MatrixHeight>
|
<MatrixHeight>262144</MatrixHeight>
|
||||||
</TileMatrix></TileMatrixSet><TileMatrixSet>
|
</TileMatrix>
|
||||||
<ows:Title>WGS84</ows:Title>
|
</TileMatrixSet>
|
||||||
<ows:Abstract>WGS84 EPSG:4326</ows:Abstract>
|
<TileMatrixSet>
|
||||||
<ows:Identifier>WGS84</ows:Identifier>
|
<ows:Title>GoogleMapsCompatible_512</ows:Title>
|
||||||
|
<ows:Abstract>GoogleMapsCompatible_512 EPSG:3857</ows:Abstract>
|
||||||
|
<ows:Identifier>GoogleMapsCompatible_512</ows:Identifier>
|
||||||
|
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::3857</ows:SupportedCRS>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>0</ows:Identifier>
|
||||||
|
<ScaleDenominator>279541132.0143589</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>1</MatrixWidth>
|
||||||
|
<MatrixHeight>1</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>1</ows:Identifier>
|
||||||
|
<ScaleDenominator>139770566.0071794</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>2</MatrixWidth>
|
||||||
|
<MatrixHeight>2</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>2</ows:Identifier>
|
||||||
|
<ScaleDenominator>69885283.00358972</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>4</MatrixWidth>
|
||||||
|
<MatrixHeight>4</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>3</ows:Identifier>
|
||||||
|
<ScaleDenominator>34942641.501795</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>8</MatrixWidth>
|
||||||
|
<MatrixHeight>8</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>4</ows:Identifier>
|
||||||
|
<ScaleDenominator>17471320.750897</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>16</MatrixWidth>
|
||||||
|
<MatrixHeight>16</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>5</ows:Identifier>
|
||||||
|
<ScaleDenominator>8735660.3754487</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>32</MatrixWidth>
|
||||||
|
<MatrixHeight>32</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>6</ows:Identifier>
|
||||||
|
<ScaleDenominator>4367830.1877244</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>64</MatrixWidth>
|
||||||
|
<MatrixHeight>64</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>7</ows:Identifier>
|
||||||
|
<ScaleDenominator>2183915.0938622</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>128</MatrixWidth>
|
||||||
|
<MatrixHeight>128</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>8</ows:Identifier>
|
||||||
|
<ScaleDenominator>1091957.5469311</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>256</MatrixWidth>
|
||||||
|
<MatrixHeight>256</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>9</ows:Identifier>
|
||||||
|
<ScaleDenominator>545978.77346554</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>512</MatrixWidth>
|
||||||
|
<MatrixHeight>512</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>10</ows:Identifier>
|
||||||
|
<ScaleDenominator>272989.38673277</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>1024</MatrixWidth>
|
||||||
|
<MatrixHeight>1024</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>11</ows:Identifier>
|
||||||
|
<ScaleDenominator>136494.69336639</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>2048</MatrixWidth>
|
||||||
|
<MatrixHeight>2048</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>12</ows:Identifier>
|
||||||
|
<ScaleDenominator>68247.346683193</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>4096</MatrixWidth>
|
||||||
|
<MatrixHeight>4096</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>13</ows:Identifier>
|
||||||
|
<ScaleDenominator>34123.673341597</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>8192</MatrixWidth>
|
||||||
|
<MatrixHeight>8192</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>14</ows:Identifier>
|
||||||
|
<ScaleDenominator>17061.836670798</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>16384</MatrixWidth>
|
||||||
|
<MatrixHeight>16384</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>15</ows:Identifier>
|
||||||
|
<ScaleDenominator>8530.9183353991</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>32768</MatrixWidth>
|
||||||
|
<MatrixHeight>32768</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>16</ows:Identifier>
|
||||||
|
<ScaleDenominator>4265.4591676996</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>65536</MatrixWidth>
|
||||||
|
<MatrixHeight>65536</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>17</ows:Identifier>
|
||||||
|
<ScaleDenominator>2132.7295838498</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>131072</MatrixWidth>
|
||||||
|
<MatrixHeight>131072</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>18</ows:Identifier>
|
||||||
|
<ScaleDenominator>1066.364791924892</ScaleDenominator>
|
||||||
|
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>262144</MatrixWidth>
|
||||||
|
<MatrixHeight>262144</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
</TileMatrixSet>
|
||||||
|
<TileMatrixSet>
|
||||||
|
<ows:Title>WGS84_256</ows:Title>
|
||||||
|
<ows:Abstract>WGS84_256 EPSG:4326</ows:Abstract>
|
||||||
|
<ows:Identifier>WGS84_256</ows:Identifier>
|
||||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4326</ows:SupportedCRS>
|
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4326</ows:SupportedCRS>
|
||||||
<TileMatrix>
|
<TileMatrix>
|
||||||
<ows:Identifier>0</ows:Identifier>
|
<ows:Identifier>0</ows:Identifier>
|
||||||
|
|
@ -401,7 +597,185 @@
|
||||||
<TileHeight>256</TileHeight>
|
<TileHeight>256</TileHeight>
|
||||||
<MatrixWidth>524288</MatrixWidth>
|
<MatrixWidth>524288</MatrixWidth>
|
||||||
<MatrixHeight>262144</MatrixHeight>
|
<MatrixHeight>262144</MatrixHeight>
|
||||||
</TileMatrix></TileMatrixSet>
|
</TileMatrix>
|
||||||
|
</TileMatrixSet>
|
||||||
|
<TileMatrixSet>
|
||||||
|
<ows:Title>WGS84_512</ows:Title>
|
||||||
|
<ows:Abstract>WGS84_512 EPSG:4326</ows:Abstract>
|
||||||
|
<ows:Identifier>WGS84_512</ows:Identifier>
|
||||||
|
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4326</ows:SupportedCRS>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>0</ows:Identifier>
|
||||||
|
<ScaleDenominator>139770566.00718</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>2</MatrixWidth>
|
||||||
|
<MatrixHeight>1</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>1</ows:Identifier>
|
||||||
|
<ScaleDenominator>69885283.00359</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>4</MatrixWidth>
|
||||||
|
<MatrixHeight>2</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>2</ows:Identifier>
|
||||||
|
<ScaleDenominator>34942641.501795</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>8</MatrixWidth>
|
||||||
|
<MatrixHeight>4</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>3</ows:Identifier>
|
||||||
|
<ScaleDenominator>17471320.750897</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>16</MatrixWidth>
|
||||||
|
<MatrixHeight>8</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>4</ows:Identifier>
|
||||||
|
<ScaleDenominator>8735660.3754487</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>32</MatrixWidth>
|
||||||
|
<MatrixHeight>16</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>5</ows:Identifier>
|
||||||
|
<ScaleDenominator>4367830.1877244</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>64</MatrixWidth>
|
||||||
|
<MatrixHeight>32</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>6</ows:Identifier>
|
||||||
|
<ScaleDenominator>2183915.0938622</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>128</MatrixWidth>
|
||||||
|
<MatrixHeight>64</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>7</ows:Identifier>
|
||||||
|
<ScaleDenominator>1091957.5469311</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>256</MatrixWidth>
|
||||||
|
<MatrixHeight>128</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>8</ows:Identifier>
|
||||||
|
<ScaleDenominator>545978.77346554</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>512</MatrixWidth>
|
||||||
|
<MatrixHeight>256</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>9</ows:Identifier>
|
||||||
|
<ScaleDenominator>272989.38673277</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>1024</MatrixWidth>
|
||||||
|
<MatrixHeight>512</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>10</ows:Identifier>
|
||||||
|
<ScaleDenominator>136494.69336639</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>2048</MatrixWidth>
|
||||||
|
<MatrixHeight>1024</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>11</ows:Identifier>
|
||||||
|
<ScaleDenominator>68247.346683193</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>4096</MatrixWidth>
|
||||||
|
<MatrixHeight>2048</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>12</ows:Identifier>
|
||||||
|
<ScaleDenominator>34123.673341597</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>8192</MatrixWidth>
|
||||||
|
<MatrixHeight>4096</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>13</ows:Identifier>
|
||||||
|
<ScaleDenominator>17061.836670798</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>16384</MatrixWidth>
|
||||||
|
<MatrixHeight>8192</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>14</ows:Identifier>
|
||||||
|
<ScaleDenominator>8530.9183353991</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>32768</MatrixWidth>
|
||||||
|
<MatrixHeight>16384</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>15</ows:Identifier>
|
||||||
|
<ScaleDenominator>4265.4591676996</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>65536</MatrixWidth>
|
||||||
|
<MatrixHeight>32768</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>16</ows:Identifier>
|
||||||
|
<ScaleDenominator>2132.7295838498</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>131072</MatrixWidth>
|
||||||
|
<MatrixHeight>65536</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>17</ows:Identifier>
|
||||||
|
<ScaleDenominator>1066.3647919249</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>262144</MatrixWidth>
|
||||||
|
<MatrixHeight>131072</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
<TileMatrix>
|
||||||
|
<ows:Identifier>18</ows:Identifier>
|
||||||
|
<ScaleDenominator>533.182</ScaleDenominator>
|
||||||
|
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||||
|
<TileWidth>512</TileWidth>
|
||||||
|
<TileHeight>512</TileHeight>
|
||||||
|
<MatrixWidth>524288</MatrixWidth>
|
||||||
|
<MatrixHeight>262144</MatrixHeight>
|
||||||
|
</TileMatrix>
|
||||||
|
</TileMatrixSet>
|
||||||
</Contents>
|
</Contents>
|
||||||
<ServiceMetadataURL xlink:href="{{baseUrl}}/wmts/{{id}}/"/>
|
<ServiceMetadataURL xlink:href="{{baseUrl}}/wmts/{{id}}/"/>
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ module.exports = {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.get(`/:id/:z(\\d+)/:x(\\d+)/:y(\\d+):scale(${scalePattern})?.:format([\\w]+)`, (req, res, next) => {
|
app.get(`/:id/:tileSize(256|512)/:z(\\d+)/:x(\\d+)/:y(\\d+):scale(${scalePattern})?.:format([\\w]+)`, (req, res, next) => {
|
||||||
const item = repo[req.params.id];
|
const item = repo[req.params.id];
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
|
|
@ -373,16 +373,19 @@ module.exports = {
|
||||||
x = req.params.x | 0,
|
x = req.params.x | 0,
|
||||||
y = req.params.y | 0,
|
y = req.params.y | 0,
|
||||||
scale = getScale(req.params.scale),
|
scale = getScale(req.params.scale),
|
||||||
format = req.params.format;
|
format = req.params.format,
|
||||||
|
tileSize = parseInt(req.params.tileSize, 10) || 256;
|
||||||
|
|
||||||
if (z < 0 || x < 0 || y < 0 ||
|
if (z < 0 || x < 0 || y < 0 ||
|
||||||
z > 22 || x >= Math.pow(2, z) || y >= Math.pow(2, z)) {
|
z > 22 || x >= Math.pow(2, z) || y >= Math.pow(2, z)) {
|
||||||
return res.status(404).send('Out of bounds');
|
return res.status(404).send('Out of bounds');
|
||||||
}
|
};
|
||||||
const tileSize = 256;
|
|
||||||
const tileCenter = mercator.ll([
|
const tileCenter = mercator.ll([
|
||||||
((x + 0.5) / (1 << z)) * (256 << z),
|
((x + 0.5) / (1 << z)) * (tileSize << z),
|
||||||
((y + 0.5) / (1 << z)) * (256 << z)
|
((y + 0.5) / (1 << z)) * (tileSize << z)
|
||||||
], z);
|
], z);
|
||||||
|
|
||||||
return respondImage(item, z, tileCenter[0], tileCenter[1], 0, 0,
|
return respondImage(item, z, tileCenter[0], tileCenter[1], 0, 0,
|
||||||
tileSize, tileSize, scale, format, res, next);
|
tileSize, tileSize, scale, format, res, next);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,8 @@ function start(opts) {
|
||||||
style.viewer_hash = `#${center[2]}/${center[1].toFixed(5)}/${center[0].toFixed(5)}`;
|
style.viewer_hash = `#${center[2]}/${center[1].toFixed(5)}/${center[0].toFixed(5)}`;
|
||||||
|
|
||||||
const centerPx = mercator.px([center[0], center[1]], center[2]);
|
const centerPx = mercator.px([center[0], center[1]], center[2]);
|
||||||
style.thumbnail = `${center[2]}/${Math.floor(centerPx[0] / 256)}/${Math.floor(centerPx[1] / 256)}.png`;
|
// Set thumbnail default size to be 256px x 256px
|
||||||
|
style.thumbnail = `256/${center[2]}/${Math.floor(centerPx[0] / 256)}/${Math.floor(centerPx[1] / 256)}.png`;
|
||||||
}
|
}
|
||||||
|
|
||||||
style.xyz_link = utils.getTileUrls(
|
style.xyz_link = utils.getTileUrls(
|
||||||
|
|
|
||||||
11
src/utils.js
11
src/utils.js
|
|
@ -6,11 +6,9 @@ const fs = require('fs');
|
||||||
const clone = require('clone');
|
const clone = require('clone');
|
||||||
const glyphCompose = require('@mapbox/glyph-pbf-composite');
|
const glyphCompose = require('@mapbox/glyph-pbf-composite');
|
||||||
|
|
||||||
|
|
||||||
module.exports.getPublicUrl = (publicUrl, req) => publicUrl || `${req.protocol}://${req.headers.host}/`;
|
module.exports.getPublicUrl = (publicUrl, req) => publicUrl || `${req.protocol}://${req.headers.host}/`;
|
||||||
|
|
||||||
module.exports.getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
|
module.exports.getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
|
||||||
|
|
||||||
if (domains) {
|
if (domains) {
|
||||||
if (domains.constructor === String && domains.length > 0) {
|
if (domains.constructor === String && domains.length > 0) {
|
||||||
domains = domains.split(',');
|
domains = domains.split(',');
|
||||||
|
|
@ -51,13 +49,18 @@ module.exports.getTileUrls = (req, domains, path, format, publicUrl, aliases) =>
|
||||||
format = aliases[format];
|
format = aliases[format];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tileParams = '{z}/{x}/{y}';
|
||||||
|
if (['png', 'jpg', 'jpeg', 'webp'].includes(format)) {
|
||||||
|
tileParams = '256/{z}/{x}/{y}';
|
||||||
|
}
|
||||||
|
|
||||||
const uris = [];
|
const uris = [];
|
||||||
if (!publicUrl) {
|
if (!publicUrl) {
|
||||||
for (const domain of domains) {
|
for (const domain of domains) {
|
||||||
uris.push(`${req.protocol}://${domain}/${path}/{z}/{x}/{y}.${format}${query}`);
|
uris.push(`${req.protocol}://${domain}/${path}/${tileParams}.${format}${query}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uris.push(`${publicUrl}${path}/{z}/{x}/{y}.${format}${query}`)
|
uris.push(`${publicUrl}${path}/${tileParams}.${format}${query}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return uris;
|
return uris;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue