Comments (4)
promise返回的是什么呢,控制台输出的代码改一下看看
info.then(res => console.log(res))
from mvtimageryprovider.
promise返回的是什么呢,控制台输出的代码改一下看看
info.then(res => console.log(res))
info.then(res => console.log('res:::', res)).catch((err) => console.log('err:::', err))
没有进then,catch中err输出undefined,非常感谢您的回复,这个问题我通过另一个方式曲线救国了。
有两种方式,
第一种: 直接通过MVTImageryProvider渲染完整的style
new MVTImageryProvider({
style,
showCanvas: false
});
然后使用:
const featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay as Ray, viewer.scene);
Promise.resolve(featuresPromise).then(function(features) {
console.log('features:::', features)
});
第二种:先通过http拿到style.json的json数据,再以layers为依据,将数据构造成多个style,再调用MVTImageryProvider渲染
const { data } = await axios.get<StyleSpecification>(style);
const styles: StyleSpecification[] = []
this.layersSpecification = data.layers;
data.layers.forEach((layer) => {
const newStyleItem = cloneDeep(data);
newStyleItem.layers = [layer];
newStyleItem.sources = {[layer.source]: data.sources[layer.source]};
styles.push(newStyleItem)
});
const providers = await this.createProvider(styles);
createProvider = (styles: StyleSpecification[]): Promise<MVTImageryProvider[]> => {
const pList: MVTImageryProvider[] = [];
return new Promise<MVTImageryProvider[]>(async (resolve, reject) => {
const list = styles.map((style) => {
const p = new MVTImageryProvider({ style });
pList.push(p)
return p.readyPromise
})
await Promise.all(list);
resolve(pList)
})
};
providers.forEach(provider => {
const layer = viewer.imageryLayers.addImageryProvider(provider as unknown as ImageryProvider);
});
最终我选择了第二种方案,因为第一种再修改style.json中layers的某一项后,要重新渲染所有的瓦片,实际的渲染效率很低,第二种的话,因为每一个都是一个图层,修改后可以单独渲染这一个图层,目前我得数据量小,还没发现有性能问题。
但是目前我有一个最头疼的问题,再请教下您(这个问题再第一种方案中也一样存在):当首次渲染完成后,修改这个图层对应的style后,重新渲染出来的栅格瓦片,分辨率不正常(太模糊,好似没有适配到当前缩放的级别),且有很大概率部分瓦片不会渲染出来(地球上没能正常展示出来),如下图:
from mvtimageryprovider.
瓦片显示不完整的这个问题我也有遇到,但是频率不是很高,我感觉可能是资源释放和缓存的问题,你在移除原来图层的时候有调用provider.destroy()方法吗。
层级显示不正确这个问题暂时还没遇到过,得在mapboxRender里面调试,查看具体传入的瓦片数据。您如果有能力的话,可以自己试试,俺这段时间应该搞不了太多。。
from mvtimageryprovider.
瓦片显示不完整的这个问题我也有遇到,但是频率不是很高,我感觉可能是资源释放和缓存的问题,你在移除原来图层的时候有调用provider.destroy()方法吗。 层级显示不正确这个问题暂时还没遇到过,得在mapboxRender里面调试,查看具体传入的瓦片数据。您如果有能力的话,可以自己试试,俺这段时间应该搞不了太多。。
好的,非常感谢
from mvtimageryprovider.
Related Issues (20)
- 矢量瓦片上球展示后频繁更改要素属性会导致cesium地球崩溃 HOT 13
- can it provide fill-extrusion style? HOT 1
- 不能正确加载geoserver发布的矢量瓦片 HOT 3
- 标注时不能渲染中文字符 HOT 3
- 新版样式支持问题 HOT 1
- vite 加 vite-plugin-cesium里面引入使用会报错 HOT 6
- 加载mapbox style报错 HOT 6
- 请问如何支持4490和4326 HOT 1
- Cannot read properties of undefined reading '_requestTransformFn HOT 12
- 放大图层层级,部分矢量数据加载不出来 HOT 1
- BasicRenderer刷新问题 HOT 1
- mapbox更改maplibre HOT 1
- MVTImageryProvider.fromUrl或者new MVTImageryProvider加载远程的json后报错 HOT 1
- 作者您好,我们项目中使用了您的库,但是我有几个疑问,向您请教,期待回复。 HOT 1
- 请问 地图放大 报这个bug什么问题呢??? HOT 2
- 矢量瓦片中的图层显示顺序有点问题 HOT 5
- 无法加载显示中文标注,英文的标注显示正常 HOT 1
- 加载 点的pbf 时 type能否支持 symbol 以及 layers: "icon-image" 需要自定义图片时 我改怎么定义 因为没办法用map.addimage HOT 2
- 好像这个在新版本的ceisum中不行
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvtimageryprovider.