Skip to content

1. 前言

所有接收的消息体均采用 JSON 格式,如下:

字段类型备注
guidString微服务唯一标识(未使用,可不填)
typeStringrequest
msg_idInteger消息唯一标识,高程微服务为 801 - 899(未使用,可不填)
seqInteger消息序列(未使用,可不填)
toArray需要发送的微服务的唯一标识(未使用,可不填)
dataJSON请求的参数

所有返回结果也为 JSON 格式,如下:

字段类型备注
codeInteger200 表示成功,400 表示失败
dataJSON / String返回的结果,JSON 或字符串

调用示意图

2. 高程微服务

高程微服务提供 HTTP 和 MQTT 的接口 12 组,对于上述“未使用”字段在示例中进行了隐藏。具体内容如下:

2.1. 缓存路径设置

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/setCacheDir

参数(必填):

字段类型描述
cacheDirString缓存路径

示例:

json
{
  "type": "request",
  "data": {
    "cacheDir": "/usr/.gdal/wcs_cache"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "success"
}

2.2. 缓存路径获取

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/getCacheDir

参数:无

示例:

json
{
  "type": "request",
  "data": {}
}

返回(成功):

json
{
  "code": 200,
  "msg": "/usr/.gdal/wcs_cache"
}

2.3. 数据路径设置

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/setDataDir

参数(必填):

字段类型描述
DataDirString高程数据路径

示例:

json
{
  "type": "request",
  "data": {
    "dataDir": "/usr/.gdal/dem_data"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "success"
}

2.4. 数据路径获取

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/getDataDir

参数:无

示例:

json
{
  "type": "request",
  "data": {}
}

返回(成功):

json
{
  "code": 200,
  "msg": "/usr/.gdal/dem_data"
}

2.5. 在线高程服务 URL 设置

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/setServiceUrl

参数(必填):

字段类型描述
ServiceUrlStringWCS 高程数据在线服务 URL

示例:

json
{
  "type": "request",
  "data": {
    "serviceUrl": "www.xxx.com/geoserver/wcs?SERVICE=WCS&VERSION=1.0.0&COVERAGE=SRTM_GL1_CN:srtm_cn"
  }
}

返回(成功)

json
{
  "code": 200,
  "msg": "success"
}

2.6. 在线高程服务 URL 获取

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/getServiceUrl

参数:无

示例:

json
{
  "type": "request",
  "data": {}
}

返回(成功):

json
{
  "code": 200,
  "msg": "www.xxx.com/geoserver/wcs?SERVICE=WCS&VERSION=1.0.0&COVERAGE=SRTM_GL1_CN:srtm_cn"
}

2.7. 离线高程数据下载

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/requestTiles

参数(必填):

字段类型描述
xMinDouble最小经度范围
xMaxDouble最大经度范围
yMinDouble最小纬度范围
yMaxDouble最大纬度范围
progressUrlString回复下载进度的 URL,为空字符串则不会回复

示例:

json
{
  "type": "request",
  "data": {
    "xMin": 103.123,
    "xMax": 103.124,
    "yMin": 33.147,
    "yMax": 33.148,
    "progressUrl": "www.xxx.com/info"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "success"
}

返回(进度):

json
{
    "1091101922_2_4_9_1"
    // 每一块数据下载完成后都会进行进度的回复,格式说明如下:
    // <下载任务的 id>_<本地存在的瓦片数量>_<新下载的瓦片数量>_<该范围的所有瓦片数量>_<当前瓦片下载是否成功>
}

2.8. 停止高程数据下载

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/requestInterrupt

参数:无

示例:

json
{
  "type": "request",
  "data": {}
}

2.9. 图形高程查询

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/findElevations

参数(必填):

字段类型描述
geomTextJSONGeoJSON 中 geometry 层级的数据

示例:

json
{
  "type": "request",
  "data": {
    "geomText": "{\"type\":\"Polygon\",\"coordinates\":[[[108.51381,30.36623],[108.53677,30.36465],[108.51822,30.35176],[108.51381,30.36623]]]}"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "{\"type\":\"Polygon\",\"coordinates\":[[[108.51381,30.36623,1017.0],[108.53677,30.36465,1144.0],[108.51822,30.35176,874.0],[108.51381,30.36623,1017.0]]]}"
}

2.10. 平均高程查询

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/getMeanElevations

参数(必填):

字段类型描述
geomTextJSONGeoJSON 中 geometry 层级的数据

示例:

json
{
  "type": "request",
  "data": {
    "geomText": "{\"type\":\"Polygon\",\"coordinates\":[[[108.51381,30.36623],[108.53677,30.36465],[108.51822,30.35176],[108.51381,30.36623]]]}"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": 1009.33
}

2.11. 线段栅格化

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/rasterizeLines

参数(必填):

字段类型描述
geomTextJSONGeoJSON 中 geometry 层级的数据

示例:

json
{
  "type": "request",
  "data": {
    "geomText": "{\"type\":\"LineString\",\"coordinates\":[[108.34402,30.36308],[108.38269,30.29296]]}"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "{\"type\":\"LineString\",\"coordinates\":[[108.34402,30.36308,854.0],[108.34402,30.363194444445934,854.0],[108.34402,30.363750000001488,847.0],[108.34402,30.364027777779267,841.0],[108.34402,30.364305555557046,830.0],[108.34402,30.364583333334824,821.0],[108.34402,30.364861111112603,819.0],[108.34402,30.36508,817.0]]}"
}

2.12. 局部极值点查询

通信类型:MQTT / HTTP

主题 / 接口:/index/api/dem/localExtremums

参数(必填):

字段类型描述
geomTextJSONGeoJSON 中 geometry 层级的数据

示例:

json
{
  "type": "request",
  "data": {
    "geomText": "{\"type\":\"LineString\",\"coordinates\":[[108.34402,30.36308],[108.38269,30.29296]]}"
  }
}

返回(成功):

json
{
  "code": 200,
  "msg": "{\"type\":\"LineString\",\"coordinates\":[[108.34402,30.36308,854.0],[108.346714301672506,30.358194444445925,932.0],[108.346867491442424,30.357916666668149,929.0],[108.347327060752178,30.357083333334813,939.0],[108.347480250522096,30.356805555557035,936.0],[108.350850425460308,30.350694444445917,1105.0],[108.351003615230226,30.350416666668139,1102.0],[108.352688702699325,30.34736111111258,1186.0],[108.352995082239161,30.346805555557022,1173.0],[108.353454651548915,30.34597222222369,1184.0],[108.354067410628588,30.344861111112579,1155.0],[108.354220600398506,30.3445833333348,1158.0],[108.354373790168424,30.344305555557021,1154.0],[108.354526979938342,30.344027777779242,1164.0],[108.355905687867605,30.341527777779241,1021.0],[108.356058877637523,30.341250000001462,1024.0],[108.356212067407441,30.340972222223684,1011.0],[108.356365257177359,30.340694444445905,1014.0],[108.358050344646472,30.337638888890346,797.0],[108.364024745673291,30.326805555557002,1221.0],[108.364331125213127,30.326250000001444,1211.0],[108.364790694522881,30.325416666668112,1234.0],[108.365403453602553,30.324305555556997,1207.0],[108.36647578199198,30.322361111112553,1252.0],[108.36724173084157,30.320972222223659,1153.0],[108.368007679691161,30.319583333334769,1186.0],[108.369999146700096,30.315972222223657,1036.0],[108.370305526239932,30.315416666668099,1047.0],[108.3707650955497,30.314583333334763,1029.0],[108.372756562558635,30.310972222223651,1149.0],[108.373062942098471,30.310416666668093,1130.0],[108.373828890948062,30.309027777779203,1222.0],[108.374594839797652,30.307638888890313,1161.0],[108.376433117036669,30.304305555556976,1294.0],[108.377199065886259,30.302916666668086,1384.0],[108.377811824965946,30.301805555556971,1360.0],[108.378118204505782,30.301250000001417,1394.0],[108.380416051054553,30.297083333334744,1472.0],[108.380569240824471,30.296805555556965,1467.0],[108.382560707833406,30.293194444445852,1588.0],[108.38269,30.29296,1580.0]]}"
}