2

I found tool named imposm, I want to make local copy of OSM data and load them to PostgreSQL.

I can't understand how to do it. I run it with follow command: imposm3 run -config /apps/imposm/config.json

Config is next:

{
    "cachedir": "/home/osmdata/diff/",
    "connection": "postgis://postgres:123456@localhost:5432/geodb?sslmode=disable&prefix=NONE",
    "mapping": "/apps/imposm/mymap.json",
    "srid": 4326
}

I am getting error: [diff] unable to read last.state.txtstat /home/osmdata/diff/last.state.txt: no such file or directory

What should include this file. If I do not want any "last state" and doing the fresh import.

2

You seem to use the wrong command, if a fresh import (e.g. empty table) of OSM PBF data is what you require. The run command is used to update existing OSM tables in PostgreSQL/PostGIS, and needs additional caching structure to be able to update via OSM change files (e.g. diffs).

As stated in the imposm import tutorial, the general steps would be to import the data via read and write sequences like so (assuming imposm3 based on your question, which is still under developement)

imposm3 import -config config.json -read yourdata.osm.pbf -write

which will import yourdata.osm.pbf, with the DB credentials and mapping file provided in your config.json.

Now, as stated in the imposm updating tutorial, to be able to use OSM/diffs to update an existing table (via the use command you provided), you will have to add the -diff parameter to the above import command like so

imposm3 import -config config.json -read yourdata.osm.pbf -write -diff -cachedir ./cache -diffdir ./diff

where you specify the directories for the general cache and the downloaded change files (OSM/diffs). This step includes the generation of the missing last.state.txt file in your example and enables you to use your run command on the already created OSM database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.