MapboxStyleImageryProvider.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. import Credit from "../Core/Credit.js";
  2. import defaultValue from "../Core/defaultValue.js";
  3. import defined from "../Core/defined.js";
  4. import deprecationWarning from "../Core/deprecationWarning.js";
  5. import DeveloperError from "../Core/DeveloperError.js";
  6. import Resource from "../Core/Resource.js";
  7. import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js";
  8. const trailingSlashRegex = /\/$/;
  9. const defaultCredit = new Credit(
  10. '&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>'
  11. );
  12. /**
  13. * @typedef {object} MapboxStyleImageryProvider.ConstructorOptions
  14. *
  15. * Initialization options for the MapboxStyleImageryProvider constructor
  16. *
  17. * @property {Resource|string} [url='https://api.mapbox.com/styles/v1/'] The Mapbox server url.
  18. * @property {string} [username='mapbox'] The username of the map account.
  19. * @property {string} styleId The Mapbox Style ID.
  20. * @property {string} accessToken The public access token for the imagery.
  21. * @property {number} [tilesize=512] The size of the image tiles.
  22. * @property {boolean} [scaleFactor] Determines if tiles are rendered at a @2x scale factor.
  23. * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used.
  24. * @property {number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
  25. * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
  26. * to result in rendering problems.
  27. * @property {number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit.
  28. * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
  29. * @property {Credit|string} [credit] A credit for the data source, which is displayed on the canvas.
  30. */
  31. /**
  32. * Provides tiled imagery hosted by Mapbox.
  33. *
  34. * @alias MapboxStyleImageryProvider
  35. * @constructor
  36. *
  37. * @param {MapboxStyleImageryProvider.ConstructorOptions} options Object describing initialization options
  38. *
  39. * @example
  40. * // Mapbox style provider
  41. * const mapbox = new Cesium.MapboxStyleImageryProvider({
  42. * styleId: 'streets-v11',
  43. * accessToken: 'thisIsMyAccessToken'
  44. * });
  45. *
  46. * @see {@link https://docs.mapbox.com/api/maps/#styles}
  47. * @see {@link https://docs.mapbox.com/api/#access-tokens-and-token-scopes}
  48. */
  49. function MapboxStyleImageryProvider(options) {
  50. options = defaultValue(options, defaultValue.EMPTY_OBJECT);
  51. const styleId = options.styleId;
  52. //>>includeStart('debug', pragmas.debug);
  53. if (!defined(styleId)) {
  54. throw new DeveloperError("options.styleId is required.");
  55. }
  56. //>>includeEnd('debug');
  57. const accessToken = options.accessToken;
  58. //>>includeStart('debug', pragmas.debug);
  59. if (!defined(accessToken)) {
  60. throw new DeveloperError("options.accessToken is required.");
  61. }
  62. //>>includeEnd('debug');
  63. this._defaultAlpha = undefined;
  64. this._defaultNightAlpha = undefined;
  65. this._defaultDayAlpha = undefined;
  66. this._defaultBrightness = undefined;
  67. this._defaultContrast = undefined;
  68. this._defaultHue = undefined;
  69. this._defaultSaturation = undefined;
  70. this._defaultGamma = undefined;
  71. this._defaultMinificationFilter = undefined;
  72. this._defaultMagnificationFilter = undefined;
  73. const resource = Resource.createIfNeeded(
  74. defaultValue(options.url, "https://api.mapbox.com/styles/v1/")
  75. );
  76. this._styleId = styleId;
  77. this._accessToken = accessToken;
  78. const tilesize = defaultValue(options.tilesize, 512);
  79. this._tilesize = tilesize;
  80. const username = defaultValue(options.username, "mapbox");
  81. this._username = username;
  82. const scaleFactor = defined(options.scaleFactor) ? "@2x" : "";
  83. let templateUrl = resource.getUrlComponent();
  84. if (!trailingSlashRegex.test(templateUrl)) {
  85. templateUrl += "/";
  86. }
  87. templateUrl += `${this._username}/${styleId}/tiles/${this._tilesize}/{z}/{x}/{y}${scaleFactor}`;
  88. resource.url = templateUrl;
  89. resource.setQueryParameters({
  90. access_token: accessToken,
  91. });
  92. let credit;
  93. if (defined(options.credit)) {
  94. credit = options.credit;
  95. if (typeof credit === "string") {
  96. credit = new Credit(credit);
  97. }
  98. } else {
  99. credit = defaultCredit;
  100. }
  101. this._resource = resource;
  102. this._imageryProvider = new UrlTemplateImageryProvider({
  103. url: resource,
  104. credit: credit,
  105. ellipsoid: options.ellipsoid,
  106. minimumLevel: options.minimumLevel,
  107. maximumLevel: options.maximumLevel,
  108. rectangle: options.rectangle,
  109. });
  110. this._ready = true;
  111. this._readyPromise = Promise.resolve(true);
  112. }
  113. Object.defineProperties(MapboxStyleImageryProvider.prototype, {
  114. /**
  115. * Gets the URL of the Mapbox server.
  116. * @memberof MapboxStyleImageryProvider.prototype
  117. * @type {string}
  118. * @readonly
  119. */
  120. url: {
  121. get: function () {
  122. return this._imageryProvider.url;
  123. },
  124. },
  125. /**
  126. * Gets a value indicating whether or not the provider is ready for use.
  127. * @memberof MapboxStyleImageryProvider.prototype
  128. * @type {boolean}
  129. * @readonly
  130. * @deprecated
  131. */
  132. ready: {
  133. get: function () {
  134. deprecationWarning(
  135. "MapboxStyleImageryProvider.ready",
  136. "MapboxStyleImageryProvider.ready was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107."
  137. );
  138. return this._imageryProvider.ready;
  139. },
  140. },
  141. /**
  142. * Gets a promise that resolves to true when the provider is ready for use.
  143. * @memberof MapboxStyleImageryProvider.prototype
  144. * @type {Promise<boolean>}
  145. * @readonly
  146. * @deprecated
  147. */
  148. readyPromise: {
  149. get: function () {
  150. deprecationWarning(
  151. "MapboxStyleImageryProvider.readyPromise",
  152. "MapboxStyleImageryProvider.readyPromise was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107."
  153. );
  154. return this._imageryProvider.readyPromise;
  155. },
  156. },
  157. /**
  158. * Gets the rectangle, in radians, of the imagery provided by the instance.
  159. * @memberof MapboxStyleImageryProvider.prototype
  160. * @type {Rectangle}
  161. * @readonly
  162. */
  163. rectangle: {
  164. get: function () {
  165. return this._imageryProvider.rectangle;
  166. },
  167. },
  168. /**
  169. * Gets the width of each tile, in pixels.
  170. * @memberof MapboxStyleImageryProvider.prototype
  171. * @type {number}
  172. * @readonly
  173. */
  174. tileWidth: {
  175. get: function () {
  176. return this._imageryProvider.tileWidth;
  177. },
  178. },
  179. /**
  180. * Gets the height of each tile, in pixels.
  181. * @memberof MapboxStyleImageryProvider.prototype
  182. * @type {number}
  183. * @readonly
  184. */
  185. tileHeight: {
  186. get: function () {
  187. return this._imageryProvider.tileHeight;
  188. },
  189. },
  190. /**
  191. * Gets the maximum level-of-detail that can be requested.
  192. * @memberof MapboxStyleImageryProvider.prototype
  193. * @type {number|undefined}
  194. * @readonly
  195. */
  196. maximumLevel: {
  197. get: function () {
  198. return this._imageryProvider.maximumLevel;
  199. },
  200. },
  201. /**
  202. * Gets the minimum level-of-detail that can be requested. Generally,
  203. * a minimum level should only be used when the rectangle of the imagery is small
  204. * enough that the number of tiles at the minimum level is small. An imagery
  205. * provider with more than a few tiles at the minimum level will lead to
  206. * rendering problems.
  207. * @memberof MapboxStyleImageryProvider.prototype
  208. * @type {number}
  209. * @readonly
  210. */
  211. minimumLevel: {
  212. get: function () {
  213. return this._imageryProvider.minimumLevel;
  214. },
  215. },
  216. /**
  217. * Gets the tiling scheme used by the provider.
  218. * @memberof MapboxStyleImageryProvider.prototype
  219. * @type {TilingScheme}
  220. * @readonly
  221. */
  222. tilingScheme: {
  223. get: function () {
  224. return this._imageryProvider.tilingScheme;
  225. },
  226. },
  227. /**
  228. * Gets the tile discard policy. If not undefined, the discard policy is responsible
  229. * for filtering out "missing" tiles via its shouldDiscardImage function. If this function
  230. * returns undefined, no tiles are filtered.
  231. * @memberof MapboxStyleImageryProvider.prototype
  232. * @type {TileDiscardPolicy}
  233. * @readonly
  234. */
  235. tileDiscardPolicy: {
  236. get: function () {
  237. return this._imageryProvider.tileDiscardPolicy;
  238. },
  239. },
  240. /**
  241. * Gets an event that is raised when the imagery provider encounters an asynchronous error.. By subscribing
  242. * to the event, you will be notified of the error and can potentially recover from it. Event listeners
  243. * are passed an instance of {@link TileProviderError}.
  244. * @memberof MapboxStyleImageryProvider.prototype
  245. * @type {Event}
  246. * @readonly
  247. */
  248. errorEvent: {
  249. get: function () {
  250. return this._imageryProvider.errorEvent;
  251. },
  252. },
  253. /**
  254. * Gets the credit to display when this imagery provider is active. Typically this is used to credit
  255. * the source of the imagery.
  256. * @memberof MapboxStyleImageryProvider.prototype
  257. * @type {Credit}
  258. * @readonly
  259. */
  260. credit: {
  261. get: function () {
  262. return this._imageryProvider.credit;
  263. },
  264. },
  265. /**
  266. * Gets the proxy used by this provider.
  267. * @memberof MapboxStyleImageryProvider.prototype
  268. * @type {Proxy}
  269. * @readonly
  270. */
  271. proxy: {
  272. get: function () {
  273. return this._imageryProvider.proxy;
  274. },
  275. },
  276. /**
  277. * Gets a value indicating whether or not the images provided by this imagery provider
  278. * include an alpha channel. If this property is false, an alpha channel, if present, will
  279. * be ignored. If this property is true, any images without an alpha channel will be treated
  280. * as if their alpha is 1.0 everywhere. When this property is false, memory usage
  281. * and texture upload time are reduced.
  282. * @memberof MapboxStyleImageryProvider.prototype
  283. * @type {boolean}
  284. * @readonly
  285. */
  286. hasAlphaChannel: {
  287. get: function () {
  288. return this._imageryProvider.hasAlphaChannel;
  289. },
  290. },
  291. /**
  292. * The default alpha blending value of this provider, with 0.0 representing fully transparent and
  293. * 1.0 representing fully opaque.
  294. * @memberof MapboxStyleImageryProvider.prototype
  295. * @type {Number|undefined}
  296. * @deprecated
  297. */
  298. defaultAlpha: {
  299. get: function () {
  300. deprecationWarning(
  301. "MapboxStyleImageryProvider.defaultAlpha",
  302. "MapboxStyleImageryProvider.defaultAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.alpha instead."
  303. );
  304. return this._defaultAlpha;
  305. },
  306. set: function (value) {
  307. deprecationWarning(
  308. "MapboxStyleImageryProvider.defaultAlpha",
  309. "MapboxStyleImageryProvider.defaultAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.alpha instead."
  310. );
  311. this._defaultAlpha = value;
  312. },
  313. },
  314. /**
  315. * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and
  316. * 1.0 representing fully opaque.
  317. * @memberof MapboxStyleImageryProvider.prototype
  318. * @type {Number|undefined}
  319. * @deprecated
  320. */
  321. defaultNightAlpha: {
  322. get: function () {
  323. deprecationWarning(
  324. "MapboxStyleImageryProvider.defaultNightAlpha",
  325. "MapboxStyleImageryProvider.defaultNightAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.nightAlpha instead."
  326. );
  327. return this._defaultNightAlpha;
  328. },
  329. set: function (value) {
  330. deprecationWarning(
  331. "MapboxStyleImageryProvider.defaultNightAlpha",
  332. "MapboxStyleImageryProvider.defaultNightAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.nightAlpha instead."
  333. );
  334. this._defaultNightAlpha = value;
  335. },
  336. },
  337. /**
  338. * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and
  339. * 1.0 representing fully opaque.
  340. * @memberof MapboxStyleImageryProvider.prototype
  341. * @type {Number|undefined}
  342. * @deprecated
  343. */
  344. defaultDayAlpha: {
  345. get: function () {
  346. deprecationWarning(
  347. "MapboxStyleImageryProvider.defaultDayAlpha",
  348. "MapboxStyleImageryProvider.defaultDayAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.dayAlpha instead."
  349. );
  350. return this._defaultDayAlpha;
  351. },
  352. set: function (value) {
  353. deprecationWarning(
  354. "MapboxStyleImageryProvider.defaultDayAlpha",
  355. "MapboxStyleImageryProvider.defaultDayAlpha was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.dayAlpha instead."
  356. );
  357. this._defaultDayAlpha = value;
  358. },
  359. },
  360. /**
  361. * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0
  362. * makes the imagery darker while greater than 1.0 makes it brighter.
  363. * @memberof MapboxStyleImageryProvider.prototype
  364. * @type {Number|undefined}
  365. * @deprecated
  366. */
  367. defaultBrightness: {
  368. get: function () {
  369. deprecationWarning(
  370. "MapboxStyleImageryProvider.defaultBrightness",
  371. "MapboxStyleImageryProvider.defaultBrightness was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.brightness instead."
  372. );
  373. return this._defaultBrightness;
  374. },
  375. set: function (value) {
  376. deprecationWarning(
  377. "MapboxStyleImageryProvider.defaultBrightness",
  378. "MapboxStyleImageryProvider.defaultBrightness was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.brightness instead."
  379. );
  380. this._defaultBrightness = value;
  381. },
  382. },
  383. /**
  384. * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces
  385. * the contrast while greater than 1.0 increases it.
  386. * @memberof MapboxStyleImageryProvider.prototype
  387. * @type {Number|undefined}
  388. * @deprecated
  389. */
  390. defaultContrast: {
  391. get: function () {
  392. deprecationWarning(
  393. "MapboxStyleImageryProvider.defaultContrast",
  394. "MapboxStyleImageryProvider.defaultContrast was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.contrast instead."
  395. );
  396. return this._defaultContrast;
  397. },
  398. set: function (value) {
  399. deprecationWarning(
  400. "MapboxStyleImageryProvider.defaultContrast",
  401. "MapboxStyleImageryProvider.defaultContrast was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.contrast instead."
  402. );
  403. this._defaultContrast = value;
  404. },
  405. },
  406. /**
  407. * The default hue of this provider in radians. 0.0 uses the unmodified imagery color.
  408. * @memberof MapboxStyleImageryProvider.prototype
  409. * @type {Number|undefined}
  410. * @deprecated
  411. */
  412. defaultHue: {
  413. get: function () {
  414. deprecationWarning(
  415. "MapboxStyleImageryProvider.defaultHue",
  416. "MapboxStyleImageryProvider.defaultHue was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.hue instead."
  417. );
  418. return this._defaultHue;
  419. },
  420. set: function (value) {
  421. deprecationWarning(
  422. "MapboxStyleImageryProvider.defaultHue",
  423. "MapboxStyleImageryProvider.defaultHue was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.hue instead."
  424. );
  425. this._defaultHue = value;
  426. },
  427. },
  428. /**
  429. * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the
  430. * saturation while greater than 1.0 increases it.
  431. * @memberof MapboxStyleImageryProvider.prototype
  432. * @type {Number|undefined}
  433. * @deprecated
  434. */
  435. defaultSaturation: {
  436. get: function () {
  437. deprecationWarning(
  438. "MapboxStyleImageryProvider.defaultSaturation",
  439. "MapboxStyleImageryProvider.defaultSaturation was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.saturation instead."
  440. );
  441. return this._defaultSaturation;
  442. },
  443. set: function (value) {
  444. deprecationWarning(
  445. "MapboxStyleImageryProvider.defaultSaturation",
  446. "MapboxStyleImageryProvider.defaultSaturation was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.saturation instead."
  447. );
  448. this._defaultSaturation = value;
  449. },
  450. },
  451. /**
  452. * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color.
  453. * @memberof MapboxStyleImageryProvider.prototype
  454. * @type {Number|undefined}
  455. * @deprecated
  456. */
  457. defaultGamma: {
  458. get: function () {
  459. deprecationWarning(
  460. "MapboxStyleImageryProvider.defaultGamma",
  461. "MapboxStyleImageryProvider.defaultGamma was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.gamma instead."
  462. );
  463. return this._defaultGamma;
  464. },
  465. set: function (value) {
  466. deprecationWarning(
  467. "MapboxStyleImageryProvider.defaultGamma",
  468. "MapboxStyleImageryProvider.defaultGamma was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.gamma instead."
  469. );
  470. this._defaultGamma = value;
  471. },
  472. },
  473. /**
  474. * The default texture minification filter to apply to this provider.
  475. * @memberof MapboxStyleImageryProvider.prototype
  476. * @type {TextureMinificationFilter}
  477. * @deprecated
  478. */
  479. defaultMinificationFilter: {
  480. get: function () {
  481. deprecationWarning(
  482. "MapboxStyleImageryProvider.defaultMinificationFilter",
  483. "MapboxStyleImageryProvider.defaultMinificationFilter was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.minificationFilter instead."
  484. );
  485. return this._defaultMinificationFilter;
  486. },
  487. set: function (value) {
  488. deprecationWarning(
  489. "MapboxStyleImageryProvider.defaultMinificationFilter",
  490. "MapboxStyleImageryProvider.defaultMinificationFilter was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.minificationFilter instead."
  491. );
  492. this._defaultMinificationFilter = value;
  493. },
  494. },
  495. /**
  496. * The default texture magnification filter to apply to this provider.
  497. * @memberof MapboxStyleImageryProvider.prototype
  498. * @type {TextureMagnificationFilter}
  499. * @deprecated
  500. */
  501. defaultMagnificationFilter: {
  502. get: function () {
  503. deprecationWarning(
  504. "MapboxStyleImageryProvider.defaultMagnificationFilter",
  505. "MapboxStyleImageryProvider.defaultMagnificationFilter was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.magnificationFilter instead."
  506. );
  507. return this._defaultMagnificationFilter;
  508. },
  509. set: function (value) {
  510. deprecationWarning(
  511. "MapboxStyleImageryProvider.defaultMagnificationFilter",
  512. "MapboxStyleImageryProvider.defaultMagnificationFilter was deprecated in CesiumJS 1.104. It will be in CesiumJS 1.107. Use ImageryLayer.magnificationFilter instead."
  513. );
  514. this._defaultMagnificationFilter = value;
  515. },
  516. },
  517. });
  518. /**
  519. * Gets the credits to be displayed when a given tile is displayed.
  520. *
  521. * @param {number} x The tile X coordinate.
  522. * @param {number} y The tile Y coordinate.
  523. * @param {number} level The tile level;
  524. * @returns {Credit[]} The credits to be displayed when the tile is displayed.
  525. */
  526. MapboxStyleImageryProvider.prototype.getTileCredits = function (x, y, level) {
  527. return undefined;
  528. };
  529. /**
  530. * Requests the image for a given tile.
  531. *
  532. * @param {number} x The tile X coordinate.
  533. * @param {number} y The tile Y coordinate.
  534. * @param {number} level The tile level.
  535. * @param {Request} [request] The request object. Intended for internal use only.
  536. * @returns {Promise<ImageryTypes>|undefined} A promise for the image that will resolve when the image is available, or
  537. * undefined if there are too many active requests to the server, and the request should be retried later.
  538. */
  539. MapboxStyleImageryProvider.prototype.requestImage = function (
  540. x,
  541. y,
  542. level,
  543. request
  544. ) {
  545. return this._imageryProvider.requestImage(x, y, level, request);
  546. };
  547. /**
  548. * Asynchronously determines what features, if any, are located at a given longitude and latitude within
  549. * a tile. This function is optional, so it may not exist on all ImageryProviders.
  550. *
  551. *
  552. * @param {number} x The tile X coordinate.
  553. * @param {number} y The tile Y coordinate.
  554. * @param {number} level The tile level.
  555. * @param {number} longitude The longitude at which to pick features.
  556. * @param {number} latitude The latitude at which to pick features.
  557. * @return {Promise<ImageryLayerFeatureInfo[]>|undefined} A promise for the picked features that will resolve when the asynchronous
  558. * picking completes. The resolved value is an array of {@link ImageryLayerFeatureInfo}
  559. * instances. The array may be empty if no features are found at the given location.
  560. * It may also be undefined if picking is not supported.
  561. */
  562. MapboxStyleImageryProvider.prototype.pickFeatures = function (
  563. x,
  564. y,
  565. level,
  566. longitude,
  567. latitude
  568. ) {
  569. return this._imageryProvider.pickFeatures(x, y, level, longitude, latitude);
  570. };
  571. // Exposed for tests
  572. MapboxStyleImageryProvider._defaultCredit = defaultCredit;
  573. export default MapboxStyleImageryProvider;