require(["esri/layers/support/TileInfo"], (TileInfo) => { /* code goes here */ });
import TileInfo from "@arcgis/core/layers/support/TileInfo.js";
esri/layers/support/TileInfo
Contains information about the tiling scheme for TileLayers, ElevationLayers, ImageryTileLayers, VectorTileLayers, and WebTileLayers.
TileInfo defines properties such as tile format, the level of details (LOD) at which the cache has tiles, the size of the tiles in pixels, and the screen resolution for which the tiles are intended to be most commonly displayed.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The name of the class. | Accessor | ||
The dots per inch (DPI) of the tiling scheme. | TileInfo | ||
Image format of the cached tiles. | TileInfo | ||
Indicates if the tiling scheme supports wrap around. | TileInfo | ||
An array of levels of detail that define the tiling scheme. | TileInfo | ||
The tiling scheme origin. | TileInfo | ||
Size of tiles in pixels. | TileInfo | ||
The spatial reference of the tiling schema. | TileInfo |
Property Details
-
dpi
dpi Number
-
The dots per inch (DPI) of the tiling scheme. If a DPI is chosen that does not match the resolution of the output device, the scale of the map tile will appear incorrect. The default value is 96.
- Default Value:96
-
format
format String
-
Image format of the cached tiles.
Possible Values:"png" |"png8" |"png24" |"png32" |"jpg" |"dib" |"tiff" |"emf" |"ps" |"pdf" |"gif" |"svg" |"svgz" |"mixed" |"lerc" |"lerc2d" |"pbf" |"raw"
-
isWrappable
isWrappable Boolean
Since: ArcGIS Maps SDK for JavaScript 4.5TileInfo since 4.0, isWrappable added at 4.5. -
Indicates if the tiling scheme supports wrap around.
-
An array of levels of detail that define the tiling scheme.
-
The tiling scheme origin. The upper left corner of the tiling scheme, in coordinates of the spatial reference of the source data.
-
Size of tiles in pixels.
Example// sets the height and width of each tile to [ 256, 256 ] tileInfo.size = 256;
-
spatialReference
spatialReference SpatialReferenceautocast
-
The spatial reference of the tiling schema.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
A convenience method used to create a new TileInfo instance with preset properties like LODs. | TileInfo | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | TileInfo | |
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor | ||
Utility method used to convert a scale value to its corresponding zoom value. | TileInfo | ||
Converts an instance of this class to its ArcGIS portal JSON representation. | TileInfo | ||
Utility method used to convert a zoom value to its corresponding scale value. | TileInfo |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
create
create(options){TileInfo}static
-
A convenience method used to create a new TileInfo instance with preset properties like LODs. Optionally, properties such as
size
,scales[]
, and aSpatialReference
can also be set to calculate LODs for eachTileInfo
. This is useful in cases where the default amount of LODs provided are not sufficient. For example, if wanting to set the view's scale 1:1, additional LODs must be created. An example of setting this scale and creating additional LODs is provided in the example snippet below.ParametersSpecificationoptions ObjectoptionalAn object that contains the size, scales, and/or SpatialReference used to compute the new TileInfo instance.
Specificationsize NumberoptionalDefault Value: 256The size of each tile in pixels.
numLODs NumberoptionalDefault Value: 24Total number of LODs to create.
spatialReference SpatialReferenceoptionalDefault Value: WebMercatorThe spatial reference for the new TileInfo instance. If the spatial reference is not WGS84 nor WebMercator, the origin of the TileInfo is
0.0
.optional Default Value: The scales provided by ArcGIS Online basemapsAn array of scale values to use for the TileInfo. If none are specified, the scales from the ArcGIS Online basemaps are used from level 0 through 24.
Returns- See also
Examples// This snippet shows how to create a TileInfo instance using the default // settings and passing its resulting LODs to a MapView's constraints let view = new MapView({ container: "viewDiv", map: map, constraints: { lods: TileInfo.create().lods } });
// This snippet shows how to set the MapView scale 1:1 while generating additional LODs for the MapView.constraints. const spatialReference = new SpatialReference({ wkid: 2154 }); const center = new Point({ x: 0, y: 0, spatialReference }); // Create LODs from level 0 to 31 const tileInfo = TileInfo.create({ spatialReference, numLODs: 32 }); const lods = tileInfo.lods; let view = new MapView({ container: "viewDiv", map, scale: 1, center, spatialReference, constraints: { lods: lods, snapToZoom: false } });
-
Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input
json
parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.Parameterjson ObjectA JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.
ReturnsType Description * Returns a new instance of this class.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
scaleToZoom
scaleToZoom(scale){Number}
-
Utility method used to convert a scale value to its corresponding zoom value.
Parameterscale NumberThe scale value to convert.
ReturnsType Description Number The returned zoom value. Example// get the zoom value for the vector tile layer at the given scale // then set the view.zoom to match layer's zoom level. view.when(function(){ view.zoom = layer.tileInfo.scaleToZoom(9027); });
-
toJSON
toJSON(){Object}
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.
-
zoomToScale
zoomToScale(zoom){Number}
-
Utility method used to convert a zoom value to its corresponding scale value.
Parameterzoom NumberThe zoom value to convert.
ReturnsType Description Number The returned scale value. Example// get the scale value for the vector tile layer at the view zoom level // then set the view.scale to match layer's scale. view.when(function(){ view.scale = vectorLayer.tileInfo.zoomToScale(view.zoom); });