# survey-map

> `在线帮助文档地址：http://192.168.100.133:3000/#/` ## 安装

Latest version **0.9.40-29** (published 2025-04-18) · 0 weekly downloads

## Install

```sh
npm install survey-map
pnpm add survey-map
yarn add survey-map
bun add survey-map
```

## Health

**Score 20/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; large bundle; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.40-29 |
| Published | 2025-04-18 |
| First published | 2022-06-24 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 23 |
| Unpacked size | 51 MB |
| Known vulnerabilities | 0 (+26 in 4 direct dependencies) |
| Install scripts | no |
| Maintainers | huhaote, xiey, surveymap |

## Links

- npm: https://www.npmjs.com/package/survey-map
- npm.io page: https://npm.io/package/survey-map

## Dependencies (23)

- [npm](https://npm.io/package/npm.md) ^7.7.0
- [nrm](https://npm.io/package/nrm.md) ^1.2.5
- [vue](https://npm.io/package/vue.md) ^2.6.11
- [vant](https://npm.io/package/vant.md) ^2.12.10
- [axios](https://npm.io/package/axios.md) ^0.21.4
- [proj4](https://npm.io/package/proj4.md) ^2.11.0
- [echarts](https://npm.io/package/echarts.md) ^4.9.0
- [install](https://npm.io/package/install.md) ^0.13.0
- [vue-pdf](https://npm.io/package/vue-pdf.md) ^4.3.0
- [video.js](https://npm.io/package/video.js.md) ^7.11.4
- [vuejs-vr](https://npm.io/package/vuejs-vr.md) ^1.1.0
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [qrcodejs2](https://npm.io/package/qrcodejs2.md) 0.0.2
- [vue-axios](https://npm.io/package/vue-axios.md) ^3.3.7
- [vue-router](https://npm.io/package/vue-router.md) ^3.5.3
- [cache-loader](https://npm.io/package/cache-loader.md) ^4.1.0
- [vuedraggable](https://npm.io/package/vuedraggable.md) ^2.24.3
- [shinegis-client](https://npm.io/package/shinegis-client.md) ^1.5.7-5
- [mapbox-colorful-vue](https://npm.io/package/mapbox-colorful-vue.md) ^1.0.50
- [videojs-contrib-hls](https://npm.io/package/videojs-contrib-hls.md) ^5.15.0
- [@turf/center-of-mass](https://npm.io/package/@turf/center-of-mass.md) ^6.5.0
- [terraformer-wkt-parser](https://npm.io/package/terraformer-wkt-parser.md) ^1.2.1
- [@supermap/vue-iclient-mapboxgl](https://npm.io/package/@supermap/vue-iclient-mapboxgl.md) ^11.0.0

## Recent versions

- 0.9.40-29 (latest) — 2025-04-18
- 0.9.40-27 — 2024-11-29
- 0.9.40-26 — 2024-10-17
- 0.9.10 — 2024-09-29
- 0.9.40-24 — 2024-09-25
- 0.9.40-12 — 2024-07-31
- 0.9.40-8 — 2024-07-03
- 0.9.7 — 2024-06-25
- 0.9.6 — 2024-06-13
- 0.9.36 — 2023-11-22
- 0.9.35 — 2023-05-31
- 0.9.34 — 2023-05-31
- 0.9.33 — 2023-05-30
- 0.9.8 — 2022-11-04
- 0.8.8 — 2022-09-16
- … 7 more at https://npm.io/package/survey-map/versions

## README

# surveymap使用手册
`在线帮助文档地址：http://192.168.100.133:3000/#/`
## 安装

### npm安装

这是bugfix支线提交的代码
在安装前先登录公司的npm私服

```bash
npm login --registry=http://192.168.11.146:8073/repository/npm-all/
username：developer/uploader
password:  私服密码请联系组件开发或政务中台卢俊强获取
```

然后安装`survey-map`包

```bash
npm install -save survey-map --registry=http://192.168.11.146:8073/repository/npm-all/
```
### 版本号管理
* 一般情况下只允许dev分支发布组件，其它个人分支不允许发布组件！ *

major：主版本号
minor：次版本号
patch：补丁号
premajor：预备主版本
preminor：预备次版本
prepatch: 预备补丁版本
prerelease：预发布版本
```
npm version prepatch
```

### 清理node_modules
请每隔一段时间清理下本地node_modules，否则会因为各自引入的包版本不一致，导致node_modules目录过大，导致安装第三方包、打包、发布版本耗时过久
```
npm install rimraf -g
npm run clean-lib
npm install
```
## 快速使用

### 引入surveymap

在main.js写入以下内容：

```javascript
import SurveyMap from 'survey-map'
import 'survey-map/lib/survey-map.css'
import ElementUI from 'element-ui'
import  'shinegis-client/dist/styles/index.css'
import  'element-ui/lib/theme-chalk/index.css';

Vue.config.productionTip = false

Vue.use(SurveyMap);
Vue.use(ElementUI);
```



## 组件

### webmap

#### 基本用法 

```html
<template>
  <div id="app">   
  <web-map ref="webmap"> </web-map>
  </div>
</template>
```
##### 属性查图
```html

```

##### 图查属性

##### 
#### mapConfig

地图初始化参数，可选

```javascript

                options: {
                center: '120.1448,30.2672',
                zoom: 17,
                zoomControl: true,
                scale: true,
                fullscreen: true,
                basemapcontrol: true,
                mouseposition: true,
                projection: "EPSG:4490",
                defaultmap: "c17c4b75-98c5-4359-80d1-3e9154834d95",
                basemaps: [
                    {
                    id: "c17c4b75-98c5-4359-80d1-3e9154834d95",
                    name: "影像",
                    thumbnailUrl: require("../../public/assets/img/basemap/satellite.png"),
                    layers: [{
                        id: "e4f24e5c-38ff-4bbd-8c4f-f2585eee047b1",
                        name: "img",
                        type: "tdt",
                        url: "http://t3.tianditu.gov.cn/img_c/wmts?tk=73f429c4c1d4550cdbac3def1243aa9c",
                        layerIdentifier: "TianDiTu.Satellite.Map"
                    },
                        {
                        id: "70e19c03-06a9-496c-8c76-7b5bd78b8a56",
                        name: "cia",
                        type: "tdt",
                        url: "http://t3.tianditu.gov.cn/cia_c/wmts?tk=73f429c4c1d4550cdbac3def1243aa9c",
                        layerIdentifier: "TianDiTu.Satellite.Annotion"
                        }
                    ]
                    }, {
                    id: "df6c94ad-c73f-4eda-96ff-362e23c763db",
                    name: "矢量",
                    thumbnailUrl: require("../../public/assets/img/basemap/street.png"),
                    layers: [{
                        id: "14ec2baf-a0df-428a-bb94-99a009dcdf4a",
                        name: "vec",
                        type: "tdt",
                        url: "http://t3.tianditu.com/vec_c/wmts?tk=73f429c4c1d4550cdbac3def1243aa9c",
                        layerIdentifier: "TianDiTu.Normal.Map"
                    },
                        {
                        id: "3fe7a518-afdc-4b2d-a6ea-2224584665e1",
                        name: "cva",
                        type: "tdt",
                        url: "http://t3.tianditu.com/cva_c/wmts?tk=73f429c4c1d4550cdbac3def1243aa9c",
                        layerIdentifier: "TianDiTu.Normal.Annotion"
                        }
                    ]
                    }],               
                
                },           
          } 
```



#### tocConfig

图层目录配置参数，可选

```javascript
[
                    {
                        "showIndex":1,
                        "parent":null,
                        "initChecked":"false",
                        "id":"00000001000100000001000000000000",
                        "label":"图层目录",
                        "tp":"directory",
                        "guid":"db125b76-5a90-2e5e-598c-6158173707b0",
                        "editing":false
                    },
                    {
                        "showIndex":2,
                        "parent":"00000001000100000001000000000000",
                        "initChecked":"false",
                        "id":"00000001000100010001000000000001",
                        "label":"数智可视化",
                        "tp":"directory",
                        "guid":"9e47bf66-c3da-748f-8672-e0fabc574422",
                        "editing":false
                    },
                    {
                        "showIndex":3,
                        "parent":"00000001000100010001000000000001",
                        "initChecked":"false",
                        "id":"00000001000100060001000000000001",
                        "label":"权调数据",
                        "tp":"directory",
                        "guid":"e81731c2-19af-f9e4-839e-7b4a53403835",
                        "editing":false                
                    },   
                    {
                        "showIndex":11,
                        "parent":"00000001000100060001000000000001",
                        "serverOrigin":"other",
                        "identifyField":[
                        {
                         "search":"OBJECTID,ZD_ID,DJQDM,DJQZH,ZD_SYQLX,ZD_TZM",
                        "lyr":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZD/MapServer/0",
                        "display":"OID,宗地内码,地籍区代码,地籍区主号,宗地使用权类型,宗地特征码",
                        "name":"0"
                        }
                        
                        ],
                        "mapIndex":11,
                        "geotype":"polygon",
                        "mobile":false,
                        "label":"宗地",
                        "mobileOpacity":false,
                        "type": "feature",            
                        "visibleLayers":[
                            "0"
                        ],
                        "isFit":false,
                        "isUserPictureLegend":false,
                        "topologyCheck":"0",
                        "layerTag":"ST_ZD",
                        "selectLayer":"",
                        "isSwitch":false,
                        "isFilter":false,
                        "initChecked":true,
                        "id":"9e725c9620a1469b8947eb68d2950fa1",
                        "opacity":1,
                        "showInfoWindow":true,
                        "tp":"layer",
                        "group":"2",
                        "guid":"00139827-bd84-4d07-b2a9-7a0ba69458a0",
                        "editing":true,
                        "url":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZD/MapServer/"                
                    },
                    {
                        "showIndex":12,
                        "parent":"00000001000100060001000000000001",
                        "serverOrigin":"other",
                        "identifyField":[
                        {
                        "search":"OBJECTID",
                        "lyr":"http://192.168.11.85:6080/arcgis/rest/services/330101/YCZRZ/MapServer/0",
                        "display":"OBJECTID",
                        "name":"0"
                        }
                        
                        ],
                        "mapIndex":12,
                        "geotype":"polygon",
                        "mobile":false,
                        "label":"预测自然幢",
                        "mobileOpacity":false,
                        "type": "feature",            
                        "visibleLayers":[
                            "0"
                        ],
                        "isFit":false,
                        "isUserPictureLegend":false,
                        "topologyCheck":"0",
                        "layerTag":"YCZRZ",
                        "selectLayer":"",
                        "isSwitch":false,
                        "isFilter":false,
                        "initChecked":false,
                        "id":"3724f146-9d34-4553-b776-dd2f27895252",
                        "opacity":1,
                        "showInfoWindow":true,
                        "tp":"layer",
                        "group":"2",
                        "guid":"00139827-bd84-4d07-b2a9-7a0ba69458a0",
                        "editing":true,
                        "url":"http://192.168.11.85:6080/arcgis/rest/services/330101/YCZRZ/MapServer/"
                    
                    },
                    {
                        "showIndex":13,
                        "parent":"00000001000100060001000000000001",
                        "serverOrigin":"other",
                        "identifyField":[
                        {
                        "search":"OBJECTID",
                        "lyr":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZRZ/MapServer/0",
                        "display":"OBJECTID",
                        "name":"0"
                        }
                        
                        ],
                        "mapIndex":13,
                        "geotype":"polygon",
                        "mobile":false,
                        "label":"自然幢",
                        "mobileOpacity":false,
                        "type": "feature",            
                        "visibleLayers":[
                            "0"
                        ],
                        "isFit":false,
                        "isUserPictureLegend":false,
                        "topologyCheck":"0",
                        "layerTag":"ST_ZRZ",
                        "selectLayer":"",
                        "isSwitch":false,
                        "isFilter":false,
                        "initChecked":false,
                        "id":"8c5108e3-5114-4985-aa43-ddec1dda8764",
                        "opacity":1,
                        "showInfoWindow":true,
                        "tp":"layer",
                        "group":"2",
                        "guid":"00139827-bd84-4d07-b2a9-7a0ba69458a0",
                        "editing":true,
                        "url":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZRZ/MapServer/"             
                    },
                    {
                        "showIndex":14,
                        "parent":"00000001000100060001000000000001",
                        "serverOrigin":"other",
                        "identifyField":[
                        {
                        "search":"OBJECTID",
                        "lyr":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_LD/MapServer/0",
                        "display":"OBJECTID",
                        "name":"0"
                        }
                        
                        ],
                        "mapIndex":14,
                        "geotype":"polygon",
                        "mobile":false,
                        "label":"林地",
                        "mobileOpacity":false,
                        "type": "feature",            
                        "visibleLayers":[
                            "0"
                        ],
                        "isFit":false,
                        "isUserPictureLegend":false,
                        "topologyCheck":"0",
                        "layerTag":"ST_LD",
                        "selectLayer":"",
                        "isSwitch":false,
                        "isFilter":false,
                        "initChecked":false,
                        "id":"3d0c0d50-0496-4fcd-b37e-58f8b3d6aa27",
                        "opacity":1,
                        "showInfoWindow":true,
                        "tp":"layer",
                        "group":"2",
                        "guid":"00139827-bd84-4d07-b2a9-7a0ba69458a0",
                        "editing":true,
                        "url":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_LD/MapServer/"
                    },
                    {
                        "showIndex":15,
                        "parent":"00000001000100060001000000000001",
                        "serverOrigin":"other",
                        "identifyField":[
                        {
                        "search":"OBJECTID",
                        "lyr":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZH/MapServer/0",
                        "display":"OBJECTID",
                        "name":"0"
                        }
                        
                        ],
                        "mapIndex":16,
                        "geotype":"polygon",
                        "mobile":false,
                        "label":"宗海",
                        "mobileOpacity":false,
                        "type": "feature",            
                        "visibleLayers":[
                            "0"
                        ],
                        "isFit":false,
                        "isUserPictureLegend":false,
                        "topologyCheck":"0",
                        "layerTag":"ST_ZH",
                        "selectLayer":"",
                        "isSwitch":false,
                        "isFilter":false,
                        "initChecked":false,
                        "id":"9e725c9620a1469b8947eb68d2950fa1",
                        "opacity":1,
                        "showInfoWindow":true,
                        "tp":"layer",
                        "group":"2",
                        "guid":"00139827-bd84-4d07-b2a9-7a0ba69458a0",
                        "editing":true,
                        "url":"http://192.168.11.85:6080/arcgis/rest/services/330101/ST_ZH/MapServer/"
                    },            
                ]
```

####  widgetInfo

待完善

```javascript
{
    innerToolbar:true,  //是否加载工具栏
        innerTools:{
            selectTool:true, //是否加载选择工具按钮
            identifyTool:true//是否加载i查询工具按钮
        }
}
```





#### props
| 参数名     | 说明           | 类型   | 默认值 | 可选值 |
| ---------- | -------------- | ------ | ------ | ------ |
| widgetInfo | 控制地图工具栏 | Object | -      | -      |
| mapConfig  | 地图控制参数   | Object | -      | -      |
| tocConfig  | 图层控制参数   | Array  | -      | -      |
#### events 

回调事件

| 事件名称         | 说明                   | 回调参数                     |
| ---------------- | ---------------------- | ---------------------------- |
| mapInitialized   | 容器初始化完毕时回调   | (gismap)回调GisMap对象       |
| mapConfiged      | config初始化完毕时回调 | (customMap)回调CustomMap对象 |
| identifyListener | I查询回调              | 回调查询结果Object对象       |
| featureSelected  | 选择图形后回调         | 回调选择结果Object对象       |

#### 方法

可使用方法，具体参数参考[http://192.168.10.195:3000/)

| 方法名                 | 说明                                                                                           | 参数                                                                                                 |
| ---------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| zoomTo                 | 改变地图的中心点，比例尺                                                                       | (center,zoom)接受2个参数，1. 中心点[x,y] 2. 比例尺,均可为undefined                                   |
| toggle                 | [实例](#toggle切换图层是否显示)根据layerid加载图层                                             | (layerid,isShow,isZoom)接受3个参数,1.id或者layerTag 2.boolean类型,表示新增或者移除, 3.是否缩放到图层 |
| changeBaseMap          | 切换底图                                                                                       | (basemap)想要显示的底图,详情见[basemaps参数解析](#basemaps参数解析)                                  |
| addConver              | 添加遮罩[实例](#addConver实例)                                                                 | (options)想要显示的底图,详情见[参数](#addConver参数)                                                 |
| getLayerById           | 根据图层Id获取图层对象                                                                         | (id)图层的ID                                                                                         |
| getLayerByLayerTag     | 根据图层layerTag获取图层对象                                                                   | (layerTag)图层的tag                                                                                  |
| getMapScale            | 获取当前地图的比例尺                                                                           | -                                                                                                    |
| getResolutionFromScale | 根据指定的比例尺换算分辨率                                                                     | (scale)比例尺)                                                                                       |
| getSelectFeatures      | 获取选中的地块                                                                                 | -                                                                                                    |
| getCheckedLayers       | 获取显示的图层                                                                                 | -                                                                                                    |
| addLinkMap             | 添加联动地图[实例](#addLinkMap实例)                                                            | (layer)想要联动的图层,详情见[参数](#addLinkMap参数)                                                  |
| updateMapSize          | map容器大小改变后重绘                                                                          | -                                                                                                    |
| search                 | 支持对geoserver图层WFS、WMS和feature服务的这类矢量图层(VectorLayer)做查询定位[实例](#基本用法) | (option)[参数](#search参数)                                                                          |
| locateGeoJson          | 根据geojson数据绘制图形并定位                                                                  | (geojson))                                                                                           |
| locateTempGraphic      | 根据已经绘制的图形唯一字段进行匹配并定位                                                       | (obj){id:'XXX'})                                                                                     |
| featureFlash           | 定位图形并闪烁                                                                                 | (feature,scale）接收两个参数 1要定位图形 2比例尺                                                     |
| parseWKT               | 将feature转为wkt格式数据                                                                       | (feature,isTransform)接收两个参数，1.feature 2.是否将经纬度坐标转成西安80                            |

#### 监听
| 方法名         | 说明                               | 参数                                                |
| -------------- | ---------------------------------- | --------------------------------------------------- |
| toggleDistrict | 切换行政区后，地图组件往外回调事件 | Object `{xzqmc:'西湖区'',xzqdm:'330103', key:0  } ` |

## 一张图开发注意事项

以下注意事项，主要解决打包时需要切换开发环境和生产环境的方案ID、用户ID

### PC端

- 有GIS运维平台
  - 运维平台地址、用户ID、方案ID都不允许在代码中写死，使用config.json配置
  - config.json 目前只允许配置运维平台地址、用户ID、方案ID
- 无GIS运维平台
  - config.json配置初始化配置信息，包括地图、图层、权限控制等

### 移动端

- 有GIS运维平台
  
  - 在app.vue文件中写死外网运维平台地址、方案ID、用户ID等信息
  
- 无GIS与运维平台
  - config.json配置初始化话配置信息，包括地图、图层、权限控制等
  
  - config.json 配置文件使用发布到外网。
  
    可以将配置文件放到112服务器：D:\ZjzsMap\nginx-1.14.2\webapps\yztConfig\Apps
  
    发布后的地址前缀：http://122.224.233.68:11120/yztConfig/Apps
  
  - 移动端需要的静态统计数据，也需要使用数据文件发布到外网
  
    可以将配置文件放到112服务器：D:\ZjzsMap\nginx-1.14.2\webapps\yztConfig\Datas
  
    发布后的地址前缀：http://122.224.233.68:11120/yztConfig/Datas

![image-20220625152356146](https://blog-ysh.oss-cn-hangzhou.aliyuncs.com/typora/image-20220625152356146.png)

---
_Source: https://npm.io/package/survey-map · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
