OGC vector tile source

This commit is contained in:
Tim Schaub
2021-08-29 15:34:29 -06:00
parent 791add0d73
commit 4099f60779
11 changed files with 1512 additions and 308 deletions

View File

@@ -0,0 +1,85 @@
{
"title" : "blueMarble",
"dataType" : "map",
"tileMatrixSetURI" : "http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad",
"tileMatrixSetDefinition" : "https://maps.ecere.com/ogcapi/tileMatrixSets/WebMercatorQuad",
"tileMatrixSetLimits" : [
{ "tileMatrix" : "0", "minTileRow" : 0, "maxTileRow" : 0, "minTileCol" : 0, "maxTileCol" : 0 },
{ "tileMatrix" : "1", "minTileRow" : 0, "maxTileRow" : 1, "minTileCol" : 0, "maxTileCol" : 1 },
{ "tileMatrix" : "2", "minTileRow" : 0, "maxTileRow" : 3, "minTileCol" : 0, "maxTileCol" : 3 },
{ "tileMatrix" : "3", "minTileRow" : 0, "maxTileRow" : 7, "minTileCol" : 0, "maxTileCol" : 7 },
{ "tileMatrix" : "4", "minTileRow" : 0, "maxTileRow" : 15, "minTileCol" : 0, "maxTileCol" : 15 },
{ "tileMatrix" : "5", "minTileRow" : 0, "maxTileRow" : 31, "minTileCol" : 0, "maxTileCol" : 31 },
{ "tileMatrix" : "6", "minTileRow" : 0, "maxTileRow" : 63, "minTileCol" : 0, "maxTileCol" : 63 },
{ "tileMatrix" : "7", "minTileRow" : 0, "maxTileRow" : 127, "minTileCol" : 0, "maxTileCol" : 127 },
{ "tileMatrix" : "8", "minTileRow" : 0, "maxTileRow" : 255, "minTileCol" : 0, "maxTileCol" : 255 },
{ "tileMatrix" : "9", "minTileRow" : 0, "maxTileRow" : 511, "minTileCol" : 0, "maxTileCol" : 511 }
],
"centerPoint" : {
"coordinates" : [
0,
0
],
"tileMatrix" : "4",
"scaleDenominator" : 34942641.501794859767,
"cellSize" : 9783.9396205025605
},
"links" : [
{
"rel" : "self",
"type" : "application/json",
"title" : "The JSON representation of the WebMercatorQuad map tileset for blueMarble",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad?f=json"
},
{
"rel" : "alternate",
"type" : "text/plain",
"title" : "The ECON representation of the WebMercatorQuad map tileset for blueMarble",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad?f=econ"
},
{
"rel" : "alternate",
"type" : "text/html",
"title" : "The HTML representation of the WebMercatorQuad map tileset for blueMarble",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad?=html"
},
{
"rel" : "alternate",
"type" : "application/json+tile",
"title" : "The TileJSON representation of the WebMercatorQuad map tileset for blueMarble",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad?f=tilejson"
},
{
"rel" : "http://www.opengis.net/def/rel/ogc/1.0/geodata",
"href" : "/ogcapi/collections/blueMarble"
},
{
"rel" : "item",
"type" : "application/vnd.gnosis-map-tile",
"title" : "WebMercatorQuad map tiles for blueMarble (as GNOSIS Map Tiles)",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.gmt",
"templated" : true
},
{
"rel" : "item",
"type" : "image/png",
"title" : "WebMercatorQuad map tiles for blueMarble (as PNG)",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.png",
"templated" : true
},
{
"rel" : "item",
"type" : "image/jpeg",
"title" : "WebMercatorQuad map tiles for blueMarble (as JPG)",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.jpg",
"templated" : true
},
{
"rel" : "item",
"type" : "image/tiff; application=geotiff",
"title" : "WebMercatorQuad map tiles for blueMarble (as GeoTIFF)",
"href" : "/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.tif",
"templated" : true
}
]
}

View File

