createWorldImageryAsync.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import defaultValue from "../Core/defaultValue.js";
  2. import IonImageryProvider from "./IonImageryProvider.js";
  3. import IonWorldImageryStyle from "./IonWorldImageryStyle.js";
  4. /**
  5. * Creates an {@link IonImageryProvider} instance for ion's default global base imagery layer, currently Bing Maps.
  6. *
  7. * @function
  8. *
  9. * @param {Object} [options] Object with the following properties:
  10. * @param {IonWorldImageryStyle} [options.style=IonWorldImageryStyle] The style of base imagery, only AERIAL, AERIAL_WITH_LABELS, and ROAD are currently supported.
  11. * @returns {Promise<IonImageryProvider>}
  12. *
  13. * @see Ion
  14. *
  15. * @example
  16. * // Create a Cesium World Imagery base layer with default settings
  17. * try {
  18. * const imageryProvider = await Cesium.createWorldImageryAsync();
  19. * } catch (error) {
  20. * console.log(`There was an error creating world imagery: ${error}`);
  21. * }
  22. *
  23. * @example
  24. * // Create Cesium World Imagery with different style
  25. * try {
  26. * const imageryProvider = await Cesium.createWorldImageryAsync({
  27. * style: Cesium.IonWorldImageryStyle.AERIAL_WITH_LABELS
  28. * });
  29. * } catch (error) {
  30. * console.log(`There was an error creating world imagery: ${error}`);
  31. * }
  32. */
  33. function createWorldImageryAsync(options) {
  34. options = defaultValue(options, defaultValue.EMPTY_OBJECT);
  35. const style = defaultValue(options.style, IonWorldImageryStyle.AERIAL);
  36. return IonImageryProvider.fromAssetId(style);
  37. }
  38. export default createWorldImageryAsync;