0.9.36 • Published 6 months ago

survey-map v0.9.36

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

surveymap使用手册

在线帮助文档地址:http://192.168.100.133:3000/#/

安装

npm安装

这是bugfix支线提交的代码 在安装前先登录公司的npm私服

npm login --registry=http://192.168.11.146:8073/repository/npm-all/
username:developer/uploader
password:  私服密码请联系组件开发或政务中台卢俊强获取

然后安装survey-map

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写入以下内容:

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

基本用法

<template>
  <div id="app">   
  <web-map ref="webmap"> </web-map>
  </div>
</template>
属性查图
图查属性

mapConfig

地图初始化参数,可选

                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

图层目录配置参数,可选

[
                    {
                        "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

待完善

{
    innerToolbar:true,  //是否加载工具栏
        innerTools:{
            selectTool:true, //是否加载选择工具按钮
            identifyTool:true//是否加载i查询工具按钮
        }
}

props

参数名说明类型默认值可选值
widgetInfo控制地图工具栏Object--
mapConfig地图控制参数Object--
tocConfig图层控制参数Array--

events

回调事件

事件名称说明回调参数
mapInitialized容器初始化完毕时回调(gismap)回调GisMap对象
mapConfigedconfig初始化完毕时回调(customMap)回调CustomMap对象
identifyListenerI查询回调回调查询结果Object对象
featureSelected选择图形后回调回调选择结果Object对象

方法

可使用方法,具体参数参考[http://192.168.10.195:3000/)

方法名说明参数
zoomTo改变地图的中心点,比例尺(center,zoom)接受2个参数,1. 中心点x,y 2. 比例尺,均可为undefined
toggle实例根据layerid加载图层(layerid,isShow,isZoom)接受3个参数,1.id或者layerTag 2.boolean类型,表示新增或者移除, 3.是否缩放到图层
changeBaseMap切换底图(basemap)想要显示的底图,详情见basemaps参数解析
addConver添加遮罩实例(options)想要显示的底图,详情见参数
getLayerById根据图层Id获取图层对象(id)图层的ID
getLayerByLayerTag根据图层layerTag获取图层对象(layerTag)图层的tag
getMapScale获取当前地图的比例尺-
getResolutionFromScale根据指定的比例尺换算分辨率(scale)比例尺)
getSelectFeatures获取选中的地块-
getCheckedLayers获取显示的图层-
addLinkMap添加联动地图实例(layer)想要联动的图层,详情见参数
updateMapSizemap容器大小改变后重绘-
search支持对geoserver图层WFS、WMS和feature服务的这类矢量图层(VectorLayer)做查询定位实例(option)参数
locateGeoJson根据geojson数据绘制图形并定位(geojson))
locateTempGraphic根据已经绘制的图形唯一字段进行匹配并定位(obj){id:'XXX'})

监听

方法名说明参数
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