@@ -0,0 +1,229 @@
{
"title" : "ne_10m_admin_0_countries",
"dataType" : "vector",
"tileMatrixSetURI" : "http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad",
"tileMatrixSetDefinition" : "https://maps.ecere.com/ogcapi/tileMatrixSets/WebMercatorQuad",
"tileMatrixSetLimits" : [
{ "tileMatrix" : "0", "minTileRow" : 0, "maxTileRow" : 0, "minTileCol" : 0, "maxTileCol" : 0 },
{ "tileMatrix" : "1", "minTileRow" : 0, "maxTileRow" : 1, "minTileCol" : 0, "maxTileCol" : 1 },
{ "tileMatrix" : "2", "minTileRow" : 0, "maxTileRow" : 3, "minTileCol" : 0, "maxTileCol" : 3 },
{ "tileMatrix" : "3", "minTileRow" : 0, "maxTileRow" : 7, "minTileCol" : 0, "maxTileCol" : 7 },
{ "tileMatrix" : "4", "minTileRow" : 0, "maxTileRow" : 15, "minTileCol" : 0, "maxTileCol" : 15 },
{ "tileMatrix" : "5", "minTileRow" : 0, "maxTileRow" : 31, "minTileCol" : 0, "maxTileCol" : 31 },
{ "tileMatrix" : "6", "minTileRow" : 0, "maxTileRow" : 63, "minTileCol" : 0, "maxTileCol" : 63 },
{ "tileMatrix" : "7", "minTileRow" : 0, "maxTileRow" : 127, "minTileCol" : 0, "maxTileCol" : 127 }
],
"layers" : [
{
"id" : "ne_10m_admin_0_countries",
"dataType" : "vector",
"geometryType" : "polygon",
"minScaleDenominator" : 4367830.1877243574709,
"minCellSize" : 1222.9924525628201,
"maxTileMatrix" : "7",
"links" : [
{
"rel" : "http://www.opengis.net/def/rel/ogc/1.0/geodata",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries"
}
],
"propertiesSchema" : {
"type" : "object",
"properties" : { "abbrev" : {
"type" : "string"
}, "abbrev_len" : {
"type" : "integer"
}, "adm0_a3" : {
"type" : "string"
}, "adm0_a3_is" : {
"type" : "string"
}, "adm0_a3_un" : {
"type" : "integer"
}, "adm0_a3_us" : {
"type" : "string"
}, "adm0_a3_wb" : {
"type" : "integer"
}, "adm0_dif" : {
"type" : "integer"
}, "admin" : {
"type" : "string"
}, "brk_a3" : {
"type" : "string"
}, "brk_diff" : {
"type" : "integer"
}, "brk_group" : {
"type" : "string"
}, "brk_name" : {
"type" : "string"
}, "continent" : {
"type" : "string"
}, "economy" : {
"type" : "string"
}, "featurecla" : {
"type" : "string"
}, "fips_10" : {
"type" : "string"
}, "formal_en" : {
"type" : "string"
}, "formal_fr" : {
"type" : "string"
}, "gdp_md_est" : {
"type" : "integer"
}, "gdp_year" : {
"type" : "integer"
}, "geou_dif" : {
"type" : "integer"
}, "geounit" : {
"type" : "string"
}, "gu_a3" : {
"type" : "string"
}, "homepart" : {
"type" : "integer"
}, "income_grp" : {
"type" : "string"
}, "iso_a2" : {
"type" : "string"
}, "iso_a3" : {
"type" : "string"
}, "iso_n3" : {
"type" : "string"
}, "labelrank" : {
"type" : "integer"
}, "lastcensus" : {
"type" : "integer"
}, "level" : {
"type" : "integer"
}, "long_len" : {
"type" : "integer"
}, "mapcolor13" : {
"type" : "integer"
}, "mapcolor7" : {
"type" : "integer"
}, "mapcolor8" : {
"type" : "integer"
}, "mapcolor9" : {
"type" : "integer"
}, "name" : {
"type" : "string"
}, "name_alt" : {
"type" : "string"
}, "name_len" : {
"type" : "integer"
}, "name_long" : {
"type" : "string"
}, "name_sort" : {
"type" : "string"
}, "note_adm0" : {
"type" : "string"
}, "note_brk" : {
"type" : "string"
}, "pop_est" : {
"type" : "integer"
}, "pop_year" : {
"type" : "integer"
}, "postal" : {
"type" : "string"
}, "region_un" : {
"type" : "string"
}, "region_wb" : {
"type" : "string"
}, "scalerank" : {
"type" : "integer"
}, "sov_a3" : {
"type" : "string"
}, "sovereignt" : {
"type" : "string"
}, "su_a3" : {
"type" : "string"
}, "su_dif" : {
"type" : "integer"
}, "subregion" : {
"type" : "string"
}, "subunit" : {
"type" : "string"
}, "tiny" : {
"type" : "integer"
}, "type" : {
"type" : "string"
}, "un_a3" : {
"type" : "string"
}, "wb_a2" : {
"type" : "string"
}, "wb_a3" : {
"type" : "string"
}, "wikipedia" : {
"type" : "integer"
}, "woe_id" : {
"type" : "integer"
} }
}
}
],
"centerPoint" : {
"coordinates" : [
0,
0.000102911832
],
"tileMatrix" : "4",
"scaleDenominator" : 34942641.501794859767,
"cellSize" : 9783.9396205025605
},
"links" : [
{
"rel" : "self",
"type" : "application/json",
"title" : "The JSON representation of the WebMercatorQuad vector tileset for NaturalEarth:cultural:ne_10m_admin_0_countries",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad?f=json"
},
{
"rel" : "alternate",
"type" : "text/plain",
"title" : "The ECON representation of the WebMercatorQuad vector tileset for NaturalEarth:cultural:ne_10m_admin_0_countries",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad?f=econ"
},
{
"rel" : "alternate",
"type" : "text/html",
"title" : "The HTML representation of the WebMercatorQuad vector tileset for NaturalEarth:cultural:ne_10m_admin_0_countries",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad?=html"
},
{
"rel" : "alternate",
"type" : "application/json+tile",
"title" : "The TileJSON representation of the WebMercatorQuad vector tileset for NaturalEarth:cultural:ne_10m_admin_0_countries",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad?f=tilejson"
},
{
"rel" : "http://www.opengis.net/def/rel/ogc/1.0/geodata",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries"
},
{
"rel" : "item",
"type" : "application/vnd.gnosis-map-tile",
"title" : "WebMercatorQuad vector tiles for NaturalEarth:cultural:ne_10m_admin_0_countries (as GNOSIS Map Tiles)",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.gmt",
"templated" : true
},
{
"rel" : "item",
"type" : "application/vnd.mapbox-vector-tile",
"title" : "WebMercatorQuad vector tiles for NaturalEarth:cultural:ne_10m_admin_0_countries (as Mapbox Vector Tiles)",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.mvt",
"templated" : true
},
{
"rel" : "item",
"type" : "application/geo+json",
"title" : "WebMercatorQuad vector tiles for NaturalEarth:cultural:ne_10m_admin_0_countries (as GeoJSON)",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.json",
"templated" : true
},
{
"rel" : "item",
"type" : "text/mapml",
"title" : "WebMercatorQuad vector tiles for NaturalEarth:cultural:ne_10m_admin_0_countries (as MapML)",
"href" : "/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.mapml",
"templated" : true
}
]
}

