后台服务总览
本文回答:后台服务主题的索引。一眼看清
vjmap.Service能做的所有事。
整体能力分类
| 类别 | 核心方法 | 子文件 |
|---|---|---|
| Service 基础 | new vjmap.Service(url, token)、svc.switchWorkspace、svc.addAccessKey、svc.addSecretKey |
service-basics |
| REST 底层 | svc.httpGet / svc.httpPost / svc.httpDel / 直接调用 /api/v1/... |
rest-interface |
| 地图常用方法 | svc.openMap / updateMap / metadata / cmdGetDrawBounds / getConstData |
common-map-methods |
| 要素查询主参考 | 全部实体类型 name='xx'、字段含义对照、完整 SQL 示例 |
query-features |
| SQL 查询速查 | svc.conditionQueryFeature / rectQueryFeature / pointQueryFeature |
query-sql |
| 表达式查询(内存模式) | svc.exprQueryFeature |
query-expression |
| 全文搜索 | REST GET/POST /api/v1/service/fullsearch/search / 云端管理平台 |
query-fulltext |
| 综合查询用例 | 自动分割子图 / 自动标注 / 自动提表 / 提取中心线 | query-cases |
| 服务端样式变量(条件高亮) | svrStyleVar / serverRenderStyle |
svr-style-var |
| 地图管理 | cmdDeleteMap / 版本 / 密码 / 隐藏 / 临时图 |
map-management |
| 上传创建 | svc.uploadMap(file) / svc.updateMap({ filedoc }) |
upload-create-map |
| 数据源类型 | vector / raster / geojson / image / video |
map-sources |
| 数据权限 | RBAC / token 角色 / superKey / secretKey / accessKey |
map-power |
| 导出 DWG | svc.execCommand("exportDxf"...) |
export-dwg |
| 其他导出 | PDF / PNG / GeoJSON / ForgeViewer | export-formats |
| 实体识别 | svc.execCommand("objectDetection"...) |
recognizer |
| AI 能力 | AI 对话 / AI 绘 CAD / 地图 MCP 协议 | ai-features |
最短示例
const svc = new vjmap.Service("https://vjmap.com/server/api/v1", TOKEN);
// 打开图
const res = await svc.openMap({ mapid: "sys_zp", mapopenway: vjmap.MapOpenWay.GeomRender });
// 查询图中所有文字
const q = await svc.conditionQueryFeature({
condition: `name='13' or name='12' or name='26' or name='27'`,
fields: "objectid,text,envelop",
geom: true,
limit: 100000
});
// 服务端过滤某个图层隐藏(注意:是 Map 的方法,不是 Service 的)
await map.switchLayers(svc, ["要显示的图层名"]);
// 导出 DWG
const exportRes = await svc.execCommand("exportDxf", {}, mapid, version, true);
三大红旗
- 任何
svc.接口结果不检查error→ 错误难追溯。 - SQL 条件写了
select * from table where ...→ 只要写where后面的内容。 exprQueryFeature在几何渲染图上用 → 能跑但慢;此时应改用conditionQueryFeature走空间库。