File: test_output_flex_bbox.lua

package info (click to toggle)
osm2pgsql 1.4.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,124 kB
  • sloc: cpp: 41,466; ansic: 1,366; python: 564; sh: 19; makefile: 15
file content (40 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

local points = osm2pgsql.define_node_table('osm2pgsql_test_points', {
    { column = 'tags',  type = 'hstore' },
    { column = 'min_x', type = 'real' },
    { column = 'min_y', type = 'real' },
    { column = 'max_x', type = 'real' },
    { column = 'max_y', type = 'real' },
    { column = 'geom',  type = 'point', projection = 4326 },
})

local highways = osm2pgsql.define_way_table('osm2pgsql_test_highways', {
    { column = 'tags',  type = 'hstore' },
    { column = 'min_x', type = 'real' },
    { column = 'min_y', type = 'real' },
    { column = 'max_x', type = 'real' },
    { column = 'max_y', type = 'real' },
    { column = 'geom',  type = 'linestring', projection = 4326 },
})

function osm2pgsql.process_node(object)
    local row = {
        tags = object.tags,
    }

    row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox()

    points:add_row(row)
end

function osm2pgsql.process_way(object)
    local row = {
        tags = object.tags,
        geom = { create = 'line' }
    }

    row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox()

    highways:add_row(row)
end