zoukankan      html  css  js  c++  java
  • Openlayers简单要素的添加

    1. geojson数据:https://blog.csdn.net/weixin_38307752/article/details/84112566

    2. 简单要素的添加:https://blog.csdn.net/xcymorningsun/article/details/83409568

    二、简单要素点线面的添加

    1、创建feature

    2、创建style,添加source、style到layer

    3、添加layer到map

    通过WFS服务获取geojson数据,然后将整个geojson数据加载到vectorlayer图层中去,不过这种方法有个缺点就是不能实现自定义加载各种数据。如果需要对geojson数据中的属性进行修改添加的时候不容易控制(这在以后为每个feature在地图上同时添加气泡框功能有帮助),然后有了这篇文章。

    1、创建feature

    >>参考:esri-leaflet:

    var loadData = function (){
              $.ajax(url_link, {//leaflet/data/MegaCities.geojson    //url_link   //'leaflet/data/arcgis_json.json'
                  dataType: "json",
                  success: function(response){
                    geojson1 = L.esri.Util.arcgisToGeoJSON(response);
                    geoJSONLayer = L.geoJSON(geojson1);//,{onEachFeature:popUp}
                    //geoJSONLayer.addTo(map);

                    //第二种添加方法
                    for(var i in geojson1.features){
                      //alert(i);//geojson1.features[i]
                      DTmap[i] = L.geoJSON(geojson1.features[i],{//response
                        style:function(feature){
                          return{
                            color:'#FF0000',
                            fillOpacity: 0.2,
                            weight:3,
                            dashArray:'10'
                          };
                        }
                      }).bindTooltip("<div id='table'><ul><li>"+geojson1.features[i].properties.OBJECTID+"</li><li>" + "</li><li>",{
                        direction:'top'
                      }).on({
                        mouseover: highlight, //鼠标移动上去高亮
                        mouseout: resetHighlight, //鼠标移出恢复原样式
                        click: zoomTo //点击最大化
                      }).addTo(cities);
                    }
                  }
              });
          }
  • 相关阅读:
    网页居中的问题
    棋盘覆盖
    可变宽度的圆角框
    多线程编辑问题
    实验五 Web项目开发
    实验三 一个标准的Windows应用程序
    【语言处理与Python】1.2将文本当作词链表
    【语言处理与Python】1.5自动理解自然语言
    【语言处理与Python】1.1文本和单词
    【语言处理与Python】1.3计算语言:简单的统计
  • 原文地址:https://www.cnblogs.com/2008nmj/p/15596665.html
Copyright © 2011-2022 走看看