[osmosis-dev] Can't load osm file to PostGRESql

Brett Henderson brett at bretth.com
Tue May 4 13:56:18 BST 2010


On Tue, May 4, 2010 at 10:50 PM, Brett Henderson <brett at bretth.com> wrote:

> On Tue, May 4, 2010 at 5:56 PM, Ibrahim Bouchrika <
> ibrahim_bouchrika at hotmail.com> wrote:
>
>>  The database i'm using is a fresh made one, so the error must be
>> duplicate entries in the osm. I have the same problem with a duplicate
>> relation in the new york city file i extracted from a cloudmade map.
>>
>
>> Could the duplicate values be a result of a bug while extracting a bbox
>> with osmosis?
>>
>
> I doubt it, extracting a bbox should never create multiple instances of the
> same id.  It's more likely to be caused by incorrect use of the
> --apply-change task when applying minute or hourly diff files.  It was
> possible with older versions of osmosis to apply a full history diff
> containing multiple changes for a single entity which would result in
> multiple versions of the same entity being written to the result file.
>
>
>>
>> Is there a way around those duplicate entries, like perhaps overwriting
>> duplicate data? Going through all those entries manually seems almost
>> impossible.
>>
>
> Hmm, I'm not sure about the best way to tackle this ...
>
> I seem to remember Frederik having a clever way of removing duplicates.  I
> think he did something like the following:
> 1. Convert the entire file to an osc file by wrapping the entire contents
> of the file in osmChange element with an action of create or modify.
> 2. Feed the osc file through the --simplify-change task.
> 3. Create an empty osm file, then use the --apply-change task to add the
> entire change file to it.
>

Found it.  His steps were:

<quote>
Just for laughs - and wonder if you can come up with something better? -
this is what I did to remove the duplicate objects from an existing OSM file
named "faulty.osm":

echo "<osm></osm>" > empty.osm

osmosis --rx faulty.osm --rx empty.osm --dc --sort-change-0.6 --simc --wxc
good.osc

osmosis --rxc good.osc --rx empty.osm --ac --wx good.osm

(The two osmosis steps could be written as one but that would probably make
it more confusing.)
</quote>

Can you try these steps on your cloudmade file and see if that fixes the
problem?  If it does, Cloudmade has a problem with duplicate data in their
files.  If it doesn't fix it, then we'll have to dig further :-)

Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20100504/651078ee/attachment.html>


More information about the osmosis-dev mailing list