Git Product home page Git Product logo

Comments (5)

apmon avatar apmon commented on May 23, 2024

Yes, it is normal.

osm2pgsql generates (by default) a separate entry in the database for each geometry. However relations like multi-polygons can contain multiple geometries, (e.g. various exclaves of a boundary). As these geometries are all derived from the same osm relation, they all carry the osm_id of their parent, resulting in multiple entries per osm_id.

There is an option in osm2pgsql to generate multi-geometries, which I think will result in only one entry per osm_id, but I haven't tried that option, so I can't say if it works or does the correct thing.

from osm2pgsql.

openstreetmap-tiles avatar openstreetmap-tiles commented on May 23, 2024

On vendredi 31 mai 2013, apmon wrote:

There is an option in osm2pgsql to generate multi-geometries, which I think
will result in only one entry per osm_id, but I haven't tried that option,
so I can't say if it works or does the correct thing.

That won't be enough if you really want all relation beeing one only entry.

For that, you have to hack a bit in here :
https://github.com/openstreetmap/osm2pgsql/blob/master/output-pgsql.c#L671
https://github.com/openstreetmap/osm2pgsql/blob/master/output-pgsql.c#L730

Like adding a line like :
split_at = 100000000;
to avoid splitting long relation and ways.

sly, DWG member since 11/2012
Coordinateur du groupe [ga]
http://wiki.openstreetmap.org/wiki/User:Sletuffe

from osm2pgsql.

michael-hy avatar michael-hy commented on May 23, 2024

Thank you very much. I tested it and it works. For the München case, it is enough to specify the --multi-geometry parameter. Anyway i also patched the code in case i get larger areas that exceed the 1 degree "split_at" threshold.

This is my hacky code modification:

    if (Options->projection == PROJ_LATLONG)
        split_at = 1;
    else
        split_at = 100 * 1000;
    split_at = 100000000000; // my new line

from osm2pgsql.

sletuffe avatar sletuffe commented on May 23, 2024

I might have missunderstood your need, if you only care about polygones then the -G (--multi-geometry) is enough, the hack I proposed is however needed for line shaped relations (like type=road)

from osm2pgsql.

michael-hy avatar michael-hy commented on May 23, 2024

Thanks for the information.

Now i encountered another problem. Is there any reason why there could be the same osm_id of a point used multiple times. I could not trace it down yet when it happened, but look:

osm=# SELECT * from planet_osm_point where name='Frauenberg' AND place='village';
  osm_id   | access | addr:housename | addr:housenumber | addr:interpolation | admin_level | aerialway | aeroway | amenity | area | barrier | bicycle | brand | bridge | boundary | building | capital | construction | covered | culvert | cutting | denomination | disused | ele | embankment | foot | generator:source | harbour | highway | historic | horse | intermittent | junction | landuse | layer | leisure | lock | man_made | military | motorcar |    name    | natural | office | oneway | operator |  place  | poi | population | power | power_source | public_transport | railway | ref | religion | route | service | shop | sport | surface | toll | tourism | tower:type | tunnel | water | waterway | wetland | width | wood | z_order | timezone |                        way                         | name:en | flag 
-----------+--------+----------------+------------------+--------------------+-------------+-----------+---------+---------+------+---------+---------+-------+--------+----------+----------+---------+--------------+---------+---------+---------+--------------+---------+-----+------------+------+------------------+---------+---------+----------+-------+--------------+----------+---------+-------+---------+------+----------+----------+----------+------------+---------+--------+--------+----------+---------+-----+------------+-------+--------------+------------------+---------+-----+----------+-------+---------+------+-------+---------+------+---------+------------+--------+-------+----------+---------+-------+------+---------+----------+----------------------------------------------------+---------+------
 287938013 |        |                |                  |                    |             |           |         |         |      |         |         |       |        |          |          |         |              |         |         |         |              |         |     |            |      |                  |         |         |          |       |              |          |         |       |         |      |          |          |          | Frauenberg |         |        |        |          | village |     | 544        |       |              |                  |         |     |          |       |         |      |       |         |      |         |            |        |       |          |         |       |      |         |          | 0101000020E6100000C7F143A511831C406A7121EA99914840 |         | 
 287938013 |        |                |                  |                    |             |           |         |         |      |         |         |       |        |          |          |         |              |         |         |         |              |         |     |            |      |                  |         |         |          |       |              |          |         |       |         |      |          |          |          | Frauenberg |         |        |        |          | village |     | 544        |       |              |                  |         |     |          |       |         |      |       |         |      |         |            |        |       |          |         |       |      |         |          | 0101000020E6100000C7F143A511831C406A7121EA99914840 |         | 
(2 rows)

I appended filtered osm portions several times, thats why i could not track it down yet.

from osm2pgsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.