NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, I am new to osm2pgsql and i am figuring out how to import timestamp from osm .pbf file using the flex output. I am using version 1.8.0

My problem: Can't access to object.timestamp as the documentation says

My Lua file:

local pois = osm2pgsql.define_table({
    name = 'pois',
    ids = { type = 'any', type_column = 'osm_type', id_column = 'osm_id' },
    columns = {
        { column = 'updated_at'},
        { column = 'name' },
        { column = 'class', not_null = true },
        { column = 'subclass' },
        { column = 'geom', type = 'point', not_null = true },
        { column = 'tags', type = 'jsonb' },
}})


function process_poi(object, geom)
    local a = {
        updated_at = object.timestamp or nil,
        name = object.tags.name,
        geom = geom,
        tags = object.tags,
    }

    if object.tags.amenity and ( 
           object.tags.amenity == 'place_of_worship' or 
           object.tags.amenity == 'drinking_water' 
        )
        then
        a.class = 'amenity'
        a.subclass = object.tags.amenity
    elseif object.tags.natural and (
           object.tags.natural == 'peak' or
           object.tags.natural == 'spring'
        )
        then
        a.class = 'natural'
        a.subclass = object.tags.natural   
    else
        return
    end

    pois:insert(a)
end

function osm2pgsql.process_node(object)
    process_poi(object, object:as_point())
end

function osm2pgsql.process_way(object)
    if object.is_closed and object.tags.building then
        process_poi(object, object:as_polygon():centroid())
    end
end

What am i missing here?

Thank you for the attention.

asked 05 Mar, 09:20

Gemanzo's gravatar image

Gemanzo
11112
accept rate: 0%

closed 06 Mar, 10:50

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866

The question has been closed for the following reason "Duplicate Question" by SomeoneElse 06 Mar, 10:50

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×263
×18

question asked: 05 Mar, 09:20

question was seen: 468 times

last updated: 06 Mar, 10:50

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum