File: test_output_flex_schema.lua

package info (click to toggle)
osm2pgsql 2.1.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,652 kB
  • sloc: cpp: 59,934; python: 1,039; ansic: 763; sh: 25; makefile: 14
file content (25 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

local dtable = osm2pgsql.define_way_table('osm2pgsql_test_line', {
    { column = 'tags', type = 'hstore' },
    { column = 'geom', type = 'linestring' },
}, { schema = 'myschema' })

local delete_keys = {
    'odbl',
    'created_by',
    'source'
}

local clean_tags = osm2pgsql.make_clean_tags_func(delete_keys)

function osm2pgsql.process_way(object)
    if clean_tags(object.tags) then
        return
    end

    dtable:insert({
        tags = object.tags,
        geom = object:as_linestring()
    })
end