diff --git a/examples/data/WMTSCapabilities.xml b/examples/data/WMTSCapabilities.xml index 8d8ed8c846..8de4d7ff30 100644 --- a/examples/data/WMTSCapabilities.xml +++ b/examples/data/WMTSCapabilities.xml @@ -1,36 +1,20 @@ - - + - Web Map Tile Service - GeoWebCache + Koordinates Labs OGC WMTS 1.0.0 - http://sdi.georchestra.org/geoserver/gwc/service/wmts - - - GeoWebCache User - + Koordinates + + - - - - KVP - - - - - - - - - - + KVP @@ -43,7 +27,7 @@ - + KVP @@ -56,2302 +40,240 @@ - Ocean Bottom - Blended depth colors and relief shading of the ocean bottom derived from CleanTOPO2 data. The ocean color extends beneath land areas as a flat tint—mask it with the 10m Natural Earth vector shoreline, or a shoreline from another data source. - - -179.99999999999986 -60.002328474493446 - 179.98782010582556 60.000000000002935 + New Zealand Earthquakes + Historical earthquake data, accessed via the [GeoNet WFS feed](http://info.geonet.org.nz/display/appdata/Advanced+Queries). The data has been filtered to only include quakes in proximity to New Zealand with an `eventtype` of "Earthquake" or "none" per the [GeoNet catalogue](http://info.geonet.org.nz/display/appdata/Catalogue+Output). Most fields have been removed. Please also note the excluded data per this [GeoNet page](http://info.geonet.org.nz/display/appdata/The+Gap). We acknowledge the New Zealand GeoNet project and its sponsors EQC, GNS Science and LINZ, for providing data used in this layer. + layer-7328 + + -20037508.342789 -6406581.708337 + 20037508.342789 -3653545.667928 + + + -180.000000 -49.454297 + 180.000000 -31.160000 - dem:oceanbottom - image/jpeg - text/plain - application/vnd.ogc.gml - application/vnd.ogc.gml/3.1.1 - text/html + image/png application/json - - EPSG:4326 - - - EPSG:4326:0 - 0 - 0 - 0 - 1 - - - EPSG:4326:1 - 0 - 1 - 0 - 3 - - - EPSG:4326:2 - 0 - 3 - 0 - 7 - - - EPSG:4326:3 - 1 - 6 - 0 - 15 - - - EPSG:4326:4 - 2 - 13 - 0 - 31 - - - EPSG:4326:5 - 5 - 26 - 0 - 63 - - - EPSG:4326:6 - 10 - 53 - 0 - 127 - - - EPSG:4326:7 - 21 - 106 - 0 - 255 - - - EPSG:4326:8 - 42 - 213 - 0 - 511 - - - EPSG:4326:9 - 85 - 426 - 0 - 1023 - - - EPSG:4326:10 - 170 - 853 - 0 - 2047 - - - EPSG:4326:11 - 341 - 1706 - 0 - 4095 - - - EPSG:4326:12 - 682 - 3413 - 0 - 8191 - - - EPSG:4326:13 - 1365 - 6826 - 0 - 16383 - - - EPSG:4326:14 - 2730 - 13653 - 0 - 32766 - - - EPSG:4326:15 - 5461 - 27307 - 0 - 65533 - - - EPSG:4326:16 - 10922 - 54614 - 0 - 131067 - - - EPSG:4326:17 - 21845 - 109228 - 0 - 262135 - - - EPSG:4326:18 - 43690 - 218456 - 0 - 524270 - - - EPSG:4326:19 - 87381 - 436913 - 0 - 1048540 - - - EPSG:4326:20 - 174762 - 873826 - 0 - 2097081 - - - EPSG:4326:21 - 349525 - 1747653 - 0 - 4194162 - - - - - EPSG:3857 - - - EPSG:3857:0 - 0 - 0 - 0 - 0 - - - EPSG:3857:1 - 0 - 1 - 0 - 1 - - - EPSG:3857:2 - 1 - 2 - 0 - 3 - - - EPSG:3857:3 - 2 - 5 - 0 - 7 - - - EPSG:3857:4 - 4 - 11 - 0 - 15 - - - EPSG:3857:5 - 9 - 22 - 0 - 31 - - - EPSG:3857:6 - 18 - 45 - 0 - 63 - - - EPSG:3857:7 - 37 - 90 - 0 - 127 - - - EPSG:3857:8 - 74 - 181 - 0 - 255 - - - EPSG:3857:9 - 148 - 363 - 0 - 511 - - - EPSG:3857:10 - 297 - 726 - 0 - 1023 - - - EPSG:3857:11 - 594 - 1453 - 0 - 2047 - - - EPSG:3857:12 - 1189 - 2906 - 0 - 4095 - - - EPSG:3857:13 - 2379 - 5814 - 0 - 8191 - - - EPSG:3857:14 - 4758 - 11627 - 0 - 16383 - - - EPSG:3857:15 - 9516 - 23253 - 0 - 32766 - - - EPSG:3857:16 - 19032 - 46506 - 0 - 65533 - - - EPSG:3857:17 - 38064 - 93011 - 0 - 131067 - - - EPSG:3857:18 - 76127 - 186021 - 0 - 262135 - - - EPSG:3857:19 - 152254 - 372043 - 0 - 524271 - - - EPSG:3857:20 - 304507 - 744085 - 0 - 1048542 - - - EPSG:3857:21 - 609014 - 1488170 - 0 - 2097085 - - - - - - Altitude : shaded relief - Shaded relief from CGIAR DEM 3" resolution. Process mixes gdaldem hillshade and slope. - - -180.0 -90.0 - 180.0 90.0 - - dem:hillshading - - image/jpeg - - EPSG:4326 - - - EPSG:3857 - - - EPSG:3857:0 - 0 - 0 - 0 - 0 - - - EPSG:3857:1 - 0 - 1 - 0 - 1 - - - EPSG:3857:2 - 1 - 2 - 0 - 3 - - - EPSG:3857:3 - 2 - 5 - 0 - 7 - - - EPSG:3857:4 - 4 - 11 - 0 - 15 - - - EPSG:3857:5 - 9 - 22 - 0 - 31 - - - EPSG:3857:6 - 18 - 44 - 0 - 63 - - - EPSG:3857:7 - 37 - 88 - 0 - 127 - - - EPSG:3857:8 - 74 - 176 - 0 - 255 - - - EPSG:3857:9 - 148 - 352 - 0 - 511 - - - EPSG:3857:10 - 297 - 705 - 0 - 1023 - - - EPSG:3857:11 - 594 - 1410 - 0 - 2047 - - - EPSG:3857:12 - 1189 - 2821 - 0 - 4095 - - - EPSG:3857:13 - 2379 - 5644 - 0 - 8191 - - - EPSG:3857:14 - 4758 - 11287 - 0 - 16383 - - - EPSG:3857:15 - 9516 - 22573 - 0 - 32767 - - - EPSG:3857:16 - 19032 - 45146 - 0 - 65535 - - - EPSG:3857:17 - 38064 - 90292 - 0 - 131071 - - - EPSG:3857:18 - 76127 - 180584 - 0 - 262143 - - - EPSG:3857:19 - 152254 - 361168 - 0 - 524287 - - - EPSG:3857:20 - 304507 - 722336 - 0 - 1048575 - - - EPSG:3857:21 - 609014 - 1444672 - 0 - 2097151 - - - - - - Altitude : color and shaded relief - Altitude map derived from a 3" DEM (90m on equator) covering latitudes from -90S to +60N. Jarvis A., H.I. Reuter, A. Nelson, E. Guevara, 2008, Hole-filled seamless SRTM data V4, International Centre for Tropical Agriculture (CIAT), available from http://srtm.csi.cgiar.org. - - -180.0 -60.0 - 180.0 60.0 - - dem:altitude - - image/jpeg - - EPSG:4326 - - - EPSG:4326:0 - 0 - 0 - 0 - 1 - - - EPSG:4326:1 - 0 - 1 - 0 - 3 - - - EPSG:4326:2 - 0 - 3 - 0 - 7 - - - EPSG:4326:3 - 1 - 6 - 0 - 15 - - - EPSG:4326:4 - 2 - 13 - 0 - 31 - - - EPSG:4326:5 - 5 - 26 - 0 - 63 - - - EPSG:4326:6 - 10 - 53 - 0 - 127 - - - EPSG:4326:7 - 21 - 106 - 0 - 255 - - - EPSG:4326:8 - 42 - 213 - 0 - 511 - - - EPSG:4326:9 - 85 - 426 - 0 - 1023 - - - EPSG:4326:10 - 170 - 853 - 0 - 2047 - - - EPSG:4326:11 - 341 - 1706 - 0 - 4095 - - - EPSG:4326:12 - 682 - 3413 - 0 - 8191 - - - EPSG:4326:13 - 1365 - 6826 - 0 - 16383 - - - EPSG:4326:14 - 2730 - 13653 - 0 - 32767 - - - EPSG:4326:15 - 5461 - 27306 - 0 - 65535 - - - EPSG:4326:16 - 10922 - 54613 - 0 - 131071 - - - EPSG:4326:17 - 21845 - 109226 - 0 - 262143 - - - EPSG:4326:18 - 43690 - 218453 - 0 - 524287 - - - EPSG:4326:19 - 87381 - 436906 - 0 - 1048575 - - - EPSG:4326:20 - 174762 - 873813 - 0 - 2097151 - - - EPSG:4326:21 - 349525 - 1747626 - 0 - 4194303 - - - - - EPSG:3857 - - - EPSG:3857:0 - 0 - 0 - 0 - 0 - - - EPSG:3857:1 - 0 - 1 - 0 - 1 - - - EPSG:3857:2 - 1 - 2 - 0 - 3 - - - EPSG:3857:3 - 2 - 5 - 0 - 7 - - - EPSG:3857:4 - 4 - 11 - 0 - 15 - - - EPSG:3857:5 - 9 - 22 - 0 - 31 - - - EPSG:3857:6 - 18 - 45 - 0 - 63 - - - EPSG:3857:7 - 37 - 90 - 0 - 127 - - - EPSG:3857:8 - 74 - 181 - 0 - 255 - - - EPSG:3857:9 - 148 - 363 - 0 - 511 - - - EPSG:3857:10 - 297 - 726 - 0 - 1023 - - - EPSG:3857:11 - 594 - 1453 - 0 - 2047 - - - EPSG:3857:12 - 1189 - 2906 - 0 - 4095 - - - EPSG:3857:13 - 2379 - 5814 - 0 - 8191 - - - EPSG:3857:14 - 4758 - 11627 - 0 - 16383 - - - EPSG:3857:15 - 9516 - 23253 - 0 - 32767 - - - EPSG:3857:16 - 19032 - 46505 - 0 - 65535 - - - EPSG:3857:17 - 38064 - 93009 - 0 - 131071 - - - EPSG:3857:18 - 76127 - 186018 - 0 - 262143 - - - EPSG:3857:19 - 152254 - 372036 - 0 - 524287 - - - EPSG:3857:20 - 304507 - 744072 - 0 - 1048575 - - - EPSG:3857:21 - 609014 - 1488143 - 0 - 2097151 - - - - - - Earth at night 2012 - This new global view and animation of Earth's city lights is a composite assembled from data acquired by the Suomi NPP satellite. The data was acquired over nine days in April 2012 and 13 days in October 2012. It took 312 orbits to get a clear shot of every parcel of Earth's land surface and islands. This new data was then mapped over existing Blue Marble imagery of Earth to provide a realistic view of the planet. - - -180.0 -90.0 - 180.0 90.0 - - nasa:night_2012 - - image/png8 - text/plain - application/vnd.ogc.gml - application/vnd.ogc.gml/3.1.1 text/html - application/json - - EPSG:4326 - EPSG:3857 - - - True Marble - A 250m res. global image composited from LandSat7 (1999-2002). True Marble by Unearthed Outdoors, LLC is licensed under a Creative Commons Attribution 3.0 United States License. - - -180.0 -90.0 - 180.0 90.0 - - unearthedoutdoors:truemarble - - image/jpeg - text/plain - application/vnd.ogc.gml - application/vnd.ogc.gml/3.1.1 - text/html - application/json - - EPSG:4326 - - - EPSG:3857 - - - - Altitude : digital elevation model - DEM 3" resolution (90m on equator) covering latitudes from -90S to +60N. Jarvis A., H.I. Reuter, A. Nelson, E. Guevara, 2008, Hole-filled seamless SRTM data V4, International Centre for Tropical Agriculture (CIAT), available from http://srtm.csi.cgiar.org. - - -180.0 -90.0 - 180.0 90.0 - - dem:srtm - - - - image/jpeg - text/plain - application/vnd.ogc.gml - application/vnd.ogc.gml/3.1.1 - text/html - application/json - - EPSG:4326 - - - EPSG:3857 - - - EPSG:3857:0 - 0 - 0 - 0 - 0 - - - EPSG:3857:1 - 0 - 1 - 0 - 1 - - - EPSG:3857:2 - 1 - 2 - 0 - 3 - - - EPSG:3857:3 - 2 - 5 - 0 - 7 - - - EPSG:3857:4 - 4 - 11 - 0 - 15 - - - EPSG:3857:5 - 9 - 22 - 0 - 31 - - - EPSG:3857:6 - 18 - 45 - 0 - 63 - - - EPSG:3857:7 - 37 - 90 - 0 - 127 - - - EPSG:3857:8 - 74 - 181 - 0 - 255 - - - EPSG:3857:9 - 148 - 363 - 0 - 511 - - - EPSG:3857:10 - 297 - 726 - 0 - 1023 - - - EPSG:3857:11 - 594 - 1453 - 0 - 2047 - - - EPSG:3857:12 - 1189 - 2906 - 0 - 4095 - - - EPSG:3857:13 - 2379 - 5814 - 0 - 8191 - - - EPSG:3857:14 - 4758 - 11627 - 0 - 16383 - - - EPSG:3857:15 - 9516 - 23253 - 0 - 32767 - - - EPSG:3857:16 - 19032 - 46505 - 0 - 65535 - - - EPSG:3857:17 - 38064 - 93009 - 0 - 131071 - - - EPSG:3857:18 - 76127 - 186018 - 0 - 262143 - - - EPSG:3857:19 - 152254 - 372036 - 0 - 524287 - - - EPSG:3857:20 - 304507 - 744072 - 0 - 1048575 - - - EPSG:3857:21 - 609014 - 1488143 - 0 - 2097151 - - - + + + - GlobalCRS84Scale - urn:ogc:def:crs:EPSG::4326 - - GlobalCRS84Scale:0 - 5.0E8 - 90.0 -180.0 - 256 - 256 - 2 - 1 - - - GlobalCRS84Scale:1 - 2.5E8 - 90.0 -180.0 - 256 - 256 - 3 - 2 - - - GlobalCRS84Scale:2 - 1.0E8 - 90.0 -180.0 - 256 - 256 - 6 - 3 - - - GlobalCRS84Scale:3 - 5.0E7 - 90.0 -180.0 - 256 - 256 - 12 - 6 - - - GlobalCRS84Scale:4 - 2.5E7 - 90.0 -180.0 - 256 - 256 - 23 - 12 - - - GlobalCRS84Scale:5 - 1.0E7 - 90.0 -180.0 - 256 - 256 - 56 - 28 - - - GlobalCRS84Scale:6 - 5000000.0 - 90.0 -180.0 - 256 - 256 - 112 - 56 - - - GlobalCRS84Scale:7 - 2500000.0 - 90.0 -180.0 - 256 - 256 - 224 - 112 - - - GlobalCRS84Scale:8 - 1000000.0 - 90.0 -180.0 - 256 - 256 - 560 - 280 - - - GlobalCRS84Scale:9 - 500000.0 - 90.0 -180.0 - 256 - 256 - 1119 - 560 - - - GlobalCRS84Scale:10 - 250000.0 - 90.0 -180.0 - 256 - 256 - 2237 - 1119 - - - GlobalCRS84Scale:11 - 100000.0 - 90.0 -180.0 - 256 - 256 - 5591 - 2796 - - - GlobalCRS84Scale:12 - 50000.0 - 90.0 -180.0 - 256 - 256 - 11182 - 5591 - - - GlobalCRS84Scale:13 - 25000.0 - 90.0 -180.0 - 256 - 256 - 22364 - 11182 - - - GlobalCRS84Scale:14 - 10000.0 - 90.0 -180.0 - 256 - 256 - 55909 - 27955 - - - GlobalCRS84Scale:15 - 5000.0 - 90.0 -180.0 - 256 - 256 - 111817 - 55909 - - - GlobalCRS84Scale:16 - 2500.0 - 90.0 -180.0 - 256 - 256 - 223633 - 111817 - - - GlobalCRS84Scale:17 - 1000.0 - 90.0 -180.0 - 256 - 256 - 559083 - 279542 - - - GlobalCRS84Scale:18 - 500.0 - 90.0 -180.0 - 256 - 256 - 1118165 - 559083 - - - GlobalCRS84Scale:19 - 250.0 - 90.0 -180.0 - 256 - 256 - 2236330 - 1118165 - - - GlobalCRS84Scale:20 - 100.0 - 90.0 -180.0 - 256 - 256 - 5590823 - 2795412 - - - - EPSG:4326 - urn:ogc:def:crs:EPSG::4326 - - EPSG:4326:0 - 2.795411320143589E8 - 90.0 -180.0 - 256 - 256 - 2 - 1 - - - EPSG:4326:1 - 1.3977056600717944E8 - 90.0 -180.0 - 256 - 256 - 4 - 2 - - - EPSG:4326:2 - 6.988528300358972E7 - 90.0 -180.0 - 256 - 256 - 8 - 4 - - - EPSG:4326:3 - 3.494264150179486E7 - 90.0 -180.0 - 256 - 256 - 16 - 8 - - - EPSG:4326:4 - 1.747132075089743E7 - 90.0 -180.0 - 256 - 256 - 32 - 16 - - - EPSG:4326:5 - 8735660.375448715 - 90.0 -180.0 - 256 - 256 - 64 - 32 - - - EPSG:4326:6 - 4367830.1877243575 - 90.0 -180.0 - 256 - 256 - 128 - 64 - - - EPSG:4326:7 - 2183915.0938621787 - 90.0 -180.0 - 256 - 256 - 256 - 128 - - - EPSG:4326:8 - 1091957.5469310894 - 90.0 -180.0 - 256 - 256 - 512 - 256 - - - EPSG:4326:9 - 545978.7734655447 - 90.0 -180.0 - 256 - 256 - 1024 - 512 - - - EPSG:4326:10 - 272989.38673277234 - 90.0 -180.0 - 256 - 256 - 2048 - 1024 - - - EPSG:4326:11 - 136494.69336638617 - 90.0 -180.0 - 256 - 256 - 4096 - 2048 - - - EPSG:4326:12 - 68247.34668319309 - 90.0 -180.0 - 256 - 256 - 8192 - 4096 - - - EPSG:4326:13 - 34123.67334159654 - 90.0 -180.0 - 256 - 256 - 16384 - 8192 - - - EPSG:4326:14 - 17061.83667079827 - 90.0 -180.0 - 256 - 256 - 32768 - 16384 - - - EPSG:4326:15 - 8530.918335399136 - 90.0 -180.0 - 256 - 256 - 65536 - 32768 - - - EPSG:4326:16 - 4265.459167699568 - 90.0 -180.0 - 256 - 256 - 131072 - 65536 - - - EPSG:4326:17 - 2132.729583849784 - 90.0 -180.0 - 256 - 256 - 262144 - 131072 - - - EPSG:4326:18 - 1066.364791924892 - 90.0 -180.0 - 256 - 256 - 524288 - 262144 - - - EPSG:4326:19 - 533.182395962446 - 90.0 -180.0 - 256 - 256 - 1048576 - 524288 - - - EPSG:4326:20 - 266.591197981223 - 90.0 -180.0 - 256 - 256 - 2097152 - 1048576 - - - EPSG:4326:21 - 133.2955989906115 - 90.0 -180.0 - 256 - 256 - 4194304 - 2097152 - - - - GoogleCRS84Quad - urn:ogc:def:crs:EPSG::4326 - - GoogleCRS84Quad:0 - 5.590822640287178E8 - 90.0 -180.0 - 256 - 256 - 1 - 1 - - - GoogleCRS84Quad:1 - 2.795411320143589E8 - 90.0 -180.0 - 256 - 256 - 2 - 1 - - - GoogleCRS84Quad:2 - 1.397705660071794E8 - 90.0 -180.0 - 256 - 256 - 4 - 2 - - - GoogleCRS84Quad:3 - 6.988528300358972E7 - 90.0 -180.0 - 256 - 256 - 8 - 4 - - - GoogleCRS84Quad:4 - 3.494264150179486E7 - 90.0 -180.0 - 256 - 256 - 16 - 8 - - - GoogleCRS84Quad:5 - 1.747132075089743E7 - 90.0 -180.0 - 256 - 256 - 32 - 16 - - - GoogleCRS84Quad:6 - 8735660.375448715 - 90.0 -180.0 - 256 - 256 - 64 - 32 - - - GoogleCRS84Quad:7 - 4367830.187724357 - 90.0 -180.0 - 256 - 256 - 128 - 64 - - - GoogleCRS84Quad:8 - 2183915.093862179 - 90.0 -180.0 - 256 - 256 - 256 - 128 - - - GoogleCRS84Quad:9 - 1091957.546931089 - 90.0 -180.0 - 256 - 256 - 512 - 256 - - - GoogleCRS84Quad:10 - 545978.7734655447 - 90.0 -180.0 - 256 - 256 - 1024 - 512 - - - GoogleCRS84Quad:11 - 272989.3867327723 - 90.0 -180.0 - 256 - 256 - 2048 - 1024 - - - GoogleCRS84Quad:12 - 136494.6933663862 - 90.0 -180.0 - 256 - 256 - 4096 - 2048 - - - GoogleCRS84Quad:13 - 68247.34668319309 - 90.0 -180.0 - 256 - 256 - 8192 - 4096 - - - GoogleCRS84Quad:14 - 34123.67334159654 - 90.0 -180.0 - 256 - 256 - 16384 - 8192 - - - GoogleCRS84Quad:15 - 17061.83667079827 - 90.0 -180.0 - 256 - 256 - 32768 - 16384 - - - GoogleCRS84Quad:16 - 8530.918335399136 - 90.0 -180.0 - 256 - 256 - 65536 - 32768 - - - GoogleCRS84Quad:17 - 4265.459167699568 - 90.0 -180.0 - 256 - 256 - 131072 - 65536 - - - GoogleCRS84Quad:18 - 2132.729583849784 - 90.0 -180.0 - 256 - 256 - 262144 - 131072 - - - - EPSG:900913 - urn:ogc:def:crs:EPSG::900913 - - EPSG:900913:0 - 5.590822639508929E8 - -2.003750834E7 2.0037508E7 - 256 - 256 - 1 - 1 - - - EPSG:900913:1 - 2.7954113197544646E8 - -2.003750834E7 2.0037508E7 - 256 - 256 - 2 - 2 - - - EPSG:900913:2 - 1.3977056598772323E8 - -2.003750834E7 2.0037508E7 - 256 - 256 - 4 - 4 - - - EPSG:900913:3 - 6.988528299386162E7 - -2.003750834E7 2.0037508E7 - 256 - 256 - 8 - 8 - - - EPSG:900913:4 - 3.494264149693081E7 - -2.003750834E7 2.0037508E7 - 256 - 256 - 16 - 16 - - - EPSG:900913:5 - 1.7471320748465404E7 - -2.003750834E7 2.0037508E7 - 256 - 256 - 32 - 32 - - - EPSG:900913:6 - 8735660.374232702 - -2.003750834E7 2.0037508E7 - 256 - 256 - 64 - 64 - - - EPSG:900913:7 - 4367830.187116351 - -2.003750834E7 2.0037508E7 - 256 - 256 - 128 - 128 - - - EPSG:900913:8 - 2183915.0935581755 - -2.003750834E7 2.0037508E7 - 256 - 256 - 256 - 256 - - - EPSG:900913:9 - 1091957.5467790877 - -2.003750834E7 2.0037508E7 - 256 - 256 - 512 - 512 - - - EPSG:900913:10 - 545978.7733895439 - -2.003750834E7 2.0037508E7 - 256 - 256 - 1024 - 1024 - - - EPSG:900913:11 - 272989.38669477194 - -2.003750834E7 2.0037508E7 - 256 - 256 - 2048 - 2048 - - - EPSG:900913:12 - 136494.69334738597 - -2.003750834E7 2.0037508E7 - 256 - 256 - 4096 - 4096 - - - EPSG:900913:13 - 68247.34667369298 - -2.003750834E7 2.0037508E7 - 256 - 256 - 8192 - 8192 - - - EPSG:900913:14 - 34123.67333684649 - -2.003750834E7 2.0037508E7 - 256 - 256 - 16384 - 16384 - - - EPSG:900913:15 - 17061.836668423246 - -2.003750834E7 2.0037508E7 - 256 - 256 - 32768 - 32768 - - - EPSG:900913:16 - 8530.918334211623 - -2.003750834E7 2.0037508E7 - 256 - 256 - 65536 - 65536 - - - EPSG:900913:17 - 4265.4591671058115 - -2.003750834E7 2.0037508E7 - 256 - 256 - 131072 - 131072 - - - EPSG:900913:18 - 2132.7295835529058 - -2.003750834E7 2.0037508E7 - 256 - 256 - 262144 - 262144 - - - EPSG:900913:19 - 1066.3647917764529 - -2.003750834E7 2.0037508E7 - 256 - 256 - 524288 - 524288 - - - EPSG:900913:20 - 533.1823958882264 - -2.003750834E7 2.0037508E7 - 256 - 256 - 1048576 - 1048576 - - - EPSG:900913:21 - 266.5911979441132 - -2.003750834E7 2.0037508E7 - 256 - 256 - 2097152 - 2097152 - - - EPSG:900913:22 - 133.2955989720566 - -2.003750834E7 2.0037508E7 - 256 - 256 - 4194304 - 4194304 - - - EPSG:900913:23 - 66.6477994860283 - -2.003750834E7 2.0037508E7 - 256 - 256 - 8388608 - 8388608 - - - EPSG:900913:24 - 33.32389974301415 - -2.003750834E7 2.0037508E7 - 256 - 256 - 16777216 - 16777216 - - - EPSG:900913:25 - 16.661949871507076 - -2.003750834E7 2.0037508E7 - 256 - 256 - 33554432 - 33554432 - - - EPSG:900913:26 - 8.330974935753538 - -2.003750834E7 2.0037508E7 - 256 - 256 - 67108864 - 67108864 - - - EPSG:900913:27 - 4.165487467876769 - -2.003750834E7 2.0037508E7 - 256 - 256 - 134217728 - 134217728 - - - EPSG:900913:28 - 2.0827437339383845 - -2.003750834E7 2.0037508E7 - 256 - 256 - 268435456 - 268435456 - - - EPSG:900913:29 - 1.0413718669691923 - -2.003750834E7 2.0037508E7 - 256 - 256 - 536870912 - 536870912 - - - EPSG:900913:30 - 0.5206859334845961 - -2.003750834E7 2.0037508E7 - 256 - 256 - 1073741824 - 1073741824 - - - + GoogleMapsCompatible + The well-known 'GoogleMapsCompatible' tile matrix set defined by the OGC WMTS specification EPSG:3857 + + -20037508.342789 -20037508.342789 + 20037508.342789 20037508.342789 + urn:ogc:def:crs:EPSG::3857 + urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible - EPSG:3857:0 - 5.590811457640435E8 - -2.003750834E7 2.0037428E7 + 0 + 559082264.029 + -20037508.3428 20037508.3428 256 256 1 1 - EPSG:3857:1 - 2.795405728820217E8 - -2.003750834E7 2.0037428E7 + 1 + 279541132.014 + -20037508.3428 20037508.3428 256 256 2 2 - EPSG:3857:2 - 1.3977028644101086E8 - -2.003750834E7 2.0037428E7 + 2 + 139770566.007 + -20037508.3428 20037508.3428 256 256 4 4 - EPSG:3857:3 - 6.988514322050543E7 - -2.003750834E7 2.0037428E7 + 3 + 69885283.0036 + -20037508.3428 20037508.3428 256 256 8 8 - EPSG:3857:4 - 3.4942571610252716E7 - -2.003750834E7 2.0037428E7 + 4 + 34942641.5018 + -20037508.3428 20037508.3428 256 256 16 16 - EPSG:3857:5 - 1.7471285805126358E7 - -2.003750834E7 2.0037428E7 + 5 + 17471320.7509 + -20037508.3428 20037508.3428 256 256 32 32 - EPSG:3857:6 - 8735642.902563179 - -2.003750834E7 2.0037428E7 + 6 + 8735660.37545 + -20037508.3428 20037508.3428 256 256 64 64 - EPSG:3857:7 - 4367821.451281589 - -2.003750834E7 2.0037428E7 + 7 + 4367830.18772 + -20037508.3428 20037508.3428 256 256 128 128 - EPSG:3857:8 - 2183910.7256407947 - -2.003750834E7 2.0037428E7 + 8 + 2183915.09386 + -20037508.3428 20037508.3428 256 256 256 256 - EPSG:3857:9 - 1091955.3628203974 - -2.003750834E7 2.0037428E7 + 9 + 1091957.54693 + -20037508.3428 20037508.3428 256 256 512 512 - EPSG:3857:10 - 545977.6814101987 - -2.003750834E7 2.0037428E7 + 10 + 545978.773466 + -20037508.3428 20037508.3428 256 256 1024 1024 - EPSG:3857:11 - 272988.84070509934 - -2.003750834E7 2.0037428E7 + 11 + 272989.386733 + -20037508.3428 20037508.3428 256 256 2048 2048 - EPSG:3857:12 - 136494.42035254967 - -2.003750834E7 2.0037428E7 + 12 + 136494.693366 + -20037508.3428 20037508.3428 256 256 4096 4096 - EPSG:3857:13 - 68247.21017627484 - -2.003750834E7 2.004232E7 + 13 + 68247.3466832 + -20037508.3428 20037508.3428 256 256 - 8193 - 8193 + 8192 + 8192 - EPSG:3857:14 - 34123.60508813742 - -2.003750834E7 2.0039874E7 + 14 + 34123.6733416 + -20037508.3428 20037508.3428 256 256 - 16385 - 16385 + 16384 + 16384 - EPSG:3857:15 - 17061.80254406871 - -2.003750834E7 2.0038651E7 + 15 + 17061.8366708 + -20037508.3428 20037508.3428 256 256 - 32769 - 32769 + 32768 + 32768 - EPSG:3857:16 - 8530.901272034354 - -2.003750834E7 2.003804E7 + 16 + 8530.9183354 + -20037508.3428 20037508.3428 256 256 - 65537 - 65537 + 65536 + 65536 - EPSG:3857:17 - 4265.450636017177 - -2.003750834E7 2.0037734E7 + 17 + 4265.4591677 + -20037508.3428 20037508.3428 256 256 - 131073 - 131073 + 131072 + 131072 - EPSG:3857:18 - 2132.7253180085886 - -2.003750834E7 2.0037581E7 + 18 + 2132.72958385 + -20037508.3428 20037508.3428 256 256 - 262145 - 262145 + 262144 + 262144 - EPSG:3857:19 - 1066.3626590042943 - -2.003750834E7 2.0037581E7 + 19 + 1066.36479192 + -20037508.3428 20037508.3428 256 256 - 524290 - 524290 + 524288 + 524288 - EPSG:3857:20 - 533.1813295021472 - -2.003750834E7 2.0037543E7 + 20 + 533.182395962 + -20037508.3428 20037508.3428 256 256 - 1048579 - 1048579 + 1048576 + 1048576 - EPSG:3857:21 - 266.5906647510736 - -2.003750834E7 2.0037524E7 + 21 + 266.591197981 + -20037508.3428 20037508.3428 256 256 - 2097157 - 2097157 - - - - GlobalCRS84Pixel - urn:ogc:def:crs:EPSG::4326 - - GlobalCRS84Pixel:0 - 7.951392199519542E8 - 90.0 -180.0 - 256 - 256 - 1 - 1 - - - GlobalCRS84Pixel:1 - 3.975696099759771E8 - 90.0 -180.0 - 256 - 256 - 2 - 1 - - - GlobalCRS84Pixel:2 - 1.9878480498798856E8 - 90.0 -180.0 - 256 - 256 - 3 - 2 - - - GlobalCRS84Pixel:3 - 1.325232033253257E8 - 90.0 -180.0 - 256 - 256 - 5 - 3 - - - GlobalCRS84Pixel:4 - 6.626160166266285E7 - 90.0 -180.0 - 256 - 256 - 9 - 5 - - - GlobalCRS84Pixel:5 - 3.3130800831331424E7 - 90.0 -180.0 - 256 - 256 - 17 - 9 - - - GlobalCRS84Pixel:6 - 1.325232033253257E7 - 90.0 -180.0 - 256 - 256 - 43 - 22 - - - GlobalCRS84Pixel:7 - 6626160.166266285 - 90.0 -180.0 - 256 - 256 - 85 - 43 - - - GlobalCRS84Pixel:8 - 3313080.0831331424 - 90.0 -180.0 - 256 - 256 - 169 - 85 - - - GlobalCRS84Pixel:9 - 1656540.0415665712 - 90.0 -180.0 - 256 - 256 - 338 - 169 - - - GlobalCRS84Pixel:10 - 552180.0138555238 - 90.0 -180.0 - 256 - 256 - 1013 - 507 - - - GlobalCRS84Pixel:11 - 331308.00831331423 - 90.0 -180.0 - 256 - 256 - 1688 - 844 - - - GlobalCRS84Pixel:12 - 110436.00277110476 - 90.0 -180.0 - 256 - 256 - 5063 - 2532 - - - GlobalCRS84Pixel:13 - 55218.00138555238 - 90.0 -180.0 - 256 - 256 - 10125 - 5063 - - - GlobalCRS84Pixel:14 - 33130.80083133143 - 90.0 -180.0 - 256 - 256 - 16875 - 8438 - - - GlobalCRS84Pixel:15 - 11043.600277110474 - 90.0 -180.0 - 256 - 256 - 50625 - 25313 - - - GlobalCRS84Pixel:16 - 3313.080083133142 - 90.0 -180.0 - 256 - 256 - 168750 - 84375 - - - GlobalCRS84Pixel:17 - 1104.3600277110472 - 90.0 -180.0 - 256 - 256 - 506250 - 253125 + 2097152 + 2097152 - + \ No newline at end of file diff --git a/examples/wmts-layer-from-capabilities.html b/examples/wmts-layer-from-capabilities.html new file mode 100644 index 0000000000..4918488e4c --- /dev/null +++ b/examples/wmts-layer-from-capabilities.html @@ -0,0 +1,51 @@ + + + + + + + + + + + WMTS Layer example from capabilities + + + + + +
+ +
+
+
+
+
+ +
+ +
+

