首页 > 其他分享 >openlayers2批量添加点

openlayers2批量添加点

时间:2024-03-12 10:01:04浏览次数:21  
标签:map layer openlayers2 批量 feature source 添加 let new

// 初始化地图
      initMap() {
        map = new Map({
          layers: [
            new TileLayer({
              source: new OSM(),
            }),
          ],
          target: 'map',
          view: new View({
            center: [116.403218, 39.92372],
            zoom: 12,
            maxZoom: 18,
            projection: 'EPSG:4326',
            constrainResolution: true,  // 设置缩放级别为整数 
            smoothResolutionConstraint: false,  // 关闭无级缩放地图
          }),
        });

        this.addPoint()
      },

      // 绘制坐标点
      addPoint() {
        let feature = new Feature({
          title: 'beijing',
          geometry: new Point([116.403218, 39.92372]),
        })
        feature.setStyle(
          new Style({
            image: new CircleStyle({
              fill: new Fill({
                color: 'blue',
              }),
              radius: 4,
            }),
          })
        );
        let source = new VectorSource()
        source.addFeature(feature)
        let layer = new VectorLayer()
        layer.setSource(source)
        map.addLayer(layer)
      },

参考:https://blog.csdn.net/weixin_42776111/article/details/123736853

标签:map,layer,openlayers2,批量,feature,source,添加,let,new
From: https://www.cnblogs.com/2008nmj/p/18067677

相关文章

  • openlayers2
    参考:https://openlayers.org/two/支持说明:尽管Openlayers2继续工作并且仍在使用中,但开发工作集中在版本3上。建议OpenLayers用户升级到版本3。尽管偶尔会继续对存储库进行提交,但不再有定期发布。建议那些想要版本2的最新代码的人下载存储库中的master分支并使用它。即使不再有......
  • UVM宏解释+odt文件转doc+merge命令和difflib+python调用命令+clog2和系统函数+java添
    UVM宏解释UVM_DISABLE_AUTO_ITEM_RECORDINGhttps://blog.csdn.net/MGoop/article/details/127295965itemrecord的方法主要是用于记录事务信息的,原理是调用accept_tr,begin_tr,end_tr。似乎和波形上显示出各个事务相关。默认情况下,在调用get_next_item()和item_done()时自动......
  • Typecho Joe主题添加文章目录导航
    方法和样式参考https://www.wlplove.com/archives/84/1、安装Menutree插件wgethttps://github.com/typecho-fans/plugins/releases/download/plugins-M_to_R/MenuTree.zip解压后放到typecho插件目录2、修改主题模版编辑Joe主题文件夹public/aside.php文件<sectionclass="......
  • PXE批量安装操作系统自动化
    PXEz自动化在PXE服务器操作:*yum-yinstalldhcpxinetdtftptftp-server**yum-yinstallsystem-config-kickstart**yum-yinstallsyslinux**[root@localhostks]#cat/etc/dhcp/dhcpd.conf**subnet192.168.7.0netmask255.255.255.0{**range192.168.7.100192.1......
  • 【C#】HttpWebRequest 接口请求,添加基础Basic认证
    C#,调用对方接口,POST方法,Basic账号密码身份认证。stringurl="";stringaccount="";stringpwd="";JObjectpostData=newJObject();HttpWebRequestrequest=(HttpWebRequest)WebRequest.Create(url);request.Method="POST";re......
  • aspnet zero 12 添加登录 验证码
       aspnetzero自带的验证码是基于Google,国内当前无法使用,只能替换国内的。实现后的界面如下图: PackageManagerInstall-PackageLazy.Captcha.Core验证码后端代码publicinterfaceICaptchaAppService:IApplicationService{///<summary>......
  • DataX批量增量同步pg库表数据
    批量pg2pg增量同步DataX.json配置文件:pg2pg_increment_sync.json{"job":{"setting":{"speed":{"channel":1}},"content":[{......
  • fabricjs怎么添加网格线
    html文件:1<canvasid="c"width="600"height="400"></canvas>css文件:1canvas{2border:1pxsolidlightgrey;3} javascript文件1varcanvas=newfabric.Canvas('c',{2selection:false3});4v......
  • 用vcpkg 和vs2022,使用msvc编译器,怎么添加新的依赖库(包含头文件与dll)
    安装vcpkg:如果您还没有安装vcpkg,可以通过VisualStudioInstaller安装。在安装或修改VisualStudio时,选择“C++桌面开发”,然后勾选“vcpkg-C++库管理器”1。集成vcpkg到VisualStudio:在VisualStudio中,通过“工具”菜单选择“NuGet包管理器->程序包管......
  • 在Chrome添加vue插件
    1.首先打开Chrome的开发者模式:(1)点击浏览器的"设置",再点击"扩展程序”:(2)或者直接点击浏览器右上角的扩展程序:打开右上角的“开发者模式”:2.在github下载vue插件,点击进入下载地址:https://github.com/vuejs/devtools3.依次点击下载:按需要浏览器(Chrome)下载:4.点击添加到......