小编Mik*_*ike的帖子

在 OpenLayers 地图中显示多边形

我在(经度,纬度)点中有一个多边形,我想绘制:

      var maxPoint = [36.283, -114.368];
      var geoSquare = [ minPoint, [minPoint[0], maxPoint[1]], maxPoint, [maxPoint[0], minPoint[1]]];
      var polygonFeature = new Feature(
              new Polygon(geoSquare));
Run Code Online (Sandbox Code Playgroud)

我正在以下列方式绘制地图:

      var map = new Map({
        interactions: defaultInteractions().extend([new Drag()]),
        layers: [
          new TileLayer({
            source: new TileJSON({
              url: 'https://maps.siemens.com/styles/osm-bright.json'
            })
          }),
          new VectorLayer({
            source: new VectorSource({
              features: [polygonFeature]
            }),
            style: new Style({
              stroke: new Stroke({
                width: 3,
                color: [255, 0, 0, 1]
              }),
              fill: new Fill({
                color: [0, 0, 255, 0.6]
              })
            })
          })
        ],
        target: 'map',
        view: …
Run Code Online (Sandbox Code Playgroud)

javascript openlayers-3

3
推荐指数
1
解决办法
716
查看次数

标签 统计

javascript ×1

openlayers-3 ×1