From f322e60873ba1ff667425e4dcd2f76c8973ab923 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 17 Aug 2022 18:04:04 +0800
Subject: [PATCH] 添加南城县边界数据
---
src/components/map/index.vue | 41 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index a16a2f4..28f46b8 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -4,12 +4,14 @@
</template>
<script>
-
+import axios from 'axios'
// 图层变量做声明
var farmRegionLayer = null
var plotRegionLayer = null
var farmLogoLayer = null
+var regionPolyLineLayer = null
+
var addLayers = []
var addPlotLayers = []
@@ -72,6 +74,10 @@
global.viewer.addLayer(siteEntitylayers3)
siteEntitylayers4 = new global.DC.VectorLayer('siteEntitylayers4')
global.viewer.addLayer(siteEntitylayers4)
+
+ // 南城县边界数据
+ regionPolyLineLayer = new global.DC.VectorLayer('regionPolyLineLayer')
+ global.viewer.addLayer(regionPolyLineLayer)
// 判断是否支持图像渲染像素化处理
if (global.DC.Namespace.Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
@@ -206,8 +212,36 @@
}
global.DC.ready(initViewer)
+
+ this.addRegionPolyLine('http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengfwx/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson')
},
methods: {
+ /**
+ * 添加南城县边界的数据
+ * @param {string} url arcgis服务地址
+ */
+ addRegionPolyLine (url) {
+ axios.get(url).then(res => {
+ let position = ''
+
+ res.data.features[0].geometry.rings[0].forEach(item => {
+ position += `${item[0]}, ${item[1]};`
+ })
+
+ console.log(position, 565656)
+
+ const polyline = new global.DC.Polyline(position)
+ polyline.setStyle({
+ width: 4,
+ material: global.DC.Namespace.Cesium.Color.fromBytes(
+ 244, 157, 21,
+ 200
+ ),
+ clampToGround: true
+ })
+ regionPolyLineLayer.addOverlay(polyline)
+ })
+ },
/**
* 添加农场点及范围的方法
* @param {*} positions 位置信息(范围信息)
@@ -227,8 +261,6 @@
</div>
`
)
-
-
divIcon.attrParams = item
farmLogoLayer.addOverlay(divIcon)
@@ -532,8 +564,7 @@
// 显示土壤图层
showTRLayer () {
siteEntitylayers4.show = true
- },
-
+ }
}
}
--
Gitblit v1.9.3