Search code examples
windowscurlcouchdbgeojson

Load GeoJSON file into Apache CouchDB


I am working on Windows10 and tried to load a geojson file into my couchdb via the "curl" command and a POST request in the cmd which looks like that:

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-

and then I get the following error:

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

On http://couchdb-13.readthedocs.org/en/latest/api-basics/ it is said, that "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." When I try that with a PUT request, I get the same error.

I validated the json with jsonlint so this should not be the problem. I tried several tutorials like "Three Steps to CouchDB Heaven …" or "Export & Import a Database with CouchDB" but none of them seems to work.

So I am not sure, where the problem is. Do I need to make changes in my geojson file, or something else?

thanks for your help


Solution

  • The needed curl command just looks like that:

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