WMTS Capabilities example

+

Example of a WMTS source created from a WMTS capabilities document.

+
+

See the wmts-layer-from-capabilities.js source to see how this is done.

+
+
wmts, capabilities, getcapabilities
+
+ +
+ +
+ + + + + + + diff --git a/examples/wmts-layer-from-capabilities.js b/examples/wmts-layer-from-capabilities.js new file mode 100644 index 0000000000..921912588f --- /dev/null +++ b/examples/wmts-layer-from-capabilities.js @@ -0,0 +1,37 @@ +goog.require('ol.Map'); +goog.require('ol.View'); +goog.require('ol.format.WMTSCapabilities'); +goog.require('ol.layer.Tile'); +goog.require('ol.proj'); +goog.require('ol.source.OSM'); +goog.require('ol.source.WMTS'); + +var parser = new ol.format.WMTSCapabilities(); +var map; + +$.ajax('data/WMTSCapabilities.xml').then(function(response) { + var result = parser.read(response); + var options = ol.source.WMTS.optionsFromCapabilities(result, + {layer: 'layer-7328', matrixSet: 'EPSG:3857'}); + + var projection = ol.proj.get('EPSG:3857'); + var projectionExtent = projection.getExtent(); + map = new ol.Map({ + layers: [ + new ol.layer.Tile({ + source: new ol.source.OSM(), + opacity: 0.7 + }), + new ol.layer.Tile({ + opacity: 1, + extent: projectionExtent, + source: new ol.source.WMTS(options) + }) + ], + target: 'map', + view: new ol.View({ + center: [19412406.33, -5050500.21], + zoom: 5 + }) + }); +}); diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index ad458804c9..6654005fdf 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -66,10 +66,12 @@ ol.source.WMTS = function(options) { // we could issue a getCapabilities xhr to retrieve missing configuration var tileGrid = options.tileGrid; + // context property names are lower case to allow for a case insensitive + // replacement as some services use different naming conventions var context = { - 'Layer': options.layer, - 'Style': options.style, - 'TileMatrixSet': options.matrixSet + 'layer': options.layer, + 'style': options.style, + 'tilematrixset': options.matrixSet }; if (requestEncoding == ol.source.WMTSRequestEncoding.KVP) { @@ -96,7 +98,7 @@ ol.source.WMTS = function(options) { template = (requestEncoding == ol.source.WMTSRequestEncoding.KVP) ? goog.uri.utils.appendParamsFromMap(template, context) : template.replace(/\{(\w+?)\}/g, function(m, p) { - return (p in context) ? context[p] : m; + return (p.toLowerCase() in context) ? context[p.toLowerCase()] : m; }); return ( @@ -239,90 +241,144 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) { /** * @param {Object} wmtsCap An object representing the capabilities document. - * @param {string} layer The layer identifier. + * @param {Object} config Configuration properties for the layer. Defaults for + * the layer will apply if not provided. + * + * Required config properties: + * layer - {String} The layer identifier. + * + * Optional config properties: + * matrixSet - {String} The matrix set identifier, required if there is + * more than one matrix set in the layer capabilities. + * projection - {String} The desired CRS when no matrixSet is specified. + * eg: "EPSG:3857". If the desired projection is not available, + * an error is thrown. + * requestEncoding - {String} url encoding format for the layer. Default is the + * first tile url format found in the GetCapabilities response. + * style - {String} The name of the style + * format - {String} Image format for the layer. Default is the first + * format returned in the GetCapabilities response. * @return {olx.source.WMTSOptions} WMTS source options object. + * @api */ -ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, layer) { +ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { /* jshint -W069 */ // TODO: add support for TileMatrixLimits + goog.asserts.assert(!goog.isNull(config['layer'])); - var layers = wmtsCap['contents']['layers']; + var layers = wmtsCap['Contents']['Layer']; var l = goog.array.find(layers, function(elt, index, array) { - return elt['identifier'] == layer; + return elt['Identifier'] == config['layer']; }); goog.asserts.assert(!goog.isNull(l)); - goog.asserts.assert(l['tileMatrixSetLinks'].length > 0); - var matrixSet = /** @type {string} */ - (l['tileMatrixSetLinks'][0]['tileMatrixSet']); - var format = /** @type {string} */ (l['formats'][0]); - var idx = goog.array.findIndex(l['styles'], function(elt, index, array) { - return elt['isDefault']; + + goog.asserts.assert(l['TileMatrixSetLink'].length > 0); + var idx, matrixSet; + if (l['TileMatrixSetLink'].length > 1) { + idx = goog.array.findIndex(l['TileMatrixSetLink'], + function(elt, index, array) { + return elt['TileMatrixSet'] == config['matrixSet']; + }); + } else if (goog.isDef(config['projection'])) { + idx = goog.array.findIndex(l['TileMatrixSetLink'], + function(elt, index, array) { + return elt['TileMatrixSet']['SupportedCRS'].replace( + /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3' + ) == config['projection']; + }); + } else { + idx = 0; + } + if (idx < 0) { + idx = 0; + } + matrixSet = /** @type {string} */ + (l['TileMatrixSetLink'][idx]['TileMatrixSet']); + + goog.asserts.assert(!goog.isNull(matrixSet)); + + var format = /** @type {string} */ (l['Format'][0]); + if (goog.isDef(config['format'])) { + format = config['format']; + } + idx = goog.array.findIndex(l['Style'], function(elt, index, array) { + if (goog.isDef(config['style'])) { + return elt['Title'] == config['style']; + } else { + return elt['isDefault']; + } }); if (idx < 0) { idx = 0; } - var style = /** @type {string} */ (l['styles'][idx]['identifier']); + var style = /** @type {string} */ (l['Style'][idx]['Identifier']); var dimensions = {}; - goog.array.forEach(l['dimensions'], function(elt, index, array) { - var key = elt['identifier']; - var value = elt['default']; - if (goog.isDef(value)) { - goog.asserts.assert(goog.array.contains(elt['values'], value)); - } else { - value = elt['values'][0]; - } - goog.asserts.assert(goog.isDef(value)); - dimensions[key] = value; - }); + if (goog.isDef(l['Dimension'])) { + goog.array.forEach(l['Dimension'], function(elt, index, array) { + var key = elt['Identifier']; + var value = elt['default']; + if (goog.isDef(value)) { + goog.asserts.assert(goog.array.contains(elt['values'], value)); + } else { + value = elt['values'][0]; + } + goog.asserts.assert(goog.isDef(value)); + dimensions[key] = value; + }); + } - var matrixSets = wmtsCap['contents']['tileMatrixSets']; - goog.asserts.assert(matrixSet in matrixSets); - var matrixSetObj = matrixSets[matrixSet]; + var matrixSets = wmtsCap['Contents']['TileMatrixSet']; + var matrixSetObj = goog.array.find(matrixSets, function(elt, index, array) { + return elt['Identifier'] == matrixSet; + }); + goog.asserts.assert(!goog.isNull(matrixSetObj)); var tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet( matrixSetObj); - var projection = ol.proj.get(matrixSetObj['supportedCRS']); - - var gets = wmtsCap['operationsMetadata']['GetTile']['dcp']['http']['get']; - var encodings = goog.object.getKeys( - gets[0]['constraints']['GetEncoding']['allowedValues']); - goog.asserts.assert(encodings.length > 0); - - var urls; - var requestEncoding; - switch (encodings[0]) { - case 'REST': - case 'RESTful': - // The OGC documentation is not clear if we should use REST or RESTful, - // ArcGis use RESTful, and OpenLayers use REST. - requestEncoding = ol.source.WMTSRequestEncoding.REST; - goog.asserts.assert(l['resourceUrls'].hasOwnProperty('tile')); - goog.asserts.assert(l['resourceUrls']['tile'].hasOwnProperty(format)); - urls = /** @type {Array.} */ - (l['resourceUrls']['tile'][format]); - break; - case 'KVP': - requestEncoding = ol.source.WMTSRequestEncoding.KVP; - urls = []; - goog.array.forEach(gets, function(elt, index, array) { - if (elt['constraints']['GetEncoding']['allowedValues'].hasOwnProperty( - ol.source.WMTSRequestEncoding.KVP)) { - urls.push(/** @type {string} */ (elt['url'])); - } - }); - goog.asserts.assert(urls.length > 0); - break; - default: - goog.asserts.fail(); + var projection; + if (goog.isDef(config['projection'])) { + projection = ol.proj.get(config['projection']); + } else { + projection = ol.proj.get(matrixSetObj['SupportedCRS'].replace( + /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')); } + /** @type {!Array.} */ + var urls = []; + var requestEncoding = config['requestEncoding']; + if (wmtsCap['OperationsMetadata'].hasOwnProperty('GetTile') && + requestEncoding != 'REST') { + var gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get']; + + var constraint = goog.array.find(gets[0]['Constraint'], + function(elt, index, array) { + return elt['name'] == 'GetEncoding'; + }); + var encodings = constraint['AllowedValues']['Value']; + if (encodings.length > 0 && goog.array.contains(encodings, 'KVP')) { + requestEncoding = ol.source.WMTSRequestEncoding.KVP; + urls.push(/** @type {string} */ (gets[0]['href'])); + + } + } else { + // Add REST tile resource url + requestEncoding = ol.source.WMTSRequestEncoding.REST; + goog.array.forEach(l['ResourceURL'], function(elt, index, array) { + if (elt['resourceType'] == 'tile') { + format = elt['format']; + urls.push(/** @type {string} */ (elt['template'])); + } + }); + } + goog.asserts.assert(urls.length > 0); + return { urls: urls, - layer: layer, + layer: config['layer'], matrixSet: matrixSet, format: format, projection: projection, diff --git a/src/ol/tilegrid/wmtstilegrid.js b/src/ol/tilegrid/wmtstilegrid.js index d0298ba0f4..228d25715a 100644 --- a/src/ol/tilegrid/wmtstilegrid.js +++ b/src/ol/tilegrid/wmtstilegrid.js @@ -64,6 +64,7 @@ ol.tilegrid.WMTS.prototype.getMatrixIds = function() { * @param {Object} matrixSet An object representing a matrixSet in the * capabilities document. * @return {ol.tilegrid.WMTS} WMTS tileGrid instance. + * @api */ ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet = function(matrixSet) { @@ -77,16 +78,20 @@ ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet = /** @type {!Array.} */ var tileSizes = []; - var supportedCRSPropName = 'supportedCRS'; - var matrixIdsPropName = 'matrixIds'; - var identifierPropName = 'identifier'; - var scaleDenominatorPropName = 'scaleDenominator'; - var topLeftCornerPropName = 'topLeftCorner'; - var tileWidthPropName = 'tileWidth'; - var tileHeightPropName = 'tileHeight'; + var supportedCRSPropName = 'SupportedCRS'; + var matrixIdsPropName = 'TileMatrix'; + var identifierPropName = 'Identifier'; + var scaleDenominatorPropName = 'ScaleDenominator'; + var topLeftCornerPropName = 'TopLeftCorner'; + var tileWidthPropName = 'TileWidth'; + var tileHeightPropName = 'TileHeight'; - var projection = ol.proj.get(matrixSet[supportedCRSPropName]); + var projection; + projection = ol.proj.get(matrixSet[supportedCRSPropName].replace( + /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')); var metersPerUnit = projection.getMetersPerUnit(); + // swap origin x and y coordinates if axis orientation is lat/long + var switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne'; goog.array.sort(matrixSet[matrixIdsPropName], function(a, b) { return b[scaleDenominatorPropName] - a[scaleDenominatorPropName]; @@ -95,7 +100,12 @@ ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet = goog.array.forEach(matrixSet[matrixIdsPropName], function(elt, index, array) { matrixIds.push(elt[identifierPropName]); - origins.push(elt[topLeftCornerPropName]); + if (switchOriginXY) { + origins.push([elt[topLeftCornerPropName][1], + elt[topLeftCornerPropName][0]]); + } else { + origins.push(elt[topLeftCornerPropName]); + } resolutions.push(elt[scaleDenominatorPropName] * 0.28E-3 / metersPerUnit); var tileWidth = elt[tileWidthPropName]; diff --git a/test/spec/ol/format/wmts/ogcsample.xml b/test/spec/ol/format/wmts/ogcsample.xml index c122fcac57..f8e36b01d9 100644 --- a/test/spec/ol/format/wmts/ogcsample.xml +++ b/test/spec/ol/format/wmts/ogcsample.xml @@ -28,12 +28,10 @@ access interface to some TileMatrixSets Fac Ciencies UAB Bellaterra - Barcelona - + Barcelona 08193 Spain - joan.maso@uab.cat - + joan.maso@uab.cat @@ -70,8 +68,7 @@ access interface to some TileMatrixSets Blue Marble Next Generation - Blue Marble Next Generation NASA Product - + Blue Marble Next Generation NASA Product -180 -90 180 90 @@ -84,8 +81,7 @@ access interface to some TileMatrixSets image/jpeg @@ -93,15 +89,206 @@ access interface to some TileMatrixSets BigWorldPixel + + google3857 + + + + google3857 + + 1799448.394855 6124949.747770 + 1848250.442089 6162571.828177 + + urn:ogc:def:crs:EPSG:6.18:3:3857 + urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible + + 0 + 559082264.029 + -20037508.3428 20037508.3428 + 256 + 256 + 1 + 1 + + + 1 + 279541132.015 + -20037508.3428 20037508.3428 + 256 + 256 + 2 + 2 + + + 2 + 139770566.007 + -20037508.3428 20037508.3428 + 256 + 256 + 4 + 4 + + + 3 + 69885283.0036 + -20037508.3428 20037508.3428 + 256 + 256 + 8 + 8 + + + 4 + 34942641.5018 + -20037508.3428 20037508.3428 + 256 + 256 + 16 + 16 + + + 5 + 17471320.7509 + -20037508.3428 20037508.3428 + 256 + 256 + 32 + 32 + + + 6 + 8735660.37545 + -20037508.3428 20037508.3428 + 256 + 256 + 64 + 64 + + + 7 + 4367830.18773 + -20037508.3428 20037508.3428 + 256 + 256 + 128 + 128 + + + 8 + 2183915.09386 + -20037508.3428 20037508.3428 + 256 + 256 + 256 + 256 + + + 9 + 1091957.54693 + -20037508.3428 20037508.3428 + 256 + 256 + 512 + 512 + + + 10 + 545978.773466 + -20037508.3428 20037508.3428 + 256 + 256 + 1024 + 1024 + + + 11 + 272989.386733 + -20037508.3428 20037508.3428 + 256 + 256 + 2048 + 2048 + + + 12 + 136494.693366 + -20037508.3428 20037508.3428 + 256 + 256 + 4096 + 4096 + + + 13 + 68247.3466832 + -20037508.3428 20037508.3428 + 256 + 256 + 8192 + 8192 + + + 14 + 34123.6733416 + -20037508.3428 20037508.3428 + 256 + 256 + 16384 + 16384 + + + 15 + 17061.8366708 + -20037508.3428 20037508.3428 + 256 + 256 + 32768 + 32768 + + + 16 + 8530.91833540 + -20037508.3428 20037508.3428 + 256 + 256 + 65536 + 65536 + + + 17 + 4265.45916770 + -20037508.3428 20037508.3428 + 256 + 256 + 131072 + 131072 + + + 18 + 2132.72958385 + -20037508.3428 20037508.3428 + 256 + 256 + 262144 + 262144 + + + 19 + 1066.36479193 + -20037508.3428 20037508.3428 + 256 + 256 + 524288 + 524288 + + BigWorldPixel - urn:ogc:def:crs:OGC:1.3:CRS84 - - urn:ogc:def:wkss:OGC:1.0:GlobalCRS84Pixel - + urn:ogc:def:crs:OGC:1.3:CRS84 + urn:ogc:def:wkss:OGC:1.0:GlobalCRS84Pixel 10000m 33130800.83133142 @@ -158,27 +345,27 @@ access interface to some TileMatrixSets - BigWorld - urn:ogc:def:crs:OGC:1.3:CRS84 - - 1e6 - 1e6 - -180 84 - 256 - 256 - 60000 - 50000 - - - 2.5e6 - 2.5e6 - -180 84 - 256 - 256 - 9000 - 7000 - - + BigWorld + urn:ogc:def:crs:OGC:1.3:CRS84 + + 1e6 + 1e6 + -180 84 + 256 + 256 + 60000 + 50000 + + + 2.5e6 + 2.5e6 + -180 84 + 256 + 256 + 9000 + 7000 + +
diff --git a/test/spec/ol/format/wmtscapabilitiesformat.test.js b/test/spec/ol/format/wmtscapabilitiesformat.test.js index 9ca27ad9fc..e87d30d01b 100644 --- a/test/spec/ol/format/wmtscapabilitiesformat.test.js +++ b/test/spec/ol/format/wmtscapabilitiesformat.test.js @@ -44,9 +44,11 @@ describe('ol.format.WMTSCapabilities', function() { expect(layer.Style[0].LegendURL[0].format).to.be.eql('image/png'); expect(layer.TileMatrixSetLink).to.be.an('array'); - expect(layer.TileMatrixSetLink).to.have.length(1); + expect(layer.TileMatrixSetLink).to.have.length(2); expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be .eql('BigWorldPixel'); + expect(layer.TileMatrixSetLink[1].TileMatrixSet).to.be + .eql('google3857'); var wgs84Bbox = layer.WGS84BoundingBox; expect(wgs84Bbox).to.be.an('array'); @@ -67,7 +69,7 @@ describe('ol.format.WMTSCapabilities', function() { it('Can read Capabilities.Content.TileMatrixSet', function() { expect(capabilities.Contents.TileMatrixSet).to.be.ok(); - var bigWorld = capabilities.Contents.TileMatrixSet[1]; + var bigWorld = capabilities.Contents.TileMatrixSet[2]; expect(bigWorld).to.be.ok(); expect(bigWorld.Identifier).to.be.eql('BigWorld'); expect(bigWorld.SupportedCRS).to.be.eql('urn:ogc:def:crs:OGC:1.3:CRS84'); diff --git a/test/spec/ol/source/wmtssource.test.js b/test/spec/ol/source/wmtssource.test.js new file mode 100644 index 0000000000..6ebb225abc --- /dev/null +++ b/test/spec/ol/source/wmtssource.test.js @@ -0,0 +1,143 @@ +goog.provide('ol.test.source.WMTS'); + +describe('ol.source.WMTS', function() { + + describe('when creating options from capabilities', function() { + var parser = new ol.format.WMTSCapabilities(); + var capabilities; + before(function(done) { + afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) { + try { + capabilities = parser.read(xml); + } catch (e) { + done(e); + } + done(); + }); + }); + + it('can create KVP options from spec/ol/format/wmts/ogcsample.xml', + function() { + var options; + options = ol.source.WMTS.optionsFromCapabilities( + capabilities, + { layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857' }); + + expect(options.urls).to.be.an('array'); + expect(options.urls).to.have.length(1); + expect(options.urls[0]).to.be.eql( + 'http://www.maps.bob/cgi-bin/MiraMon5_0.cgi?'); + + expect(options.layer).to.be.eql('BlueMarbleNextGeneration'); + + expect(options.matrixSet).to.be.eql('google3857'); + + expect(options.format).to.be.eql('image/jpeg'); + + expect(options.projection).to.be.a(ol.proj.Projection); + expect(options.projection).to.be.eql(ol.proj.get('EPSG:3857')); + + expect(options.requestEncoding).to.be.eql('KVP'); + + expect(options.tileGrid).to.be.a(ol.tilegrid.WMTS); + + expect(options.style).to.be.eql('DarkBlue'); + + expect(options.dimensions).to.eql({}); + + }); + + it('can create REST options from spec/ol/format/wmts/ogcsample.xml', + function() { + var options; + options = ol.source.WMTS.optionsFromCapabilities( + capabilities, + { layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857', + requestEncoding: 'REST' }); + + expect(options.urls).to.be.an('array'); + expect(options.urls).to.have.length(1); + expect(options.urls[0]).to.be.eql( + 'http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png'); + + expect(options.layer).to.be.eql('BlueMarbleNextGeneration'); + + expect(options.matrixSet).to.be.eql('google3857'); + + expect(options.format).to.be.eql('image/png'); + + expect(options.projection).to.be.a(ol.proj.Projection); + expect(options.projection).to.be.eql(ol.proj.get('EPSG:3857')); + + expect(options.requestEncoding).to.be.eql('REST'); + + expect(options.tileGrid).to.be.a(ol.tilegrid.WMTS); + + expect(options.style).to.be.eql('DarkBlue'); + + expect(options.dimensions).to.eql({}); + + }); + }); + + describe('when creating tileUrlFunction', function() { + + it('can replace lowercase REST parameters', + function() { + var source = new ol.source.WMTS({ + layer: 'layer', + style: 'default', + urls: ['http://www.example.com/wmts/coastlines/{layer}/{style}/' + + '{tilematrixset}/{TileMatrix}/{TileCol}/{TileRow}.jpg'], + matrixSet: 'EPSG:3857', + requestEncoding: 'REST', + tileGrid: new ol.tilegrid.WMTS({ + origin: [-20037508.342789244, 20037508.342789244], + resolutions: [559082264.029 * 0.28E-3, + 279541132.015 * 0.28E-3, + 139770566.007 * 0.28E-3], + matrixIds: [0, 1, 2] + }) + }); + + var projection = ol.proj.get('EPSG:3857'); + var url = source.tileUrlFunction.call(source, + [1, 1, -2], 1, projection); + expect(url).to.be.eql('http://www.example.com/wmts/coastlines/' + + 'layer/default/EPSG:3857/1/1/1.jpg'); + + }); + + it('can replace camelcase REST parameters', + function() { + var source = new ol.source.WMTS({ + layer: 'layer', + style: 'default', + urls: ['http://www.example.com/wmts/coastlines/{Layer}/{Style}/' + + '{tilematrixset}/{TileMatrix}/{TileCol}/{TileRow}.jpg'], + matrixSet: 'EPSG:3857', + requestEncoding: 'REST', + tileGrid: new ol.tilegrid.WMTS({ + origin: [-20037508.342789244, 20037508.342789244], + resolutions: [559082264.029 * 0.28E-3, + 279541132.015 * 0.28E-3, + 139770566.007 * 0.28E-3], + matrixIds: [0, 1, 2] + }) + }); + + var projection = ol.proj.get('EPSG:3857'); + var url = source.tileUrlFunction.call(source, + [1, 1, -2], 1, projection); + expect(url).to.be.eql('http://www.example.com/wmts/coastlines/' + + 'layer/default/EPSG:3857/1/1/1.jpg'); + + }); + }); +}); + +goog.require('ol.format.WMTSCapabilities'); +goog.require('ol.proj'); +goog.require('ol.proj.Projection'); +goog.require('ol.tilegrid.WMTS'); +goog.require('ol.source.WMTS'); diff --git a/test/spec/ol/tilegrid/wmtstilegrid.test.js b/test/spec/ol/tilegrid/wmtstilegrid.test.js new file mode 100644 index 0000000000..1e03436c23 --- /dev/null +++ b/test/spec/ol/tilegrid/wmtstilegrid.test.js @@ -0,0 +1,68 @@ +goog.provide('ol.test.tilegrid.WMTS'); + +describe('ol.tilegrid.WMTS', function() { + + describe('when creating tileGrid from capabilities', function() { + var parser = new ol.format.WMTSCapabilities(); + var capabilities; + before(function(done) { + afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) { + try { + capabilities = parser.read(xml); + } catch (e) { + done(e); + } + done(); + }); + }); + + it('can create tileGrid for EPSG:3857', + function() { + var matrixSetObj = capabilities.Contents.TileMatrixSet[0]; + var tileGrid; + tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet( + matrixSetObj); + expect(tileGrid.matrixIds_).to.be.an('array'); + expect(tileGrid.matrixIds_).to.have.length(20); + expect(tileGrid.matrixIds_).to.eql( + ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', + '12', '13', '14', '15', '16', '17', '18', '19']); + + expect(tileGrid.resolutions_).to.be.an('array'); + expect(tileGrid.resolutions_).to.have.length(20); + expect(tileGrid.resolutions_).to.eql( + [156543.03392811998, 78271.51696419998, 39135.758481959994, + 19567.879241008, 9783.939620504, 4891.969810252, 2445.984905126, + 1222.9924525644, 611.4962262807999, 305.74811314039994, + 152.87405657047998, 76.43702828523999, 38.21851414248, + 19.109257071295996, 9.554628535647998, 4.777314267823999, + 2.3886571339119995, 1.1943285669559998, 0.5971642834779999, + 0.29858214174039993]); + + expect(tileGrid.origins_).to.be.an('array'); + expect(tileGrid.origins_).to.have.length(20); + expect(tileGrid.origins_).to.eql( + [[-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428], + [-20037508.3428, 20037508.3428], [-20037508.3428, 20037508.3428] + ]); + + expect(tileGrid.tileSizes_).to.be.an('array'); + expect(tileGrid.tileSizes_).to.have.length(20); + expect(tileGrid.tileSizes_).to.eql( + [256, 256, 256, 256, 256, 256, 256, 256, 256, 256, + 256, 256, 256, 256, 256, 256, 256, 256, 256, 256]); + + }); + }); +}); + +goog.require('ol.format.WMTSCapabilities'); +goog.require('ol.tilegrid.WMTS');