e-vue-esrimap
基于 vue-cli3+TypeScript 的二维地图组件,使用的地图 API 是 ArcGIS API for JavaScript v3.x(>=3.14)。
学习借鉴:https://github.com/laixiangran/e-ngx-esrimap
Usage
-
Install
npm install --save e-vue-esrimap@latest -
main.js
import EVueEsrimap from 'e-vue-esrimap'import 'font-awesome/css/font-awesome.css';Vue.use;`` -
template
谷歌地图服务天地图地图服务ArcGIS地图服务 -
ts
public googleMapComponent: any;public googleMap: any;public tdtMapComponent: any;public tdtMap: any;public esriMapComponent: any;public esriMap: any;public mapUrl: string = 'http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer';public geoUrl: string = 'http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer';public gisApiUrl: string = 'http://js.arcgis.com/3.23/';public esriCSSUrl: string = 'http://js.arcgis.com/3.23/esri/css/esri.css';public initExtent: any =;public initExtent2: any =;/*** 谷歌地图加载完成* @param $event*/public onGoogleMapReady$event: any/*** 谷歌底图切换* @param*/public onGoogleBaseLayerChange$event: number/*** 天地图地图加载完成* @param $event*/public onTdtMapReady$event: any/*** 天地图底图切换* @param*/public onTdtBaseLayerChange$event: number/*** esri地图加载完成* @param $event*/public onEsriMapReady$event: any/*** esri底图切换* @param*/public onEsriBaseLayerChange$event: number}
API
Prop
-
isProxy
(boolean?=false
) - 是否开启代理,可使用 esri 提供的几个平台的代理文件 -
proxyUrl
(string?='proxy.jsp'
) - 代理页面的路径。如果出现跨域的问题,请检查是否正确设置代理路径 -
mapUrl
(string[] | string='http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer'
) - 基础底图路径,如mapType='tdt'
,则 mapUrl 可从这四种地图类型vec(矢量图层), cva(矢量标注), img(影像图层), cia(影像标注)
通过数组形式组合使用。如mapType='google'
,则 mapUrl 可从这三种地图类型m(矢量图层), p(地形图层), y(影像图层)
中选择。mapType='esri',则 mapUrl 是完整的 ArcGIS 切片地图服务路径 -
submapUrl
(any[]
)- 其它切换的底图路径,如mapType='tdt'
,则 submapUrl 可从这四种地图类型vec(矢量图层), cva(矢量标注), img(影像图层), cia(影像标注)
通过数组形式组合使用。如mapType='google'
,则 mapUrl 可从这三种地图类型m(矢量图层), p(地形图层), y(影像图层)
中选择。mapType='esri',则 submapUrl 是完整的 ArcGIS 切片地图服务路径的数组 -
mapType
(string?='esri'
) - 基础底图类型,tdt
:天地图(wkid: 4326),google
:谷歌地图(wkid: 102113),esri
:esri 地图服务(wkid: 看具体服务wkid) -
geoUrl
(string?='http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer'
) - 几何服务路径,默认是在线路径,最好配置自己的路径 -
gisApiUrl
(string?='http://js.arcgis.com/3.23/'
) - arcgis javascript API 路径,默认是在线路径,最好配置自己的路径 -
esriCSSUrl
(string?='http://js.arcgis.com/3.23/esri/css/esri.css'
) - esri.css 路径,默认是在线路径,最好配置自己的路径 -
initExtent
(Object
) - 初始地图范围,{xmax, xmin, ymax, ymin}
。默认范围自适应屏幕显示,如果不想自适应则可调用 setExtent 方法设置范围并指定是否自适应
// esriMap: any;Color: any;Graphic: any;SpatialReference: any;urlUtils: any;esriConfig: any; // esri/tasksGeoprocessor: any;GeometryService: any;FeatureSet: any;FindTask: any;FindParameters: any;IdentifyTask: any;IdentifyParameters: any;QueryTask: any;Query: any;ProjectParameters: any;BufferParameters: any; // esri/layersArcGISTiledMapServiceLayer: any;ArcGISDynamicMapServiceLayer: any;WebTiledLayer: any;GraphicsLayer: any;ImageParameters: any;TileInfo: any; // esri/geometryExtent: any;Point: any;ScreenPoint: any;Polyline: any;Polygon: any;WebMercatorUtils: any; // esri/symbolsPictureMarkerSymbol: any;SimpleMarkerSymbol: any;SimpleLineSymbol: any;CartographicLineSymbol: any;PictureFillSymbol: any;SimpleFillSymbol: any;TextSymbol: any;Font: any; // toolbarDraw: any;
Develop
```shell
npm install // 安装依赖包
npm start // 启动项目
```