-
Notifications
You must be signed in to change notification settings - Fork 164
Custom tiles projection in WMTS #68
Comments
It looks really cool @daliborjanak. Great job! Thank you. Looking forward to review and test the implementation! |
Implementation is done (see PR). Tileserver can now serve tiles in custom projections. It excepts definition of tilematrixset in metadata JSON file. It is triggered when $crs = 'EPSG:5514';
$tile_size = [256, 256];
$extent = [-951499.37, -1276279.09, -159365.31, -983013.08];
$origin = [$extent[0], $extent[3]];
$pixel_size = [];
//constants
$StandardizedRenderingPixelSize = 0.00028; //defined in WMTS standart
$metersPerUnit = 1; //defined in proj def
/* Tile at zoom 0 */
// Coordinates always negative
$pixel_size[0] = abs(($extent[0] - $extent[2]) / $tile_size[0]);
echo 'Pixel size in M: ' . $pixel_size[0] . PHP_EOL;
// Scale denominator (derivated from WMTS equation:
// pixelSpan = scaleDenominator × 0.28 10 -3 / metersPerUnit(crs))
$scaleDenominator = ($pixel_size[0] * $metersPerUnit) / $StandardizedRenderingPixelSize;
echo 'ScaleDenominator: ' . $scaleDenominator . PHP_EOL; The metadata JSON schema example: {
"name": "swiss",
"version": "1.1.0",
"description": "",
"type": "overlay",
"format": "png",
"minzoom": "0",
"maxzoom": "5",
"bounds": [5.85379955, 45.73743083, 10.66445076, 47.92094704], // in WGS84
"scale": "1",
"profile": "custom",
"crs": "EPSG:2056",
"proj4": "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs ",
"extent": [2476632.56374451, 1066330.29363826, 2841065.95706109, 1312791.87866593], // in projected coords
"tile_matrix": [
{
"id": "0",
"tile_size": [256, 256],
"origin": [2476632.56374451, 1312791.87866593], //topleft corner of tilematrix
"extent": [2476632.56374451, 1066330.29363826, 2841065.95706109, 1312791.87866593],
"pixel_size": [1423.56794264, -1423.56794264], //size of pixel in projection units
"scale_denominator": 5084171.22372462 // def in OGC WMTS spec
},
{
"id": "1",
"tile_size": [256, 256],
"origin": [2476632.56374451, 1312791.87866593],
"extent": [2476632.56374451, 1066330.29363826, 2841065.95706109, 1312791.87866593],
"pixel_size": [711.78397132, -711.78397132],
"scale_denominator": 2542085.61186231
},
{
"id": "2",
"tile_size": [256, 256],
"origin": [2476632.56374451, 1312791.87866593],
"extent": [2476632.56374451, 1066330.29363826, 2841065.95706109, 1312791.87866593],
"pixel_size": [355.89198566, -355.89198566],
"scale_denominator": 1271042.80593115
}
...
]
} |
Really cool! Can we get this to wmts.maptiler.com please? |
Custom tiles branch merged to master in #71. Closing. If something is missing reopen. Thank you @daliborjanak |
Will be done in branch customtiles. Allow tileserver to use new metadata.json from MapTiler with informations about tilematrix set and serve it trought WMTS standart
The text was updated successfully, but these errors were encountered: