-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcreateTables.sql
103 lines (89 loc) · 2.06 KB
/
createTables.sql
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
create extension postgis;
--
-- Creating pggeocoder Schema
--
drop schema if exists pggeocoder cascade;
create schema pggeocoder;
--
-- for Geocoding
--
create table pggeocoder.address_t (
todofuken varchar(60),
lat float,
lon float,
ttable varchar(40),
code varchar(2),
geog geography('POINT'),
year text
);
create unique index address_t_u on pggeocoder.address_t (todofuken);
create table pggeocoder.address_s (
todofuken varchar(60),
shikuchoson varchar(60),
tr_shikuchoson varchar(60),
lat float,
lon float,
code varchar(5),
geog geography('POINT'),
year text
);
create unique index address_s_u on pggeocoder.address_s (todofuken,shikuchoson);
create table pggeocoder.address_o (
todofuken varchar(60),
shikuchoson varchar(60),
tr_shikuchoson varchar(60),
ooaza varchar(60),
tr_ooaza varchar(60),
lat float,
lon float,
code varchar(12),
geog geography('POINT'),
year text
);
create unique index address_o_u on pggeocoder.address_o (todofuken,shikuchoson,ooaza);
create table pggeocoder.address_c (
todofuken varchar(60),
shikuchoson varchar(60),
tr_shikuchoson varchar(60),
ooaza varchar(60),
tr_ooaza varchar(60),
chiban varchar(60),
lat float,
lon float,
geog geography('POINT'),
year text
);
create unique index address_c_u on pggeocoder.address_c (todofuken,shikuchoson,ooaza,chiban);
create table pggeocoder.address_g (
todofuken varchar(60),
shikuchoson varchar(60),
tr_shikuchoson varchar(60),
ooaza varchar(60),
tr_ooaza varchar(60),
chiban varchar(60),
go varchar(60),
lat float,
lon float,
geog geography('POINT')
);
--
-- for Reverse Geocoding
--
create table pggeocoder.boundary_t (
todofuken varchar(60),
code varchar(2),
geom geometry('MULTIPOLYGON', 4326)
);
create table pggeocoder.boundary_s (
todofuken varchar(60),
shikuchoson varchar(60),
code varchar(5),
geom geometry('MULTIPOLYGON', 4326)
);
create table pggeocoder.boundary_o (
todofuken varchar(60),
shikuchoson varchar(60),
ooaza varchar(60),
code varchar(12),
geom geometry('MULTIPOLYGON', 4326)
);