openlayers6 显示矢量框(已知四个点坐标)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openlayers6 显示矢量框(已知四个点坐标)相关的知识,希望对你有一定的参考价值。

参考技术A getPolygon(row)

/*右上角坐标经度*/

    let rightUpLon = row.dmUrLon;

    /*右上角坐标纬度*/

    let rightUpLat = row.dmUrLat;

    /*左上角坐标经度*/

    let leftUpLon = row.dmUlLon;

    /*左上角坐标纬度*/

    let leftUpLat = row.dmUlLat;

    /*右下角坐标经度*/

    let rightDownLon = row.dmLrLon;

    /*右下角坐标纬度*/

    let rightDownLat = row.dmLrLat;

    /*左下角坐标经度*/

    let leftDownLon = row.dmLlLon;

    /*左下角坐标纬度*/

    let leftDownLat = row.dmLlLat;

    let rightUp = [rightUpLon, rightUpLat],

        leftUp = [leftUpLon, leftUpLat],

        rightDown = [rightDownLon, rightDownLat],

        leftDown = [leftDownLon, leftDownLat];

    let newCoordinates = [];

    newCoordinates.push(rightUp, leftUp, leftDown, rightDown, rightUp);

    return new this.Polygon([newCoordinates]);

,

showVectorBox(row)

let layer =this.getLayerByName(row.id);

    if (layer.length >0)

layer.forEach(item =>

this.map.removeLayer(item);

        );

    else

let polygon =this.getPolygon(row);

        let features = [];

        let routeFeature ="";

        routeFeature =new Feature(

geometry: polygon

);

        routeFeature.setStyle(

new Style(

stroke:new Stroke(

width:3, //边界宽度

                    color: [71, 137, 227, 1]//边界颜色

                ),

            )

);

        features.push(routeFeature);

        // 设置图层

        let routeLayer =new this.VectorLayer(

name: row.id,

            source:new this.VectorSource(

features: features

),

            zIndex:this.getAllLayers().length +1

        );

        // 添加图层

        this.map.addLayer(routeLayer);

   

,

如何在arcgis中对已知的四个点划外接矩形

参考技术A

以上是关于openlayers6 显示矢量框(已知四个点坐标)的主要内容,如果未能解决你的问题,请参考以下文章

openlayers6结合geoserver实现地图矢量瓦片(附源码下载)

已知平面上n个点的坐标分别是

已知平面上n个点的坐标分别是

已知几个点的坐标和高程,用啥软件算它的方量

已知平行四边形的三个点求第四个点

java知道四个点坐标,怎么判断一个点是否在这个矩形区域内(矩形可能是斜着放的,有一定的斜度)