View File

@@ -0,0 +1,433 @@
{
"id" : "WebMercatorQuad",
"title" : "WebMercatorQuad",
"uri" : "http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad",
"crs" : "http://www.opengis.net/def/crs/EPSG/0/3857",
"orderedAxes" : [
"E",
"N"
],
"wellKnownScaleSet" : "http://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
"tileMatrices" : [
{
"id" : "0",
"scaleDenominator" : 559082264.0287177562714,
"cellSize" : 156543.033928040968,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 1,
"matrixHeight" : 1,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "1",
"scaleDenominator" : 279541132.0143588781357,
"cellSize" : 78271.516964020484,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 2,
"matrixHeight" : 2,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "2",
"scaleDenominator" : 139770566.0071794390678,
"cellSize" : 39135.758482010242,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 4,
"matrixHeight" : 4,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "3",
"scaleDenominator" : 69885283.0035897195339,
"cellSize" : 19567.879241005121,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 8,
"matrixHeight" : 8,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "4",
"scaleDenominator" : 34942641.501794859767,
"cellSize" : 9783.9396205025605,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 16,
"matrixHeight" : 16,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "5",
"scaleDenominator" : 17471320.7508974298835,
"cellSize" : 4891.9698102512803,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 32,
"matrixHeight" : 32,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "6",
"scaleDenominator" : 8735660.3754487149417,
"cellSize" : 2445.9849051256401,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 64,
"matrixHeight" : 64,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "7",
"scaleDenominator" : 4367830.1877243574709,
"cellSize" : 1222.9924525628201,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 128,
"matrixHeight" : 128,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "8",
"scaleDenominator" : 2183915.0938621787354,
"cellSize" : 611.49622628141,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 256,
"matrixHeight" : 256,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "9",
"scaleDenominator" : 1091957.5469310893677,
"cellSize" : 305.748113140705,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 512,
"matrixHeight" : 512,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "10",
"scaleDenominator" : 545978.7734655446839,
"cellSize" : 152.8740565703525,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 1024,
"matrixHeight" : 1024,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "11",
"scaleDenominator" : 272989.3867327723419,
"cellSize" : 76.4370282851763,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 2048,
"matrixHeight" : 2048,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "12",
"scaleDenominator" : 136494.693366386171,
"cellSize" : 38.2185141425881,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 4096,
"matrixHeight" : 4096,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "13",
"scaleDenominator" : 68247.3466831930855,
"cellSize" : 19.1092570712941,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 8192,
"matrixHeight" : 8192,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "14",
"scaleDenominator" : 34123.6733415965427,
"cellSize" : 9.554628535647,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 16384,
"matrixHeight" : 16384,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "15",
"scaleDenominator" : 17061.8366707982714,
"cellSize" : 4.7773142678235,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 32768,
"matrixHeight" : 32768,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "16",
"scaleDenominator" : 8530.9183353991357,
"cellSize" : 2.3886571339118,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 65536,
"matrixHeight" : 65536,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "17",
"scaleDenominator" : 4265.4591676995678,
"cellSize" : 1.1943285669559,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 131072,
"matrixHeight" : 131072,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "18",
"scaleDenominator" : 2132.7295838497839,
"cellSize" : 0.5971642834779,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 262144,
"matrixHeight" : 262144,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "19",
"scaleDenominator" : 1066.364791924892,
"cellSize" : 0.298582141739,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 524288,
"matrixHeight" : 524288,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "20",
"scaleDenominator" : 533.182395962446,
"cellSize" : 0.1492910708695,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 1048576,
"matrixHeight" : 1048576,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "21",
"scaleDenominator" : 266.591197981223,
"cellSize" : 0.0746455354347,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 2097152,
"matrixHeight" : 2097152,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "22",
"scaleDenominator" : 133.2955989906115,
"cellSize" : 0.0373227677174,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 4194304,
"matrixHeight" : 4194304,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "23",
"scaleDenominator" : 66.6477994953057,
"cellSize" : 0.0186613838587,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 8388608,
"matrixHeight" : 8388608,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "24",
"scaleDenominator" : 33.3238997476529,
"cellSize" : 0.0093306919293,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 16777216,
"matrixHeight" : 16777216,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "25",
"scaleDenominator" : 16.6619498738264,
"cellSize" : 0.0046653459647,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 33554432,
"matrixHeight" : 33554432,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "26",
"scaleDenominator" : 8.3309749369132,
"cellSize" : 0.0023326729823,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 67108864,
"matrixHeight" : 67108864,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "27",
"scaleDenominator" : 4.1654874684566,
"cellSize" : 0.0011663364912,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 134217728,
"matrixHeight" : 134217728,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "28",
"scaleDenominator" : 2.0827437342283,
"cellSize" : 0.0005831682456,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 268435456,
"matrixHeight" : 268435456,
"tileWidth" : 256,
"tileHeight" : 256
},
{
"id" : "29",
"scaleDenominator" : 1.0413718671142,
"cellSize" : 0.0002915841228,
"cornerOfOrigin" : "topLeft",
"pointOfOrigin" : [
-20037508.3427892439067,
20037508.3427892439067
],
"matrixWidth" : 536870912,
"matrixHeight" : 536870912,
"tileWidth" : 256,
"tileHeight" : 256
}
]
}

