NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi all, I'm very new to OSM and postgreSQL ...I've been trying for some days to load .oms extracts onto PostgreSql through osm2pgsql..and I just can't get my around it. Need some help, plz...

C:\Users\Francesca>osm2pgsql -d Test -m -W C:\OSM\08---Emilia-Romagna.osm -S C:\
osm2pgsql-bin\  -c -U postgres -H localhost -P 5433 -r osm
osm2pgsql version 0.92.0 (64 bit id space)
Using built-in tag processing pipeline
Using projection SRS 3857 (Spherical Mercator)
Setting up table: planet_osm_point
Setting up table: planet_osm_line
Setting up table: planet_osm_polygon
Setting up table: planet_osm_roads
Allocating memory for sparse node cache
Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=1
Mid: Ram, scale=100
Reading in file: C:\OSM\08---Emilia-Romagna.osm
Using XML parser.
node cache: stored: 0(-nan(ind)%), storage efficiency: -nan(ind)% (dense blocks:
 0, sparse nodes: 0), hit rate: -nan(ind)%
Osm2pgsql failed due to ERROR: Open failed for 'C:\OSM\08---Emilia-Romagna.osm':
 Dati non validi.

I've tried to download .pbt file but I got other XML parsing error such as "invalid token"... What do I do wrong? Thanks

asked 24 Oct '17, 16:07

psqldaimon's gravatar image

accept rate: 0%

edited 24 Oct '17, 19:10

SimonPoole's gravatar image

SimonPoole ♦

Could you make the input file available somewhere or point to from where you got it?

(24 Oct '17, 19:11) SimonPoole ♦

Pls don't answer your own question :-)

There are 7 files listed, which one/format did you download?

(24 Oct '17, 19:22) SimonPoole ♦

:) I tried .oms and the .pbf (no cut)

(24 Oct '17, 19:31) psqldaimon

Visual inspection didn't indicate anything obviously wrong with the .osm file (at least the first and last couple of dozen elements, so it should have read at least a couple of nodes.

However I suspect the -r flag is wrong according to the documentation that should by -r xml for osm format files NOT -r osm (and for pbf you should be specifying -r pbf).

permanent link

answered 24 Oct '17, 20:10

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 18%

I put -r flag as xml and it worked as a charm... except that I got another error message:

Osm2pgsql failed due to ERROR: XML parsing error at line 17257713, column 1: unclosed token

Any suggestions? Thanks

(24 Oct '17, 22:10) psqldaimon

If you downloaded the files yesterday, the uncompressed file should be 5668669254 bytes large (your issue sounds like a corrupted file, I checked my copy and it was OK at and around the line in question)

(24 Oct '17, 23:50) SimonPoole ♦

Hi SimonPoole, I followed your hint and I realized that trying different unzipping softwares I was always getting different files! I picked the file with bytes number closer to the one you suggested...and HAlleluiaaaa, it worked! Thanks a lot

Problem solved. Many lessons learned (and many unzipping softwares to be binned)

(25 Oct '17, 11:03) psqldaimon

well normally when in doubt we would have compared checksums, but that would have required finding a windows variant of what is available on Linux.

(25 Oct '17, 11:09) SimonPoole ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Oct '17, 16:07

question was seen: 2,396 times

last updated: 25 Oct '17, 11:09

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum