refactor: harden deps, fix geo math, and add engineering tooling
Replace xlsx with exceljs, unify CRS/DMS logic, move pages to views with shared map/toast composables, and add Vitest/ESLint/Prettier plus docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,72 @@
|
||||
# Vue 3 + Vite
|
||||
# 测绘工具箱 (geo-tools)
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
面向测绘与 GIS 日常工作的纯前端工具集,基于 Vue 3 + Vite 构建。支持坐标转换、距离/面积/方位角/高程计算、高德地名搜索、图上量测拾取与坐标展点。
|
||||
|
||||
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
||||
## 功能列表
|
||||
|
||||
| 工具 | 说明 |
|
||||
|------|------|
|
||||
| 坐标转换 | 度分秒与十进制互转、WGS84/GCJ-02 等坐标系转换、CGCS2000 高斯投影正反算,支持 Excel 批量 |
|
||||
| 距离计算 | 经纬度 Haversine 与平面坐标距离 |
|
||||
| 面积计算 | 多边形面积/周长,支持大地测量与平面算法 |
|
||||
| 角度转换 | 度分秒、十进制度、弧度互转 |
|
||||
| 方位角计算 | 方位角与象限角 |
|
||||
| 高程计算 | 高差、坡度、坡度角、斜距/水平距换算 |
|
||||
| 高德地名搜索 | 通过高德 Web 服务搜索 POI,导出 TXT/CSV |
|
||||
| 图上量测与拾取 | Leaflet 地图点选、量距、量面,显示 WGS-84 与投影坐标 |
|
||||
| 坐标展点 | 手动/批量/Excel 导入坐标并展绘到地图 |
|
||||
|
||||
## 技术栈
|
||||
|
||||
- Vue 3 + Vue Router + Vite
|
||||
- Leaflet(地图)、proj4 / gcoord(投影与坐标系)、Turf 子包(面积/长度)
|
||||
- ExcelJS(Excel 读写)
|
||||
- Vitest + ESLint + Prettier
|
||||
|
||||
## 本地开发
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
默认开发地址:`http://localhost:5173/geo-tools/`(已配置 `base: '/geo-tools/'`)。
|
||||
|
||||
## 常用脚本
|
||||
|
||||
```bash
|
||||
npm run dev # 开发服务器
|
||||
npm run build # 生产构建
|
||||
npm run preview # 预览构建结果
|
||||
npm run test # 单元测试
|
||||
npm run lint # ESLint 检查
|
||||
```
|
||||
|
||||
## 部署说明
|
||||
|
||||
项目构建产物默认部署在子路径 `/geo-tools/` 下(见 `vite.config.js` 的 `base` 与路由 `createWebHistory('/geo-tools/')`)。
|
||||
|
||||
常见部署方式:
|
||||
|
||||
1. 将 `npm run build` 生成的 `dist/` 上传到静态站点对应子目录(如 GitHub Pages 的 `/geo-tools/`)
|
||||
2. 若部署到站点根路径,需同步把 `base` 与路由器 history base 改为 `'/'`
|
||||
|
||||
### 注意事项
|
||||
|
||||
- **高德瓦片**:图上量测与坐标展点使用的高德栅格瓦片为非官方接口,公开长期部署时建议改为天地图等正规授权底图,或自行申请合规底图服务。
|
||||
- **高德 Web API Key**:地名搜索功能的 Key 保存在浏览器 `localStorage`。公开使用前请在高德控制台配置域名白名单与配额限制。
|
||||
- 坐标转换与投影计算在浏览器本地完成,不上传坐标数据到自建后端。
|
||||
|
||||
## 目录结构(简要)
|
||||
|
||||
```
|
||||
src/
|
||||
views/ # 路由页面
|
||||
composables/ # useLeafletMap、useToast 等
|
||||
utils/ # 坐标、投影、几何、Excel 等纯函数
|
||||
assets/css/ # 全局样式与主题变量
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Private / 按项目需要自行约定。
|
||||
|
||||
Reference in New Issue
Block a user