openlayers 各種圖層,持續更新


 1   /*高德地圖*/
 2     var vectorLayerLine = new ol.layer.Tile({
 3 
 4           source: new ol.source.XYZ({ 
 5             urls: [
 6                   "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}",
 7                   "http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}",
 8                   "http://webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}",
 9                   "http://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}"
10                ]
11             })         
12     }); 

矢量圖層以及樣式設定

 1 nodesLayer:new ol.layer.Vector({
 2          source: new ol.source.Vector({
 3           //讀取geojson 的數據
 4               features: (new ol.format.GeoJSON()).readFeatures(JSON.stringify(nodedata))
 5         }),
 6          //根據feature屬性來定樣式,從來實現整體渲染,而不是進行循環操作
 7          style:function(feature){
 8               
 9              if (feature.get("level")=="2") {
10                   feature.setStyle(stylesjf2);
11                   console.log("first");  
12                
13             }
14             else if (feature.get("level")=="1") {
15                 feature.setStyle(stylesjf1);  
16             }
17             else if (feature.get("level")=="3") {
18                 feature.setStyle(stylesjf3);  
19             }
20          },
21          useSpatialIndex:false
22          //style:ciclestyle
23          //style:stylesjf
24 }),

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM