Because the browser has a limit on the number of concurrent requests for the same domain name service, by deploying multiple subdomains, the concurrent amount of data requests sent to iServer is increased, so as to achieve the purpose of increasing the loading speed. The following takes nginx as an example to build the environment:
Modify the nginx.conf file, as shown in the figure below, restart nginx after the modification is completed, then http://localhost:8081/iserver, http://localhost:8082/iserver, http://localhost:8083/iserver Will point to http://localhost:8090/iserver
var promise = viewer.scene.open('http://{s}/iserver/services/3D-CBD/rest/realspace', undefined, { subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域 });
var config = { subdomainConfig: { urlScheme: " http://{s}/iserver/services/3D-CBD/rest/realspace", subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域 }, name: "building" }; var promise = viewer.scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-CBD/rest/realspace/datas/building/config', config); SuperMap3D.when(promise, function (layer) { viewer.flyTo(promise); })
var viewer = new SuperMap3D.Viewer('Container', { terrainProvider: new SuperMap3D.SuperMapTerrainProvider({ url: ' http://{s}/iserver/services/3D-terrain/rest/realspace/datas/dem', subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域 }) });
var imageLayer = viewer.imageryLayers.addImageryProvider(new SuperMap3D.SuperMapImageryProvider({ url: ' http://{s}/iserver/services/3D-image/rest/realspace/datas/image', subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域 })); viewer.flyTo(imageLayer);
mvtMap = scene.addVectorTilesMap({ url: 'http://{s}/services/map-mvt-JingJinDiQuDiTu/restjsr/v1/vectortile/maps/JingJin', subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域 canvasWidth: 512, name: 'testMVT', viewer: viewer });