View File

@@ -0,0 +1,208 @@
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
import events from 'events';
import expect from '../../expect.js';
import fse from 'fs-extra';
import path from 'path';
import {fileURLToPath} from 'url';
import {
getMapTileUrlTemplate,
getTileSetInfo,
getVectorTileUrlTemplate,
} from '../../../../src/ol/source/ogcTileUtil.js';
import {overrideXHR, restoreXHR} from '../../../../src/ol/net.js';
function getDataDir() {
const modulePath = fileURLToPath(import.meta.url);
return path.join(path.dirname(modulePath), 'data');
}
let baseUrl;
class MockXHR extends events.EventEmitter {
addEventListener(type, listener) {
this.addListener(type, listener);
}
open(method, url) {
if (url.startsWith(baseUrl)) {
url = url.slice(baseUrl.length);
}
this.url = url;
}
setRequestHeader(key, value) {
// no-op
}
send() {
let url = path.resolve(getDataDir(), this.url);
if (!url.endsWith('.json')) {
url = url + '.json';
}
fse.readJSON(url).then(
(data) => {
this.status = 200;
this.responseText = JSON.stringify(data);
this.emit('load', {target: this});
},
(err) => {
console.error(err); // eslint-disable-line
this.emit('error', {target: this});
}
);
}
}
describe('ol/source/ogcTileUtil.js', () => {
describe('getTileSetInfo()', () => {
beforeEach(() => {
overrideXHR(MockXHR);
});
afterEach(() => {
baseUrl = '';
restoreXHR();
});
it('fetches and parses map tile info', async () => {
baseUrl = 'https://maps.ecere.com/';
const sourceInfo = {
url: 'https://maps.ecere.com/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad',
};
const tileInfo = await getTileSetInfo(sourceInfo);
expect(tileInfo).to.be.an(Object);
expect(tileInfo.urlTemplate).to.be(
'/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.jpg'
);
expect(tileInfo.grid).to.be.a(TileGrid);
expect(tileInfo.grid.getTileSize(0)).to.eql([256, 256]);
expect(tileInfo.grid.getResolutions()).to.have.length(30);
expect(tileInfo.urlFunction).to.be.a(Function);
expect(tileInfo.urlFunction([1, 2, 3])).to.be(
'https://maps.ecere.com/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/1/3/2.jpg'
);
});
it('allows preferred media type to be configured', async () => {
baseUrl = 'https://maps.ecere.com/';
const sourceInfo = {
url: 'https://maps.ecere.com/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad',
mediaType: 'image/png',
};
const tileInfo = await getTileSetInfo(sourceInfo);
expect(tileInfo).to.be.an(Object);
expect(tileInfo.urlTemplate).to.be(
'/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.png'
);
expect(tileInfo.urlFunction).to.be.a(Function);
expect(tileInfo.urlFunction([1, 2, 3])).to.be(
'https://maps.ecere.com/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/1/3/2.png'
);
});
it('fetches and parses vector tile info', async () => {
baseUrl = 'https://maps.ecere.com/';
const sourceInfo = {
url: 'https://maps.ecere.com/ogcapi/collections/ne_10m_admin_0_countries/tiles/WebMercatorQuad',
};
const tileInfo = await getTileSetInfo(sourceInfo);
expect(tileInfo).to.be.an(Object);
expect(tileInfo.urlTemplate).to.be(
'/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.json'
);
expect(tileInfo.grid).to.be.a(TileGrid);
expect(tileInfo.grid.getTileSize(0)).to.eql([256, 256]);
expect(tileInfo.grid.getResolutions()).to.have.length(30);
expect(tileInfo.urlFunction).to.be.a(Function);
expect(tileInfo.urlFunction([1, 2, 3])).to.be(
'https://maps.ecere.com/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/1/3/2.json'
);
});
it('allows preferred media type to be configured', async () => {
baseUrl = 'https://maps.ecere.com/';
const sourceInfo = {
url: 'https://maps.ecere.com/ogcapi/collections/ne_10m_admin_0_countries/tiles/WebMercatorQuad',
mediaType: 'application/vnd.mapbox-vector-tile',
};
const tileInfo = await getTileSetInfo(sourceInfo);
expect(tileInfo).to.be.an(Object);
expect(tileInfo.urlTemplate).to.be(
'/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.mvt'
);
expect(tileInfo.urlFunction).to.be.a(Function);
expect(tileInfo.urlFunction([1, 2, 3])).to.be(
'https://maps.ecere.com/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/1/3/2.mvt'
);
});
});
describe('getVectorTileUrlTemplate()', () => {
let links;
before(async () => {
const url = path.join(
getDataDir(),
'ogcapi/collections/ne_10m_admin_0_countries/tiles/WebMercatorQuad.json'
);
const tileSet = await fse.readJSON(url);
links = tileSet.links;
});
it('gets the last known vector type if the preferred media type is absent', () => {
const urlTemplate = getVectorTileUrlTemplate(links);
expect(urlTemplate).to.be(
'/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.json'
);
});
it('gets the preferred media type if given', () => {
const urlTemplate = getVectorTileUrlTemplate(
links,
'application/vnd.mapbox-vector-tile'
);
expect(urlTemplate).to.be(
'/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.mvt'
);
});
it('throws if it cannot find preferred media type or a known fallback', () => {
function call() {
getVectorTileUrlTemplate([], 'application/vnd.mapbox-vector-tile');
}
expect(call).to.throwException('Could not find "item" link');
});
});
describe('getMapTileUrlTemplate()', () => {
let links;
before(async () => {
const url = path.join(
getDataDir(),
'ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad.json'
);
const tileSet = await fse.readJSON(url);
links = tileSet.links;
});
it('gets the last known image type if the preferred media type is absent', () => {
const urlTemplate = getMapTileUrlTemplate(links);
expect(urlTemplate).to.be(
'/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.jpg'
);
});
it('gets the preferred media type if given', () => {
const urlTemplate = getMapTileUrlTemplate(links, 'image/png');
expect(urlTemplate).to.be(
'/ogcapi/collections/blueMarble/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}.png'
);
});
it('throws if it cannot find preferred media type or a known fallback', () => {
function call() {
getMapTileUrlTemplate([], 'image/png');
}
expect(call).to.throwException('Could not find "item" link');
});
});
});