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 }),

 

相关文章:

  • 2021-12-12
  • 2021-09-27
  • 2021-10-08
  • 2021-11-27
  • 2021-11-25
  • 2021-12-31
  • 2022-01-08
  • 2021-12-12
猜你喜欢
  • 2021-09-27
  • 2021-11-02
  • 2022-01-07
  • 2021-12-23
  • 2021-07-05
  • 2021-08-03
  • 2021-12-22
  • 2021-12-19
相关资源
相似解决方案