美文网首页openlayer
feature的常用方法

feature的常用方法

作者: 羊驼626 | 来源:发表于2020-06-28 14:06 被阅读0次

1.get(key)

import Feature from "ol/Feature.js";
import { Point } from "ol/geom";
let feature = new Feature({
        geometry: new Point([0,0]),
        type: "point",
      });
let type = feature.get('type'); // point  获取feature中的type参数

1.setStyle(style)

import Feature from "ol/Feature.js";
import {Fill, Stroke, Circle, Style} from 'ol/style';

let feature = new Feature({
        geometry: new Point([0,0]),
        type: "point",
      });
// 填充
let fill = new Fill({
   color: 'rgba(255,255,255,0.4)'
 });
// 描边
let stroke = new Stroke({
   color: '#3399CC',
   width: 1.25
 });
let styles = [
   new Style({
     image: new Circle({
       fill: fill,
       stroke: stroke,
       radius: 5
     }),
     fill: fill,
     stroke: stroke
   })
 ];
feature.setStyle(styles);

3.地图定位到某一个feature 的位置

import Map from "ol/Map";
import Feature from "ol/Feature.js";
import { Point } from "ol/geom";

const map = new Map();
let feature = new Feature({
        geometry: new Point([0,0]),
        type: "point",
      });
const view = map.getView();
    view.fit(feature.getGeometry(), {
      padding: [0, 0, 0, 0],
      maxZoom: 15,
    });

相关文章

  • feature的常用方法

    1.get(key) 1.setStyle(style) 3.地图定位到某一个feature 的位置

  • Vue01组件化实践-01组件通信

    组件通信常用方法 以下demo github地址: feature/communication分支 props $...

  • feature engineering 特征工程常用的方法

    特征工程在机器学习和模型中经常用到, 之前也没有详细的整理过,今天大致看了下,给记录下主要的方法。 本次仅记录特征...

  • MF与embedding

    推荐系统常用的MF(矩阵分解)方法,旨在通过评分矩阵R有损分解得到矩阵U(代表所有用户的feature vecto...

  • 单细胞学习2

    feature selection 比较不同feature selection方法 单细胞转录组测序的确可以一次性...

  • this.requestWindowFeature(Window

    方法一 this.requestWindowFeature(Window.FEATURE_NO_TITLE);需写...

  • 有参转录组学习五:reads计数

    Author:ligc Date:19/5/15 在基因水平上,常用的软件为HTSeq-count,feature...

  • 卷积神经网络基础知识

    卷积网络概述 传统的机器学习大多数都需要我们手工去建立feature,这种方法建立出来的feature,大多都是有...

  • 集合

    1. 常用容器类 Collection 的常用方法 List 的常用方法 Set 的常用方法 Map 的常用方法 ...

  • 2019-09-28

    当一个模型达不到预期,可以改进的方法有? 减少不必要的feature2.增加有用的feature3.增加polyn...

网友评论

    本文标题:feature的常用方法

    本文链接:https://www.haomeiwen.com/subject/hhxwfktx.html