将 GeoJSON 文件加载到 Apache CouchDB

Load GeoJSON file into Apache CouchDB

我正在研究 Windows10 并尝试通过 "curl" 命令和 cmd 中的 POST 请求将 geojson 文件加载到我的 couchdb 中像那样:

C:\Program Files\cURL\bin>curl -d @path-to-my-data\data.geojson -H "Content-type: application/json" -X POST http://127.0.0.1:5984/_utils/database.html?-dbName-

然后出现以下错误:

{"error":"method_not_allowed","reason":"Only GET,HEAD allowed"}

http://couchdb-13.readthedocs.org/en/latest/api-basics/ 上,据说 "If you use the an unsupported HTTP request type with a URL that does not support the specified type, a 405 error will be returned, listing the supported HTTP methods." 当我尝试使用 PUT 请求时,我得到了同样的错误。

我用 jsonlint 验证了 json,所以这应该不是问题所在。 我尝试了几个教程,例如 "Three Steps to CouchDB Heaven …" 或 "Export & Import a Database with CouchDB",但其中 none 似乎有效。

所以我不确定,问题出在哪里。我是否需要更改我的 geojson 文件或其他文件?

感谢您的帮助

所需的 curl 命令如下所示:

curl -H "Content-Type: application/json" -X POST http://localhost:5984/db -d @C:\Users\Name\Desktop\data.geojson