-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
108 lines (96 loc) · 2.7 KB
/
models.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- coding: utf-8 -*-
from ..common import T
from .tools import PlanetTable, PlanetPointTable, PlanetGraphTable
from .common import db
from py4web import Field
from itertools import chain
addrsfields = lambda *of: (Field("source_name"), Field("city"), Field("street"),) + of
db.define_table("addresses",
*addrsfields(),
# Field("codvia"),
migrate = False
)
db.define_table("housenumbers",
*addrsfields(
Field('housenumber')
),
migrate = False
)
# db.define_table("addons",
# Field("src_id"),
# Field("source_name"),
# Field("source_id"),
# Field("properties", "json"),
# singular = T("addon"), plural = T("addons"),
# table_class = PlanetTable,
# migrate = False
# )
db.define_table("points",
Field("node_id", "bigint"),
Field("src_id"),
Field("source_name"),
Field("source_id"),
Field("geom", "geometry()"),
Field("tags", "json"),
Field("properties", "json"),
Field("crds", "json"),
singular = T("point"), plural = T("points"),
table_class = PlanetPointTable,
migrate = False
)
polyssfields = lambda *of: (
Field("src_id"),
Field("source_name"),
Field("source_id"),
Field("geom", "geometry()"),
# Field("centroid", "geometry()"),
Field("tags", "json"),
Field("properties", "json"),
) + of
db.define_table("ways",
*polyssfields(),
# Field("centroid", "geometry()"),
table_class = PlanetTable,
migrate = False
)
db.define_table("polys",
*polyssfields(),
Field("centroid", "geometry()"),
table_class = PlanetTable,
migrate = False
)
db.define_table("mpolys",
*polyssfields(),
Field("centroid", "geometry()"),
table_class = PlanetTable,
migrate = False
)
# db.define_table("splitted_polys",
# *polyssfields(),
# table_class = PlanetTable,
# migrate = False,
# rname = "_splitted_polys"
# )
db.define_table("graph",
Field("src_id"),
Field("source_id", readable=False),
Field("source_name"),
Field("geom", "geometry()", readable=False),
# Field("ssource_id", readable=False),
Field("sinfo_id", "bigint", readable=False),
Field("snode_id", "bigint", readable=False),
Field("stags", "json", readable=False),
# Field("tsource_id", readable=False),
Field("tinfo_id", "bigint", readable=False),
Field("tnode_id", "bigint", readable=False),
Field("ttags", "json", readable=False),
Field("tags", "json"),
Field("properties", "json"),
# Field("crds", "json", readable=False),
Field("len", "double"),
# Field("crs"),
# Field("snid", "reference node", label='Source node id'),
# Field("tnid", "reference node", label='Target node id'),
table_class = PlanetGraphTable,
migrate = False
)