Esri / esri-loader

A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications
Apache License 2.0
459 stars 79 forks source link

利用BaseTileLayer.createSubclass进行扩展,读取离线tms瓦片。 #286

Closed 694225772 closed 2 years ago

694225772 commented 2 years ago

1、使用import {setDefaultOptions, loadCss, loadModules} from 'esri-loader';方式 在es6中, type MapModules = [ typeof import('esri/views/SceneView'), typeof import('esri/Basemap'), typeof import('esri/Map'), typeof import('esri/layers/TileLayer'), typeof import('esri/layers/WebTileLayer'), typeof import('esri/core/Collection'), typeof import('esri/layers/BaseTileLayer') ];

const [
  SceneView,
  Basemap,
  Map,
  TileLayer,
  WebTileLayer,
  Collection,
    BaseTileLayer
] = await (loadModules([
  'esri/views/SceneView',
  'esri/Basemap',
  'esri/Map',
  'esri/layers/TileLayer',
  'esri/layers/WebTileLayer',
  'esri/core/Collection',
  "esri/layers/BaseTileLayer"
]) as Promise<MapModules>);

利用BaseTileLayer.createSubclass进行扩展,读取离线tms瓦片。 ts报错:在ts中使用BaseTileLayer报错,Property 'createSubclass' does not exist on type 'BaseTileLayerConstructo。 通过html里通过require方式没问题。

694225772 commented 2 years ago

<?xml version="1.0" encoding="UTF-8" ?>

™ٛmapbox1-18т׶Χ WeMap Export TMS OSGEO:41001
andygup commented 2 years ago

@694225772 can you share a simple sample that reproduces the issue? For example, codepen.io is a great way to share samples.

Here is a working sample that demonstrates the use of BaseTileLayer.createSubclass(): https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-custom-elevation-thematic

andygup commented 2 years ago

Closing for now. Need additional info.