File: test_output_flex_invalid_geom.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 (45 lines) | stat: -rw-r--r-- 1,054 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
41
42
43
44
45

local tables = {}

tables.line = osm2pgsql.define_table{
    name = 'osm2pgsql_test_line',
    ids = { type = 'way', id_column = 'osm_id' },
    columns = {
        { column = 'tags', type = 'hstore' },
        { column = 'geom', type = 'linestring', projection = 4326 },
    }
}

tables.polygon = osm2pgsql.define_table{
    name = 'osm2pgsql_test_polygon',
    ids = { type = 'area', id_column = 'osm_id' },
    columns = {
        { column = 'tags', type = 'hstore' },
        { column = 'geom', type = 'geometry', projection = 4326 }
    }
}

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

    if object.tags.natural then
        tables.polygon:add_row({
            tags = object.tags,
            geom = { create = 'area' }
        })
    else
        tables.line:add_row({
            tags = object.tags
        })
    end
end

function osm2pgsql.process_relation(object)
    tables.polygon:add_row({
        tags = object.tags,
        geom = { create = 'area', split_at = 'multi' }
    })
end