Esri / jsapi-resources

A collection of resources for developers using the ArcGIS Maps SDK for JavaScript.
https://developers.arcgis.com/javascript/latest/
Apache License 2.0
707 stars 559 forks source link

WebTileLayer spatialReference question #395

Closed zhuminquan closed 1 year ago

zhuminquan commented 2 years ago

@arcgis/core version

@arcgis/core@4.23.2 and Run npm install @arcgis/core in a terminal window.

Framework and build tools

vue3.2.25 & vite2 & TypeScripe

Describe the bug error code fragment:

import WebTileLayer from "@arcgis/core/layers/WebTileLayer";
const TDT_IMG ="http://t0.tianditu.gov.cn/DataServer?T=img_c&X={x}&Y={y}&L={z}";
const TDT_IMG_LAYER = new WebTileLayer({ copyright: 'TDT', urlTemplate: TDT_IMG, subDomains: ["t0"], spatialReference: { wkid: 4326 } });

the vscode error tips: the "spatialReference" is not WebTileLayerProperties propertys。 so, how do I set spatialReference of a WebTileLayer。

This problem does not exist in the JS environment

lheberlie commented 2 years ago

Hi @zhuminquan, The WebTileLayer.spatialReference is readonly. We did add the ability to change the MapView.spatialReference at runtime during the 4.23 release. I would probably suggest trying to use a basemap or web map that is in the same spatial reference as your WebTileLayer data source.

Does this answer your question?

andygup commented 1 year ago

I'll go ahead and close this. Answer provided.