x

[gelöst] osm2pgsql Error


  1. [gelöst] osm2pgsql Error · SafetyIng (Gast) · 02.07.2022 00:49 · [flux]

    Moin,

    ich versuchte mich heute an einem kleinen Skript für osm2pqsql. Leider bekomme ich immer wieder die selbe Fehlermeldung....

    2022-07-02␣01:47:49␣␣osm2pgsql␣version␣1.6.0
    2022-07-02␣01:47:49␣␣Database␣version:␣14.3␣(Ubuntu␣14.3-0ubuntu0.22.04.1)
    2022-07-02␣01:47:49␣␣PostGIS␣version:␣3.2
    2022-07-02␣01:47:50␣␣ERROR:␣Error␣loading␣lua␣config:␣./streets.lua:2:␣attempt␣to␣index␣a␣nil␣value␣(global␣'osm2pqsql').
    

    Meine streets.lua sieht wie folgt aus:

    local␣streets␣=␣osm2pqsql.define_way_table('osm_streets',␣{
    {␣column␣=␣'type',␣␣␣␣type␣=␣'text'␣},
    {␣column␣=␣'name',␣␣␣␣type␣=␣'text'␣},
    {␣column␣=␣'tags',␣␣␣␣type␣=␣'jsonb'␣},
    {␣column␣=␣'geom',␣␣␣␣type␣=␣'linestring'␣},
    })
    
    local␣sidepaths␣=␣osm2pqsql.define_way_table('osm_sidepaths',␣{
    {␣column␣=␣'type',␣␣␣␣type␣=␣'text'␣},
    {␣column␣=␣'name',␣␣␣␣type␣=␣'text'␣},
    {␣column␣=␣'tags',␣␣␣␣type␣=␣'jsonb'␣},
    {␣column␣=␣'geom',␣␣␣␣type␣=␣'linestring'␣},
    })
    
    local␣signs␣=␣osm2pqsql.define_node_table('osm_trafficsigns',␣{
    {␣column␣=␣'sign',␣␣␣␣type␣=␣'text'␣␣},
    {␣column␣=␣'direction',␣type␣=␣'integer'},
    {␣column␣=␣'geom',␣␣␣␣type␣=␣'point'},
    })
    
    local␣get_highway_value␣=␣osm2pgsql.make_check_values_func({
    'primary',␣'secondary',␣'tertiary',
    'primary_link',␣'secondary_link',␣'tertiary_link',
    'unclassified',␣'residential',␣'pedestrian',␣'living_street',
    'service',␣'track',␣'footway',␣'path',␣'cycleway'
    })
    
    local␣get_sidepath_value␣=␣osm2pgsql.make_check_values_func({
    'yes'
    })
    
    function␣osm2pgsql.process_way(object)
    local␣highway_type␣=␣get_highway_value(object.tags.highway)
    local␣sidepath_type␣=␣get_sidepath_value(object.tags.is_sidepath)
    
    if␣not␣highway_type␣then
    return
    end
    
    if␣object.tags.area␣==␣'yes'␣then
    return
    end
    
    if␣not␣sidepath_type␣then
    streets:add_row({
    type␣␣␣␣=␣highway_type,
    tags␣␣␣␣=␣object.tags,
    name␣␣␣␣=␣object.tags.name,
    geom␣␣␣␣=␣{␣create␣=␣'line'␣}
    })
    else
    sidepaths:add_row({
    type␣␣␣␣=␣highway_type,
    tags␣␣␣␣=␣object.tags,
    name␣␣␣␣=␣object.tags.name,
    geom␣␣␣␣=␣{␣create␣=␣'line'␣}
    })
    end
    end
    
    function␣osm2pgsql.process_node(object)
    if␣object.tags.highway␣==␣'traffic_sign'␣then
    signs:add_row({
    sign␣␣=␣object.tags.traffic_sign,
    direction␣=␣object.tags['traffic_sign:direction'],
    geom␣=␣{␣create␣=␣'point'␣}
    })
    end
    end
    

    Ich bin bisschen ratlos und verstehe nicht, wo das Problem liegt. Vielleicht kann ja jemand mit mehr Erfahrung mit osm2pgsql helfen.


    • Re: [gelöst] osm2pgsql Error · mmd (Gast) · 02.07.2022 07:25 · [flux]

      Ich denke da fehlt wohl ein —output=flex beim Aufruf von osm2pgsql.

      https://osm2pgsql.org/doc/manual.html#the-flex-output


    • Re: [gelöst] osm2pgsql Error · mboeringa (Gast) · 02.07.2022 07:42 · [flux]

      I also strongly recommend to upgrade your PG14.3 install to the latest PG14.4.

      There was a severe issue introduced in PG14.2 that was only properly fixed in 14.4, that caused post-import processing that I personally developed to fail, including a virtual machine lock up that I saw happening with 14.3 due to the bug causing PostgreSQL to fill up my entire file system root of Ubuntu.

      I haven't actually seen those issues with the initial import using osm2pgsql, but the command that triggered it was simply a "SELECT COUNT(*) FROM <table>", so a very common statement.


    • Re: [gelöst] osm2pgsql Error · Nakaner (Gast) · 02.07.2022 09:40 · [flux]

      Hallo mboeringa,

      der Fehler von SafetyIng hat nichts mit PostGIS zu tun. Dein Hinweis ist nicht hilfreich.

      @SafetyIng Es empfiehlt sich bei solchen Problemen, den kompletten Aufruf von Osm2pgsql anzugeben.

      Viele Grüße

      Michael


    • Re: [gelöst] osm2pgsql Error · SafetyIng (Gast) · 02.07.2022 12:01 · [flux]

      Nakaner wrote:

      @SafetyIng Es empfiehlt sich bei solchen Problemen, den kompletten Aufruf von Osm2pgsql anzugeben.

      Ja, wenn man Fehler so spät abends irgendwann "aufgibt" 😄 Ist mir wohl untergegangen:

      osm2pgsql␣-d␣bike␣-O␣flex␣-s␣-S␣./streets.lua␣magdeburg.osm.pbf
      

      Systeminfo vielleicht noch sinnvoll: Ubuntu 22.04 LTS


    • Re: [gelöst] osm2pgsql Error · mmd (Gast) · 02.07.2022 13:30 · [flux]

      Du hast da 3 Tippfehler drin: das heißt nicht osm2pqsql, sondern osm2pgsql (also mit "g" wie Golf vor dem "sql" am Ende, abgeleitet von Postgresql), jeweils in Zeile 1, Zeile 8 und Zeile 15.

      Richtig wäre: osm2pgsql.define_way_table und osm2pgsql.define_node_table


    • Re: [gelöst] osm2pgsql Error · SafetyIng (Gast) · 02.07.2022 14:31 · [flux]

      mmd wrote:

      Du hast da 3 Tippfehler drin: das heißt nicht osm2pqsql, sondern osm2pgsql (also mit "g" wie Golf vor dem "sql" am Ende, abgeleitet von Postgresql), jeweils in Zeile 1, Zeile 8 und Zeile 15.

      Richtig wäre: osm2pgsql.define_way_table und osm2pgsql.define_node_table

      Danke, manchmal ist man einfach Betriebsblind.....