Merge pull request #3815 from ahocevar/tilegrid-no-surprises
Simplify tilegrid API and internals
This commit is contained in:
842
test/spec/ol/data/bing_aerialwithlabels.json
Normal file
842
test/spec/ol/data/bing_aerialwithlabels.json
Normal file
@@ -0,0 +1,842 @@
|
||||
{
|
||||
"authenticationResultCode": "ValidCredentials",
|
||||
"brandLogoUri": "http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
|
||||
"copyright": "Copyright © 2015 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
|
||||
"resourceSets": [{
|
||||
"estimatedTotal": 1,
|
||||
"resources": [{
|
||||
"__type": "ImageryMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
|
||||
"imageHeight": 256,
|
||||
"imageUrl": "https:\/\/ecn.{subdomain}.tiles.virtualearth.net\/tiles\/h{quadkey}.jpeg?g=3542&mkt={culture}",
|
||||
"imageUrlSubdomains": ["t0", "t1", "t2", "t3"],
|
||||
"imageWidth": 256,
|
||||
"imageryProviders": [{
|
||||
"attribution": "© 2015 DigitalGlobe",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -67, -179.99, 27, 0],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [27, -179.99, 87, -126.5],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [48.4, -126.5, 87, -5.75],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -67, 28, 86.5, 179.99],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -67, 0, 37.8, 28],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [37.7, 18.5, 59.8, 28],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [43, -81.6, 48.4, -10],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [27, -70, 43, -10],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [27, -10, 35.8, 0],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [27, -120, 32.3, -105.8],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [43.4, 13.78, 54.9, 18.5],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of NASA",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 8,
|
||||
"zoomMin": 1
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© Harris Corp, Earthstar Geographics LLC",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 9
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of USGS",
|
||||
"coverageAreas": [{
|
||||
"bbox": [17.99, -150.11, 61.39, -65.57],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© Getmapping plc",
|
||||
"coverageAreas": [{
|
||||
"bbox": [49.94, -6.82, 60.17, 1.78],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 GeoEye",
|
||||
"coverageAreas": [{
|
||||
"bbox": [48.95, -152, 65.5, -95.4],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [45.15, -73.2, 48.9, -70.2],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [31.87, -67.56, 49, -50.46],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -23, -180, 30, -145],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -37.7, -110, 26.5, -33],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -46, -20, 67, 180],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Pasco",
|
||||
"coverageAreas": [{
|
||||
"bbox": [23.5, 122.5, 46.65, 151.66],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© GeoContent \/ (p) Intergraph",
|
||||
"coverageAreas": [{
|
||||
"bbox": [47, 5, 55.5, 16],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [46.25, 9.4, 49.2, 17.3],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Intermap",
|
||||
"coverageAreas": [{
|
||||
"bbox": [49, -11, 60, 2],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 1
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of the IndianaMap",
|
||||
"coverageAreas": [{
|
||||
"bbox": [37.7, -88.2, 41.9, -84.7],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of the Nevada State Mapping Advisory Committee",
|
||||
"coverageAreas": [{
|
||||
"bbox": [34.85, -120.2, 42.12, -113.91],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 InterAtlas",
|
||||
"coverageAreas": [{
|
||||
"bbox": [48.37, 1.4, 49.28, 3.37],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [47.72, 1.67, 48.05, 2.18],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [45.55, 4.57, 45.95, 5.33],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [43.18, 4.92, 43.77, 5.82],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Eurosense",
|
||||
"coverageAreas": [{
|
||||
"bbox": [51, 3, 53.65, 7.67],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [50.58, 5.42, 51, 5.47],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 IGP",
|
||||
"coverageAreas": [{
|
||||
"bbox": [36.88, -9.6, 42.27, -6],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 IGN",
|
||||
"coverageAreas": [{
|
||||
"bbox": [42, -5, 51.25, 8.5],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [41.25, 8.3, 43.1, 9.65],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [17.85, -63.17, 18.15, -62.77],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [15.75, -61.9, 16.55, -60.9],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [14.35, -61.25, 14.95, -60.75],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [2.25, -54.65, 6, -51.4],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [ -21.5, 55, -20.75, 56],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [46.7, -56.5, 47.2, -56.1],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© Province of British Columbia",
|
||||
"coverageAreas": [{
|
||||
"bbox": [48.99, -139.05, 60, -114.05],
|
||||
"zoomMax": 18,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Blom",
|
||||
"coverageAreas": [{
|
||||
"bbox": [36.1, -9.51, 51.04, 11.67],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [55.69, 9.8, 61.17, 13.23],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [62.2, 25.82, 62.24, 25.89],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Aerials Express",
|
||||
"coverageAreas": [{
|
||||
"bbox": [34.63, -90.41, 35.52, -89.48],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of LAR-IAC",
|
||||
"coverageAreas": [{
|
||||
"bbox": [33.27, -119.02, 34.9, -117.59],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Image courtesy of ImagePatch.com",
|
||||
"coverageAreas": [{
|
||||
"bbox": [25.74, -106.76, 36.63, -93.97],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}, {
|
||||
"bbox": [34.36, -93.14, 35.44, -92],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "State of Michigan",
|
||||
"coverageAreas": [{
|
||||
"bbox": [41.68, -86.87, 45.89, -82.91],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 14
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "Earthstar Geographics SIO",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 8,
|
||||
"zoomMin": 1
|
||||
}, {
|
||||
"bbox": [70.61, 78.75, 71.52, 81.56],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [68.66, 135, 69.66, 137.81],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [67.61, 171.56, 68.66, 174.38],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [67.61, 70.31, 68.66, 73.13],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [66.51, -180, 67.61, -177.19],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [65.37, 36.56, 66.51, 39.38],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [64.17, -171.56, 65.37, -168.75],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [54.16, -70.31, 55.78, -67.5],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [52.48, -180, 65.37, -163.13],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [47.04, 140.63, 58.81, 154.69],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [36.6, 132.19, 40.98, 137.81],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, 64.69, 34.31, 67.5],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, 28.13, 34.31, 33.75],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, 16.88, 38.82, 19.69],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [29.54, 61.88, 31.95, 64.69],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [27.06, 123.75, 31.95, 129.38],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [24.53, 2.81, 27.06, 5.63],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [19.31, 16.88, 27.06, 22.5],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [19.31, -8.44, 27.06, -2.81],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [19.31, -95.63, 29.54, -84.38],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [16.64, -87.19, 19.31, -81.56],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [11.18, -81.56, 16.64, -61.88],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [5.62, 106.88, 21.94, 118.13],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -11.18, 143.44, -8.41, 146.25],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -13.92, 177.19, -11.18, 180],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -13.92, 137.81, -11.18, 140.63],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -85.05, -180, 85.05, 180],
|
||||
"zoomMax": 13,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [76.18, 67.5, 77.47, 70.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [74.02, 59.06, 75.5, 61.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [71.52, 118.13, 73.23, 120.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [70.61, 154.69, 71.52, 157.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [70.61, 146.25, 72.4, 151.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [70.61, 50.63, 74.78, 56.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [70.61, -11.25, 71.52, -5.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [70.61, -180, 72.4, -177.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [67.61, -180, 69.66, -177.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [62.92, -25.31, 67.61, -11.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [62.92, -56.25, 70.61, -50.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [62.92, -70.31, 64.17, -67.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [58.81, -47.81, 61.61, -42.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [52.48, 171.56, 54.16, 174.38],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [50.74, 0, 54.16, 5.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [47.04, -11.25, 61.61, 0],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [38.82, -33.75, 40.98, -30.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [38.82, -73.13, 40.98, -70.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [36.6, -11.25, 45.09, -2.81],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [36.6, -30.94, 40.98, -22.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [34.31, -75.94, 38.82, -73.13],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [34.31, -123.75, 36.6, -120.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, -67.5, 34.31, -64.69],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, -78.75, 34.31, -75.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [31.95, -120.94, 34.31, -118.13],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [27.06, -95.63, 29.54, -87.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [27.06, -180, 29.54, -177.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [24.53, -174.38, 27.06, -171.56],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [16.64, -163.13, 24.53, -154.69],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [13.92, -25.31, 19.31, -22.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [13.92, -171.56, 19.31, -168.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [11.18, 143.44, 21.94, 146.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [8.41, 137.81, 11.18, 140.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [8.41, -109.69, 11.18, -106.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [5.62, 157.5, 8.41, 160.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [5.62, 149.06, 11.18, 154.69],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [5.62, 132.19, 8.41, 135],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [0, -177.19, 2.81, -174.38],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -2.81, 165.94, 0, 168.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -2.81, -92.81, 2.81, -87.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -2.81, -163.13, 8.41, -154.69],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -5.62, 53.44, -2.81, 56.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -8.41, 70.31, -5.62, 73.13],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -11.18, 160.31, 21.94, 180],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -11.18, -140.63, -5.62, -137.81],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -13.92, 174.38, -11.18, 177.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -13.92, 95.63, -11.18, 98.44],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -16.64, -8.44, -13.92, -5.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -19.31, -154.69, -13.92, -140.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -21.94, 174.38, -13.92, 180],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -21.94, 61.88, -19.31, 64.69],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -21.94, 53.44, -19.31, 59.06],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -24.53, -140.63, -19.31, -132.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [38.82, -180, 71.52, -50.63],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -24.53, -151.88, -21.94, -146.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -24.53, -160.31, -16.64, -157.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -24.53, -180, 0, -160.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -27.06, -81.56, -24.53, -78.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -27.06, -132.19, -21.94, -126.56],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -29.54, 165.94, -27.06, 168.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -29.54, -109.69, -24.53, -106.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -29.54, -146.25, -27.06, -143.44],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -31.95, 157.5, -29.54, 160.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -34.31, -81.56, -31.95, -78.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -45.09, -19.69, 74.02, 180],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -45.09, -177.19, -43.07, -174.38],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -47.04, 50.63, -45.09, 53.44],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -47.04, 36.56, -45.09, 39.38],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -48.92, 177.19, -47.04, 180],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -50.74, 67.5, -47.04, 73.13],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -54.16, 165.94, -34.31, 180],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -54.16, 73.13, -52.48, 75.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -54.16, -61.88, -50.74, -56.25],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -55.78, 157.5, -54.16, 160.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -55.78, -39.38, -52.48, -33.75],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -57.33, -120.94, 31.95, -30.94],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -58.81, -28.13, -57.33, -25.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -61.61, -47.81, -60.24, -42.19],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2012 DigitalGlobe",
|
||||
"coverageAreas": [{
|
||||
"bbox": [47.04, 67.5, 48.92, 70.31],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [21.94, 45, 24.53, 47.81],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -19.31, 14.06, -16.64, 16.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -38.82, -64.69, -36.6, -61.88],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [ -47.04, -70.31, -45.09, -67.5],
|
||||
"zoomMax": 17,
|
||||
"zoomMin": 10
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Microsoft Corporation",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 1
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 HERE",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 9,
|
||||
"zoomMin": 1
|
||||
}, {
|
||||
"bbox": [14, -180, 90, -50],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [27, -32, 40, -13],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [35, -11, 72, 20],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [21, 20, 72, 32],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [21.92, 113.14, 22.79, 114.52],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [21.73, 119.7, 25.65, 122.39],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [0, 98.7, 8, 120.17],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}, {
|
||||
"bbox": [0.86, 103.2, 1.92, 104.45],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© AND",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -90, -180, 90, 180],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 10
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 MapData Sciences Pty Ltd, PSMA",
|
||||
"coverageAreas": [{
|
||||
"bbox": [ -45, 111, -9, 156],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 5
|
||||
}, {
|
||||
"bbox": [ -49.7, 164.42, -30.82, 180],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 5
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"attribution": "© 2015 Zenrin",
|
||||
"coverageAreas": [{
|
||||
"bbox": [23.5, 122.5, 46.65, 151.66],
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"vintageEnd": null,
|
||||
"vintageStart": null,
|
||||
"zoomMax": 21,
|
||||
"zoomMin": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"statusCode": 200,
|
||||
"statusDescription": "OK",
|
||||
"traceId": "510519adad2f4977a0ce328eafbf702c|DB40190745|02.00.163.2700|"
|
||||
}
|
||||
81
test/spec/ol/source/bingmapssource.test.js
Normal file
81
test/spec/ol/source/bingmapssource.test.js
Normal file
@@ -0,0 +1,81 @@
|
||||
goog.provide('ol.test.source.BingMaps');
|
||||
|
||||
describe('ol.source.BingMaps', function() {
|
||||
|
||||
describe('#tileUrlFunction()', function() {
|
||||
|
||||
var source, tileGrid;
|
||||
|
||||
beforeEach(function(done) {
|
||||
var googNetJsonp = goog.net.Jsonp;
|
||||
// mock goog.net.Jsonp (used in the ol.source.TileJSON constructor)
|
||||
goog.net.Jsonp = function() {
|
||||
this.send = function() {
|
||||
var callback = arguments[1];
|
||||
var client = new XMLHttpRequest();
|
||||
client.open('GET', 'spec/ol/data/bing_aerialwithlabels.json', true);
|
||||
client.onload = function() {
|
||||
callback(JSON.parse(client.responseText));
|
||||
};
|
||||
client.send();
|
||||
};
|
||||
};
|
||||
source = new ol.source.BingMaps({
|
||||
imagerySet: 'AerialWithLabels',
|
||||
key: ''
|
||||
});
|
||||
goog.net.Jsonp = googNetJsonp;
|
||||
var key = source.on('change', function() {
|
||||
if (source.getState() === 'ready') {
|
||||
source.unByKey(key);
|
||||
tileGrid = source.getTileGrid();
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
|
||||
var coordinate = [829330.2064098881, 5933916.615134273];
|
||||
var projection = source.getProjection();
|
||||
var regex = /\/tiles\/h(.*)\.jpeg/;
|
||||
var tileUrl;
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey([1, 1, 0]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey([2, 2, 1]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey([3, 4, 2]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey([4, 8, 5]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey(
|
||||
[5, 16, 11]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(ol.tilecoord.quadKey(
|
||||
[6, 33, 22]));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
goog.require('goog.net.Jsonp');
|
||||
goog.require('ol.source.BingMaps');
|
||||
goog.require('ol.tilecoord');
|
||||
@@ -15,7 +15,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
|
||||
it('returns a tile with the expected URL', function() {
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
expect(tile).to.be.an(ol.ImageTile);
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
expect(uri.getScheme()).to.be('http');
|
||||
@@ -23,8 +23,8 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
expect(uri.getPath()).to.be('/MapServer/export');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('FORMAT')).to.be('PNG32');
|
||||
expect(queryData.get('SIZE')).to.be('256,256');
|
||||
expect(queryData.get('IMAGESR')).to.be('3857');
|
||||
@@ -39,7 +39,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
'http://test2.com/MapServer'];
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
expect(tile).to.be.an(ol.ImageTile);
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
expect(uri.getScheme()).to.be('http');
|
||||
@@ -47,8 +47,8 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
expect(uri.getPath()).to.be('/MapServer/export');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('FORMAT')).to.be('PNG32');
|
||||
expect(queryData.get('SIZE')).to.be('256,256');
|
||||
expect(queryData.get('IMAGESR')).to.be('3857');
|
||||
@@ -60,7 +60,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
it('returns a tile with the expected URL for ImageServer', function() {
|
||||
options.url = 'http://example.com/ImageServer';
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
expect(tile).to.be.an(ol.ImageTile);
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
expect(uri.getScheme()).to.be('http');
|
||||
@@ -68,8 +68,8 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
expect(uri.getPath()).to.be('/ImageServer/exportImage');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('FORMAT')).to.be('PNG32');
|
||||
expect(queryData.get('SIZE')).to.be('256,256');
|
||||
expect(queryData.get('IMAGESR')).to.be('3857');
|
||||
@@ -81,7 +81,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
options.params.FORMAT = 'png';
|
||||
options.params.TRANSPARENT = false;
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('FORMAT')).to.be('png');
|
||||
@@ -91,7 +91,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
it('allows adding rest option', function() {
|
||||
options.params.LAYERS = 'show:1,3,4';
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('LAYERS')).to.be('show:1,3,4');
|
||||
@@ -104,7 +104,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
source.updateParams({ 'TEST': 'value' });
|
||||
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
source.updateParams({ 'TEST': 'newValue' });
|
||||
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
|
||||
|
||||
@@ -123,14 +123,14 @@ describe('ol.source.Tile', function() {
|
||||
wrapX: true
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, -23]);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, -23]);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, -23]);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
});
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: false}', function() {
|
||||
@@ -139,13 +139,13 @@ describe('ol.source.Tile', function() {
|
||||
wrapX: false
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, 22]);
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, -23]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, -23]);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, -23]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,10 +20,10 @@ describe('ol.source.TileVector', function() {
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
source.loadFeatures(
|
||||
[-8238854, 4969777, -8237854, 4970777], 4.8, projection);
|
||||
expect(tileCoords[0]).to.eql([15, 9647, 12320]);
|
||||
expect(tileCoords[1]).to.eql([15, 9647, 12319]);
|
||||
expect(tileCoords[2]).to.eql([15, 9648, 12320]);
|
||||
expect(tileCoords[3]).to.eql([15, 9648, 12319]);
|
||||
expect(tileCoords[0]).to.eql([15, 9647, -12321]);
|
||||
expect(tileCoords[1]).to.eql([15, 9647, -12320]);
|
||||
expect(tileCoords[2]).to.eql([15, 9648, -12321]);
|
||||
expect(tileCoords[3]).to.eql([15, 9648, -12320]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -41,16 +41,16 @@ describe('ol.source.TileVector', function() {
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, -31, 41], projection);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
[6, -31, -23], projection);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 41], projection);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
[6, 33, -23], projection);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 97, 41], projection);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
[6, 97, -23], projection);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
});
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: false}', function() {
|
||||
@@ -64,15 +64,15 @@ describe('ol.source.TileVector', function() {
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, -31, 41], projection);
|
||||
[6, -31, -23], projection);
|
||||
expect(tileCoord).to.eql(null);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 41], projection);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
[6, 33, -23], projection);
|
||||
expect(tileCoord).to.eql([6, 33, -23]);
|
||||
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 97, 41], projection);
|
||||
[6, 97, -23], projection);
|
||||
expect(tileCoord).to.eql(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('ol.source.TileWMS', function() {
|
||||
|
||||
it('returns a tile with the expected URL', function() {
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
expect(tile).to.be.an(ol.ImageTile);
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
expect(uri.getScheme()).to.be('http');
|
||||
@@ -25,8 +25,8 @@ describe('ol.source.TileWMS', function() {
|
||||
expect(uri.getPath()).to.be('/wms');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('CRS')).to.be('EPSG:3857');
|
||||
expect(queryData.get('FORMAT')).to.be('image/png');
|
||||
expect(queryData.get('HEIGHT')).to.be('256');
|
||||
@@ -44,13 +44,13 @@ describe('ol.source.TileWMS', function() {
|
||||
it('returns a larger tile when a gutter is specified', function() {
|
||||
options.gutter = 16;
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:3857'));
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
expect(tile).to.be.an(ol.ImageTile);
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
var bbox = queryData.get('BBOX').split(',');
|
||||
var expected = [-10331840.239250705, -15341217.324948015,
|
||||
-4696291.017841229, -9705668.103538537];
|
||||
var expected = [-10331840.239250705, -15341217.324948018,
|
||||
-4696291.017841229, -9705668.103538541];
|
||||
for (var i = 0, ii = bbox.length; i < ii; ++i) {
|
||||
expect(parseFloat(bbox[i])).to.roughlyEqual(expected[i], 1e-9);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('sets the SRS query value instead of CRS if version < 1.3', function() {
|
||||
options.params.VERSION = '1.2';
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('CRS')).to.be(undefined);
|
||||
@@ -72,7 +72,7 @@ describe('ol.source.TileWMS', function() {
|
||||
options.params.FORMAT = 'image/jpeg';
|
||||
options.params.TRANSPARENT = false;
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('FORMAT')).to.be('image/jpeg');
|
||||
@@ -82,7 +82,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('does not add a STYLES= option if one is specified', function() {
|
||||
options.params.STYLES = 'foo';
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('STYLES')).to.be('foo');
|
||||
@@ -90,7 +90,7 @@ describe('ol.source.TileWMS', function() {
|
||||
|
||||
it('changes the BBOX order for EN axis orientations', function() {
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('EPSG:4326'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be('-45,-90,0,-45');
|
||||
@@ -99,7 +99,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('uses EN BBOX order if version < 1.3', function() {
|
||||
options.params.VERSION = '1.1.0';
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1, ol.proj.get('CRS:84'));
|
||||
var tile = source.getTile(3, 2, -3, 1, ol.proj.get('CRS:84'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be('-90,-45,-45,0');
|
||||
@@ -108,7 +108,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
|
||||
options.serverType = ol.source.wms.ServerType.GEOSERVER;
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 2, ol.proj.get('CRS:84'));
|
||||
var tile = source.getTile(3, 2, -3, 2, ol.proj.get('CRS:84'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:180');
|
||||
@@ -118,7 +118,7 @@ describe('ol.source.TileWMS', function() {
|
||||
options.serverType = ol.source.wms.ServerType.GEOSERVER;
|
||||
var source = new ol.source.TileWMS(options);
|
||||
options.params.FORMAT_OPTIONS = 'param1:value1';
|
||||
var tile = source.getTile(3, 2, 1, 2, ol.proj.get('CRS:84'));
|
||||
var tile = source.getTile(3, 2, -3, 2, ol.proj.get('CRS:84'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('param1:value1;dpi:180');
|
||||
@@ -128,7 +128,7 @@ describe('ol.source.TileWMS', function() {
|
||||
function() {
|
||||
options.serverType = ol.source.wms.ServerType.GEOSERVER;
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, 1, 1.325, ol.proj.get('CRS:84'));
|
||||
var tile = source.getTile(3, 2, -3, 1.325, ol.proj.get('CRS:84'));
|
||||
var uri = new goog.Uri(tile.src_);
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
|
||||
@@ -141,7 +141,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('returns a tile if it is contained within layers extent', function() {
|
||||
options.extent = [-80, -40, -50, -10];
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tileCoord = [3, 2, 1];
|
||||
var tileCoord = [3, 2, -3];
|
||||
var url = source.tileUrlFunction(tileCoord, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(url);
|
||||
var queryData = uri.getQueryData();
|
||||
@@ -151,7 +151,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('returns a tile if it intersects layers extent', function() {
|
||||
options.extent = [-80, -40, -40, -10];
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tileCoord = [3, 3, 1];
|
||||
var tileCoord = [3, 3, -3];
|
||||
var url = source.tileUrlFunction(tileCoord, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(url);
|
||||
var queryData = uri.getQueryData();
|
||||
@@ -165,7 +165,7 @@ describe('ol.source.TileWMS', function() {
|
||||
origin: [-180, -90]
|
||||
});
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tileCoord = [3, 3, 1];
|
||||
var tileCoord = [3, 3, -3];
|
||||
var url = source.tileUrlFunction(tileCoord, 1, ol.proj.get('EPSG:4326'));
|
||||
var uri = new goog.Uri(url);
|
||||
var queryData = uri.getQueryData();
|
||||
@@ -190,8 +190,8 @@ describe('ol.source.TileWMS', function() {
|
||||
expect(uri.getPath()).to.be('/wms');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('CRS')).to.be('EPSG:3857');
|
||||
expect(queryData.get('FORMAT')).to.be('image/png');
|
||||
expect(queryData.get('HEIGHT')).to.be('256');
|
||||
@@ -222,8 +222,8 @@ describe('ol.source.TileWMS', function() {
|
||||
expect(uri.getPath()).to.be('/wms');
|
||||
var queryData = uri.getQueryData();
|
||||
expect(queryData.get('BBOX')).to.be(
|
||||
'-10018754.171394622,-15028131.257091932,' +
|
||||
'-5009377.085697311,-10018754.17139462');
|
||||
'-10018754.171394622,-15028131.257091936,' +
|
||||
'-5009377.085697311,-10018754.171394624');
|
||||
expect(queryData.get('CRS')).to.be('EPSG:3857');
|
||||
expect(queryData.get('FORMAT')).to.be('image/png');
|
||||
expect(queryData.get('HEIGHT')).to.be('256');
|
||||
|
||||
@@ -67,17 +67,17 @@ describe('ol.source.XYZ', function() {
|
||||
var projection = xyzTileSource.getProjection();
|
||||
var tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, -31, 41], projection));
|
||||
[6, -31, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 41], projection));
|
||||
[6, 33, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 97, 41], projection));
|
||||
[6, 97, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
});
|
||||
|
||||
@@ -89,17 +89,17 @@ describe('ol.source.XYZ', function() {
|
||||
var projection = xyzTileSource.getProjection();
|
||||
var tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 150], projection));
|
||||
[6, 33, 0], projection));
|
||||
expect(tileUrl).to.be(undefined);
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 41], projection));
|
||||
[6, 33, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -23], projection));
|
||||
[6, 33, -65], projection));
|
||||
expect(tileUrl).to.be(undefined);
|
||||
});
|
||||
|
||||
|
||||
@@ -11,15 +11,6 @@ describe('ol.TileCoord', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('create from quad key', function() {
|
||||
it('sets x y z properties as expected', function() {
|
||||
var tileCoord = ol.tilecoord.createFromQuadKey('213');
|
||||
expect(tileCoord[0]).to.eql(3);
|
||||
expect(tileCoord[1]).to.eql(3);
|
||||
expect(tileCoord[2]).to.eql(5);
|
||||
});
|
||||
});
|
||||
|
||||
describe('create from string', function() {
|
||||
it('sets x y z properties as expected', function() {
|
||||
var str = '1/2/3';
|
||||
@@ -56,21 +47,21 @@ describe('ol.TileCoord', function() {
|
||||
resolutions: [2, 1],
|
||||
minZoom: 1
|
||||
});
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, 0], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([1, 0, 0], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([2, 0, 0], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, -1], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([1, 0, -1], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([2, 0, -1], tileGrid)).to.be(false);
|
||||
});
|
||||
|
||||
it('restricts by extent when extent defines tile ranges', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
extent: [10, 20, 30, 40],
|
||||
sizes: [[3, 3]],
|
||||
sizes: [[3, -3]],
|
||||
tileSize: 10,
|
||||
resolutions: [1]
|
||||
});
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 1, 1], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 2, 0], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, 2], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 1, -2], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 2, -1], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, -3], tileGrid)).to.be(false);
|
||||
});
|
||||
|
||||
it('restricts by extent when sizes define tile ranges', function() {
|
||||
@@ -88,6 +79,21 @@ describe('ol.TileCoord', function() {
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, 3], tileGrid)).to.be(false);
|
||||
});
|
||||
|
||||
it('restricts by extent when sizes (neg y) define tile ranges', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 40],
|
||||
sizes: [[3, -3]],
|
||||
tileSize: 10,
|
||||
resolutions: [1]
|
||||
});
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, -1], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, -1, -1], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, 0], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 2, -3], tileGrid)).to.be(true);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 3, -1], tileGrid)).to.be(false);
|
||||
expect(ol.tilecoord.withinExtentAndZ([0, 0, -4], tileGrid)).to.be(false);
|
||||
});
|
||||
|
||||
it('does not restrict by extent with no extent or sizes', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 20],
|
||||
|
||||
@@ -205,16 +205,16 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('assumes bottom left corner of extent as origin', function() {
|
||||
expect(tileGrid.getOrigin()).to.eql([10, 20]);
|
||||
it('assumes top left corner of extent as origin', function() {
|
||||
expect(tileGrid.getOrigin()).to.eql([10, 40]);
|
||||
});
|
||||
|
||||
it('calculates full tile ranges from extent', function() {
|
||||
var fullTileRange = tileGrid.getFullTileRange(0);
|
||||
expect(fullTileRange.minX).to.equal(0);
|
||||
expect(fullTileRange.maxX).to.equal(1);
|
||||
expect(fullTileRange.minY).to.equal(0);
|
||||
expect(fullTileRange.maxY).to.equal(1);
|
||||
expect(fullTileRange.minY).to.equal(-2);
|
||||
expect(fullTileRange.maxY).to.equal(-1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
beforeEach(function() {
|
||||
tileGrid = new ol.tilegrid.TileGrid({
|
||||
extent: [10, 20, 30, 40],
|
||||
sizes: [[3, 3]],
|
||||
sizes: [[3, -3]],
|
||||
tileSize: 10,
|
||||
resolutions: [1]
|
||||
});
|
||||
@@ -237,8 +237,8 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
var fullTileRange = tileGrid.getFullTileRange(0);
|
||||
expect(fullTileRange.minX).to.equal(0);
|
||||
expect(fullTileRange.maxX).to.equal(2);
|
||||
expect(fullTileRange.minY).to.equal(0);
|
||||
expect(fullTileRange.maxY).to.equal(2);
|
||||
expect(fullTileRange.minY).to.equal(-3);
|
||||
expect(fullTileRange.maxY).to.equal(-1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -253,13 +253,31 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('calculates correct minX and maxX for negative heights', function() {
|
||||
it('calculates correct minY and maxY for negative heights', function() {
|
||||
var fullTileRange = tileGrid.getFullTileRange(0);
|
||||
expect(fullTileRange.minY).to.equal(-3);
|
||||
expect(fullTileRange.maxY).to.equal(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with bottom-left origin and sizes', function() {
|
||||
var tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 10],
|
||||
sizes: [[3, 3]],
|
||||
tileSize: 10,
|
||||
resolutions: [1]
|
||||
});
|
||||
});
|
||||
|
||||
it('calculates correct minX and maxX for positive heights', function() {
|
||||
var fullTileRange = tileGrid.getFullTileRange(0);
|
||||
expect(fullTileRange.minY).to.equal(0);
|
||||
expect(fullTileRange.maxY).to.equal(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with extent and origin', function() {
|
||||
it('uses both origin and extent', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
@@ -281,7 +299,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
var resolutions = grid.getResolutions();
|
||||
expect(resolutions.length).to.be(ol.DEFAULT_MAX_ZOOM + 1);
|
||||
expect(grid.getOrigin()).to.eql([-100, -100]);
|
||||
expect(grid.getOrigin()).to.eql([-100, 100]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -324,12 +342,12 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
ol.DEFAULT_TILE_SIZE / Math.pow(2, 5));
|
||||
});
|
||||
|
||||
it('assumes origin is bottom-left', function() {
|
||||
it('assumes origin is top-left', function() {
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection);
|
||||
var origin = grid.getOrigin();
|
||||
var half = ol.proj.EPSG3857.HALF_SIZE;
|
||||
expect(origin).to.eql([-half, -half]);
|
||||
expect(origin).to.eql([-half, half]);
|
||||
});
|
||||
|
||||
it('accepts bottom-left as corner', function() {
|
||||
@@ -370,78 +388,6 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('createOriginTopLeftTileCoordTransform', function() {
|
||||
|
||||
it('transforms y to -y-1 for top-left origins', function() {
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 40],
|
||||
sizes: [[2, -2], [4, -4]],
|
||||
resolutions: [1, 0.5],
|
||||
tileSize: 10
|
||||
});
|
||||
var transformFn = goog.bind(
|
||||
ol.tilegrid.originTopLeftTileCoordTransform, tileGrid);
|
||||
expect(transformFn([0, 0, -2])).to.eql([0, 0, 1]);
|
||||
expect(transformFn([0, 0, -1])).to.eql([0, 0, 0]);
|
||||
expect(transformFn([1, 0, -4])).to.eql([1, 0, 3]);
|
||||
expect(transformFn([1, 0, -1])).to.eql([1, 0, 0]);
|
||||
});
|
||||
|
||||
it('transforms y to -y-1 when origin corner is not specified', function() {
|
||||
var tileGrid1 = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 20],
|
||||
resolutions: [1, 0.5],
|
||||
tileSize: 10
|
||||
});
|
||||
var tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 40],
|
||||
resolutions: [1, 0.5],
|
||||
tileSize: 10
|
||||
});
|
||||
var transformFn1 = goog.bind(
|
||||
ol.tilegrid.originTopLeftTileCoordTransform, tileGrid);
|
||||
var transformFn2 = goog.bind(
|
||||
ol.tilegrid.originTopLeftTileCoordTransform, tileGrid1);
|
||||
expect(transformFn1([0, 0, -2])).to.eql([0, 0, 1]);
|
||||
expect(transformFn2([0, 0, -2])).to.eql([0, 0, 1]);
|
||||
expect(transformFn1([0, 0, -1])).to.eql([0, 0, 0]);
|
||||
expect(transformFn2([0, 0, -1])).to.eql([0, 0, 0]);
|
||||
expect(transformFn1([1, 0, -4])).to.eql([1, 0, 3]);
|
||||
expect(transformFn2([1, 0, -4])).to.eql([1, 0, 3]);
|
||||
expect(transformFn1([1, 0, -1])).to.eql([1, 0, 0]);
|
||||
expect(transformFn2([1, 0, -1])).to.eql([1, 0, 0]);
|
||||
});
|
||||
|
||||
it('transforms y to height-y-1 for bottom-left origins', function() {
|
||||
var tileGrid1 = new ol.tilegrid.TileGrid({
|
||||
extent: [10, 20, 30, 40],
|
||||
resolutions: [1, 0.5],
|
||||
tileSize: 10
|
||||
});
|
||||
var tileGrid2 = new ol.tilegrid.TileGrid({
|
||||
origin: [10, 20],
|
||||
sizes: [[2, 2], [4, 4]],
|
||||
resolutions: [1, 0.5],
|
||||
tileSize: 10
|
||||
});
|
||||
var transformFn1 = goog.bind(
|
||||
ol.tilegrid.originTopLeftTileCoordTransform, tileGrid1);
|
||||
var transformFn2 = goog.bind(
|
||||
ol.tilegrid.originTopLeftTileCoordTransform, tileGrid2);
|
||||
expect(tileGrid1.getFullTileRange(0).getHeight()).to.equal(2);
|
||||
expect(transformFn1([0, 0, 0])).to.eql([0, 0, 1]);
|
||||
expect(transformFn2([0, 0, 0])).to.eql([0, 0, 1]);
|
||||
expect(transformFn1([0, 0, 1])).to.eql([0, 0, 0]);
|
||||
expect(transformFn2([0, 0, 1])).to.eql([0, 0, 0]);
|
||||
expect(tileGrid1.getFullTileRange(1).getHeight()).to.equal(4);
|
||||
expect(transformFn1([1, 0, 0])).to.eql([1, 0, 3]);
|
||||
expect(transformFn2([1, 0, 0])).to.eql([1, 0, 3]);
|
||||
expect(transformFn1([1, 0, 3])).to.eql([1, 0, 0]);
|
||||
expect(transformFn2([1, 0, 3])).to.eql([1, 0, 0]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('createXYZ()', function() {
|
||||
|
||||
it('uses defaults', function() {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
goog.provide('ol.test.tilegrid.Zoomify');
|
||||
|
||||
describe('ol.tilegrid.Zoomify', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed with minimal arguments', function() {
|
||||
var instance = new ol.tilegrid.Zoomify({
|
||||
resolutions: [],
|
||||
extent: [],
|
||||
origin: [],
|
||||
tileSize: []
|
||||
});
|
||||
expect(instance).to.be.an(ol.tilegrid.Zoomify);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.tilegrid.Zoomify');
|
||||
@@ -30,16 +30,16 @@ describe('ol.TileUrlFunction', function() {
|
||||
describe('createFromTemplate', function() {
|
||||
it('creates expected URL', function() {
|
||||
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{y}');
|
||||
expect(tileUrl([3, 2, 1])).to.eql('3/2/1');
|
||||
expect(tileUrl([3, 2, -2])).to.eql('3/2/1');
|
||||
expect(tileUrl(null)).to.be(undefined);
|
||||
});
|
||||
it('accepts {-y} placeholder', function() {
|
||||
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{-y}');
|
||||
expect(tileUrl([3, 2, 2])).to.eql('3/2/5');
|
||||
expect(tileUrl([3, 2, -3])).to.eql('3/2/5');
|
||||
});
|
||||
it('replaces multiple placeholder occurrences', function() {
|
||||
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{z}{x}{y}');
|
||||
expect(tileUrl([3, 2, 1])).to.eql('3/321');
|
||||
expect(tileUrl([3, 2, -2])).to.eql('3/321');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
'http://tile-3/{z}/{x}/{y}'
|
||||
];
|
||||
var tileUrlFunction = ol.TileUrlFunction.createFromTemplates(templates);
|
||||
var tileCoord = [3, 2, 1];
|
||||
var tileCoord = [3, 2, -2];
|
||||
|
||||
sinon.stub(ol.tilecoord, 'hash', function() { return 3; });
|
||||
expect(tileUrlFunction(tileCoord)).to.eql('http://tile-1/3/2/1');
|
||||
|
||||
Reference in New Issue
Block a user