UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

68 lines (66 loc) 3 kB
import type Extent from "../geometry/Extent.js"; import type WebTileLayer from "./WebTileLayer.js"; import type { WebTileLayerProperties } from "./WebTileLayer.js"; export interface OpenStreetMapLayerProperties extends WebTileLayerProperties {} /** * Allows you to use [basemaps](https://wiki.openstreetmap.org/wiki/List_of_OSM-based_services) from [OpenStreetMap](https://www.openstreetmap.org/). * Set the [tileServers](https://developers.arcgis.com/javascript/latest/references/core/layers/OpenStreetMapLayer/#tileServers) property to change which OpenStreetMap tiles you want to use. * * @since 4.0 * @see [Sample - OpenStreetMapLayer (3D)](https://developers.arcgis.com/javascript/latest/sample-code/layers-osm-3d/) * @see [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) * @see [WebTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/) */ export default class OpenStreetMapLayer extends WebTileLayer { constructor(properties?: OpenStreetMapLayerProperties); /** * The full extent of the layer. By default, this is worldwide. This property may be used * to set the extent of the view to match a layer's extent so that its features * appear to fill the view. See the sample snippet below. * * @example * // Once the layer loads, set the view's extent to the layer's fullextent * layer.when(function(){ * view.extent = layer.fullExtent; * }); * @example * // Once the layer loads, set the view's extent to the layer's full extent * layer.when(function(){ * view.extent = layer.fullExtent; * }); */ get fullExtent(): Extent; /** * The subdomains used to access the tile service. * * @default ["a", "b", "c"] * @example console.log(layer.subDomains); // ["a", "b", "c"] * @see [WebTileLayer.urlTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#urlTemplate) * @example * // add an open street map layer * new WebTileLayer({ * "https://{subDomain}.tile.openstreetmap.org/{z}/{x}/{y}.png", * subDomains: ["a", "b", "c"], * }); */ get subDomains(): [ "a", "b", "c" ]; /** For [WebTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/) the type is `web-tile`. */ get type(): "open-street-map"; /** * The URL template used to access the tile service. * * @example console.log(layer.urlTemplate); // "https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png" * @see [WebTileLayer.subDomains](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#subDomains) * @example * // add an open street map layer * new WebTileLayer({ * "https://{subDomain}.tile.openstreetmap.org/{z}/{x}/{y}.png", * subDomains: ["a", "b", "c"], * }); */ get urlTemplate(): "https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png"; }