---
title: "iServer 踩坑归集"
description: "记录使用超图 iServer 地图与数据服务过程中的接口选型、常见问题排查与实用查询技巧。"
canonical_url: "https://mhaibaraai.cn/docs/platforms/iserver"
---
# iServer 踩坑归集

> 记录使用超图 iServer 地图与数据服务过程中的接口选型、常见问题排查与实用查询技巧。

## 官方文档索引

- [iServer 开发指南：API 参考](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/API/iServer_API_reference.htm)
- [iServer 地图服务：zxyTileImage 瓦片](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/mergedProjects/SuperMapiServerRESTAPI/root/maps/map/zxyTileImage/zxyTileImage.htm) / [WMS 服务](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/API/WMS/WMS_introduce.htm)
- [iServer 数据服务：featureResults 资源](https://support.supermap.com/DataWarehouse/WebDocHelp/iServer/mergedProjects/SuperMapiServerRESTAPI/root/data/featureResults/featureResults.htm) / [WFS 服务](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/API/WFS/WFS_introduce.htm)

## 地图服务（`map-*`）

地图服务通常以 `map-xxx` 命名（如 `https://iserver.supermap.io/iserver/services/map-world/`），常用接口为 `rest` 和 `wms130`（`wms110` 仅用于向后兼容）。

![Map 服务接口](https://mhaibaraai.cn/images/guides/platforms/iserver/mapInterface.png)

- **zxyTileImage 瓦片服务**：`https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China/zxyTileImage`

![zxyTileImage 瓦片服务](https://mhaibaraai.cn/images/guides/platforms/iserver/zxyTileImage.png)

- **WMS 1.3.0 服务**：`https://iserver.supermap.io/iserver/services/map-china400/wms130`

![wms130 服务](https://mhaibaraai.cn/images/guides/platforms/iserver/wms130.png)

## 数据服务（`data-*`）

数据服务通常以 `data-xxx` 命名（如 `https://iserver.supermap.io/iserver/services/data-jingjin`），数据集标识格式为 `数据源名称:数据集名称`（如 `Jingjin:County_L`）。

![Data 服务接口](https://mhaibaraai.cn/images/guides/platforms/iserver/dataInterface.png)

- **REST GeoJSON 查询**：`https://iserver.supermap.io/iserver/services/data-jingjin/rest/data/featureResults.geojson`
- **WFS 2.0 服务**：`https://iserver.supermap.io/iserver/services/data-world/wfs200`

## 常见问题排查

### WMS 通过 `SLD_BODY` 修改样式不生效

**现象**：在 WMS `GetMap` 请求中传入 `SLD_BODY` 自定义样式后，图层渲染无变化。

![sld_body error](https://mhaibaraai.cn/images/guides/platforms/iserver/sldBody.png)

**原因与处理**：当前 iServer WMS 服务仅支持服务端预定义的图层样式（参见 [iServer GetMap 请求文档](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/API/WMS/WMS130/GetMap/GetMap_request.htm)），无法通过请求参数动态覆盖 SLD。

![sld_body reply](https://mhaibaraai.cn/images/guides/platforms/iserver/sldBodyReply.png)

### 地图服务请求 GeoJSON 报 URL 模板不匹配

**现象**：请求 `/iserver/services/map-text/rest/FZJZSSD@cs.geojson` 时报错，提示与资源 `root` 的 URL 模板不匹配。

![geojson error](https://mhaibaraai.cn/images/guides/platforms/iserver/geojson.png)

**原因与处理**：只有**数据服务（`data-*`）**的要素资源支持 `.geojson` 表述格式，地图服务（`map-*`）不支持。需重新发布为数据服务并勾选 `rest` 接口，确认右侧服务目录出现对应格式。

### 报错 `400`，`msg: 对象已经被释放`

![release error](https://mhaibaraai.cn/images/guides/platforms/iserver/releaseError.png)

**原因与处理**：多为数据库型数据源与服务缓存不同步导致，可先切换文件型数据源验证接口请求参数是否正确，再排查数据源连接与服务重启。

### WFS 2.0 获取描述文档成功，但获取要素报错

![wfs error1](https://mhaibaraai.cn/images/guides/platforms/iserver/wfsError1.png)

![wfs error2](https://mhaibaraai.cn/images/guides/platforms/iserver/wfsError2.png)

**原因与处理**：`iServer 2023 11i` 虽然在 `GetFeature` 执行时支持 `outputFormat=json`，但能力描述 XML 中未声明 `<ows:Value>json</ows:Value>`，导致 ArcGIS 等强校验客户端判定不支持该输出格式并报错。可改用默认 GML 输出或直接调用数据服务的 `featureResults.geojson`。

### WFS 2.0 点击事件拿不到要素全部属性

**现象**：点击地块时只能获取部分属性，无法满足详情展示。

![wfs error3](https://mhaibaraai.cn/images/guides/platforms/iserver/wfsError3.png)

![wfs error4](https://mhaibaraai.cn/images/guides/platforms/iserver/wfsError4.png)

**原因与处理**：`GetFeature` 配合 `FILTER`（编码语言 `urn:ogc:def:query Language:OGC-FES:Filter`，参见 [FILTER 示例](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/API/WFS/WFS200/GetFeature/FILTER.htm)）受前端/服务属性裁剪限制时，可仅通过 `esri_wfs_id` 与表名传给后端，由后端直查数据库返回完整详情。

### 获取地图四至范围（用于跳转定位）

通过 [iServer map 资源](http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/mergedProjects/SuperMapiServerRESTAPI/root/maps/map/map.htm) 接口读取服务元信息中的 `bounds`（四至范围），即可在前端地图切换时自动缩放到服务覆盖区域。

### 按四至范围获取当前地图可见图层的图例

获取到服务四至范围 `bounds` 后，拼接 `bbox` 参数请求 `legend.rjson`：

```ts
const bbox = `${bounds.left},${bounds.bottom},${bounds.right},${bounds.top}`
const url = `https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China/legend.rjson?returnVisibleOnly=true&bbox=${bbox}`
```

---

- [SuperMap iClient 示例](https://iclient.supermap.io/examples/mapboxgl/examples.html#iServer)
- [iServer REST API 参考](https://support.supermap.com/DataWarehouse/WebDocHelp/iServer/mergedProjects/SuperMapiServerRESTAPI/resource_hierarchy.htm)


## Sitemap

See the full [sitemap](https://mhaibaraai.cn/sitemap.md) for all pages.
