我正在使用地理服务器的API(link)将新的kml文件上传到mu本地机器,使用以下json的http://localhost:8080/geoserver/rest/imports发布请求
{
"import": {
"targetWorkspace": {
"workspace": {
"name": "sample"
}
},
"targetStore": {
"dataStore": {
"name": "sample"
}
},
"data": {
"type": "file",
"file": "/data/sample_dir/sample.kml"
}
}
}
我应该根据API文档获得响应的数据类型和状态,但我得到一个挂起的文件格式 . 响应:
{
"import": {
"id": 23,
"href": "http://localhost:8080/geoserver/rest/imports/23",
"state": "PENDING",
"archive": false,
"targetWorkspace": {
"workspace": {
"name": "sample"
}
},
"targetStore": {
"dataStore": {
"name": "sample",
"type": "Directory of spatial files (shapefiles)"
}
},
"data": {
"type": "file",
"format": null,
"file": "sample.kml"
},
"tasks": []
}
}
1 回答
显然,地理服务器不接受API文档中所说的相对路径 . 如果不是:
我用
在请求它工作正常 .