Opened 10 years ago

Closed 9 years ago

#5470 closed enhancement (invalid)

OSM: combine osm_id and osm_way_id for polygons

Reported by: kyngchaos Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: 1.11.0
Severity: normal Keywords: osm
Cc:

Description

For the OSM format driver, the current method of creating osm_id for defined osm polygons and osm_way_id for polygons created from closed ways makes a lot of trouble in a database. I can't create a primary key based on the osm_id and osm_way_id because postgres doesn't allow null fields in a primary key. So when merging, say, country extracts, where there might be a little duplication along the borders, it's difficult to remove those duplicates.

I think a better option would be to put the osm IDs for closed ways into osm_id along with normal polygon IDs (this works because they are mutually exclusive and unique) and have the osm_way_id field (or a different field name) be a flag to say that the record was created from a closed way. This makes using the osm_id as a primary key easy, and lets duplicates be easily skipped with the skipfailures option in ogr2ogr.

Change History (4)

comment:1 by Even Rouault, 9 years ago

Are you sure that way ids and relation ids cannot be equal ? Do you have a reference for that ?

comment:2 by kyngchaos, 9 years ago

I guess I don't know anything. I did finally figure out how to create mutually exclusive unique id indexes in Postgres so I don't get duplicates from adjacent country extracts, and so far I have not had duplicate polygon and way ids when I manually merge the ids. lucky. I'll have to figure something out when I do find a duplicate.

comment:3 by Jukka Rahkonen, 9 years ago

Way ids and relation ids can be equal

http://www.openstreetmap.org/relation/1000 (already deleted) http://www.openstreetmap.org/way/1000

comment:4 by Even Rouault, 9 years ago

Resolution: invalid
Status: newclosed

Based on Jukka's findings, I think this should be closed.

Note: See TracTickets for help on using tickets.