osm2pgsql导入duplicate key error in slim mode
2017-01-21 16:31
661 查看
This is a well known issue and one that is likely not going to be addressed any time soon.
While the rendering tables allow multiple geometries per osm feature / id and therefore don't have a unique constraint on osm_id, the slim tables are used for update processing and thus need to do lookups based on osm_id, for which it has to be unique.
For performance reasons osm2pgsql uses the COPY command, that batches up inserts into a single command. As such, if there is a unique constraint (or duplicate Key) violation, the whole batch fails. As osm2pgsql does stream based processing, it does not have the ability to go back and reprocess that batch of nodes / ways / relations to properly deal with the duplicate entry. Therefore, it cannot recover from such a duplicate key failure and terminates.
Osm2pgsql therefore doesn't support importing multiple files into one database in slim mode if there are duplicate osm features. Instead, I would recommend merging the two files prior to importing with osm2pgsql. For example with osmosis that supports de-duplication on merge.
参考: https://github.com/openstreetmap/osm2pgsql/issues/16#event-165848217
While the rendering tables allow multiple geometries per osm feature / id and therefore don't have a unique constraint on osm_id, the slim tables are used for update processing and thus need to do lookups based on osm_id, for which it has to be unique.
For performance reasons osm2pgsql uses the COPY command, that batches up inserts into a single command. As such, if there is a unique constraint (or duplicate Key) violation, the whole batch fails. As osm2pgsql does stream based processing, it does not have the ability to go back and reprocess that batch of nodes / ways / relations to properly deal with the duplicate entry. Therefore, it cannot recover from such a duplicate key failure and terminates.
Osm2pgsql therefore doesn't support importing multiple files into one database in slim mode if there are duplicate osm features. Instead, I would recommend merging the two files prior to importing with osm2pgsql. For example with osmosis that supports de-duplication on merge.
参考: https://github.com/openstreetmap/osm2pgsql/issues/16#event-165848217
相关文章推荐
- e11000-duplicate-key-error-index-in-mongodb-mongoose
- ERROR:duplicate key in table MYsql
- Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061) ----Hive schematool -initSchema
- Error (10309): VHDL Interface Declaration error in keyboard.vhd(63): interface object "scan_code" of mode out cannot be read. Change object mode to bu
- Mapreduce Error: Type mismatch in key from map
- how to solve Error cannot add duplicate collection entry of type add with unique key attribute 'valu
- error: ‘for’ loop initial declarations are only allowed in C99 mode
- error: ‘for’ loop initial declarations are only allowed in C99 mode
- Code::Blocks 关于error: 'for' loop initial declarations are only allowed in C99 mode
- Pull error. No value for key branch.master.merge found in configuration
- error: 'for' loop initial declarations are only allowed in C99 mode
- [Err] 1022 - Can't write; duplicate key in table '#sql-1500_26'
- code sign error doesn't match any valid certificate private key pair in the default keych 错误的解决办法
- Mapreduce Error: Type mismatch in key from map
- How to Solve Key_read Failed Error in Git Push
- SSIS 之 Exception "Cannot insert duplicate key in object..."
- SVN Fixing “SSL handshake failed: SSL error: Key usage violation in certificate has been detected.”
- MySQL --- SQL Error: 1062: Duplicate entry '2147483647' for key 'PRIMARY'
- error: ‘for’ loop initial declarations are only allowed in C99 mode
- error: 'for' loop initial declarations are only allowed in C99 mode