最近在绘制各种图形,越来越乱,看了很多文章,启发了从最最基础的图形开始学习扩展。
遇到什么样的问题?
import ol from "ol";
import { Draw } from "ol/interaction";
import { Vector as VectorSource } from "ol/source";
import { Layer, Vector as VectorLayer } from "ol/layer";
import Overlay from "ol/Overlay";
import { Polygon, LineString } from "ol/geom";
import Feature from "ol/Feature";
import { unByKey } from "ol/Observable";
import { getLength, getArea } from "ol/sphere";
import Style from "ol/style/Style";
import Stroke from "ol/style/Stroke";
import Fill from "ol/style/Fill";
import Circle from "ol/style/Circle";
import GeoJSON from "ol/format/GeoJSON";
import { area, center } from "@turf/turf";
import * as turf from "@turf/turf";
this.draw = new Draw({
source: vectorSource,
type: "Circle",
geometryFunction: Draw.createRegularPolygon(4)

文章讲述了使用OpenLayers进行地图交互,如何创建并控制绘制正多边形的功能,包括引入库、设置图层和交互行为,以及解决导入错误的过程。
最低0.47元/天 解锁文章
583

被折叠的 条评论
为什么被折叠?



