maptalks / maptalks.js

A light and plugable JavaScript library for integrated 2D/3D maps.
https://maptalks.org
BSD 3-Clause "New" or "Revised" License
4.29k stars 500 forks source link

cesium插件加载3dtile倾斜摄影,不报错,不显示3d内容 #795

Closed binfenshijie closed 5 years ago

binfenshijie commented 5 years ago
<script type='text/javascript' src="https://cdn.jsdelivr.net/npm/maptalks@0.41.1/dist/maptalks.min.js"></script>
<script type='text/javascript' src='../dist/Cesium.js'></script>
<script type='text/javascript' src='../dist/maptalks.cesium.js'> </script>

/////maptalk-map var map = new maptalks.Map('map', { center: [116.2989326073,39.8996075498], //中心点标记红十字 centerCross : true, zoom: 16, zoomControl : true, // add zoom control scaleControl : true, // add scale control overviewControl : true, // add overview control //设置瓦片图层的空间参考spatialReference默认就是3857,googlemap的分辨率 spatialReference : { projection : 'EPSG:3857' //与map一样,支持更详细的设置resolutions,fullExtent等 }, baseLayer: new maptalks.TileLayer('base', { // urlTemplate: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', //renderer : 'canvas', // set TileLayer's renderer to canvas urlTemplate: 'http://123.59.185.101:8812/mapdata/tiles/{z}/{x}/{y}.png', //tileSystem 控制瓦片的x,y以及行列,后两个是origin原点位置(很重要) tileSystem : [1, 1, -20037508.3427890,-20037508.3427890], // tile system //subdomains: ['a','b','c'], minZoom : 1, maxZoom : 23, // css filter 滤镜配置 //cssFilter : 'sepia(60%) invert(95%)', attribution: '© Maptalk for map contributors' }), layers : [ new maptalks.VectorLayer('vs') ] }); //cesium ---- cesium var cesiumLayer = new maptalks.CesiumLayer('cesium').addTo(map); //天地图底图 cesiumLayer.getCesiumScene().imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ //调用影响中文注记服务 url: "http://t0.tianditu.com/cia_w/wmts?" + "service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w" + "&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg", layer: "tdtAnnoLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: false })); ///3dtile加载-不报错-但也不显示 var tileset = cesiumLayer.getCesiumScene().primitives.add(new Cesium.Cesium3DTileset( { url: 'modeldata/3Dtilesdata/tileset.json'//本地倾斜摄影数据 }));

  tileset.readyPromise.then(function () {
      var boundingSphere = tileset.boundingSphere;
      cesiumLayer.getCesiumScene().camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
      cesiumLayer.getCesiumScene().camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  }).otherwise(function (error) {
      throw (error);
  });
binfenshijie commented 5 years ago

我单独用cesium加载该数据是没有问题的modeldata/3Dtilesdata/tileset.json

fuzhenn commented 5 years ago

请发个邮件给我,我们在邮件里沟通这个问题吧

binfenshijie commented 5 years ago

请发个邮件给我,我们在邮件里沟通这个问题吧

好的。我整理下

davidweining2333 commented 5 years ago

@binfenshijie 您好,请问你这个Cesium插件是如何加载的呢,我再源码中没有发现这两个文件呀

davidweining2333 commented 5 years ago

@binfenshijie 你好,请问这个问题解决了吗

yu18264881581 commented 2 years ago

@fuzhenn 你好,这个问题应该如何解决,我们也遇到了同样的问题

pleaseok commented 2 years ago

你好,请问解决了吗

fuzhenn commented 2 years ago

cesium插件我们已经不维护了,可以考虑改用我们的3dtiles插件。 http://examples.maptalks.com 拉到最下面有加载倾斜摄影模型的示例 或者可以去 https://github.com/maptalks/maptalks.three ,第一个demo中也有加载倾斜摄影的示例。