annotate pkg/imports/fm.go @ 5710:37c8feeecb4d

Merged branch sr-v2 into default.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 20 Feb 2024 21:28:56 +0100
parents 1222b777f51f
children 6270951dda28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4948
821ae20b6a20 Re-added missing header lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4947
diff changeset
1 // This is Free Software under GNU Affero General Public License v >= 3.0
821ae20b6a20 Re-added missing header lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4947
diff changeset
2 // without warranty, see README.md and license for details.
821ae20b6a20 Re-added missing header lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4947
diff changeset
3 //
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 // SPDX-License-Identifier: AGPL-3.0-or-later
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5 // License-Filename: LICENSES/AGPL-3.0.txt
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 //
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 // Copyright (C) 2020 by via donau
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 // – Österreichische Wasserstraßen-Gesellschaft mbH
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9 // Software engineering by Intevation GmbH
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 //
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 // Author(s):
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 // * Tom Gottfried <tom.gottfried@intevation.de>
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
13 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 package imports
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 import (
4931
e41d42be0e13 One more callback to avoid code duplication more consequently
Tom Gottfried <tom@intevation.de>
parents: 4907
diff changeset
18 "database/sql"
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19 "fmt"
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
20 "strings"
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
21
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
22 "gemma.intevation.de/gemma/pkg/pgxutils"
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
23 "github.com/fatih/structs"
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
24 )
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
25
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
26 type (
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
27 // FairwayMarksProperties are common to all types of fairway marks
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
28 FairwayMarksProperties struct {
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
29 Datsta *string `json:"hydro_datsta"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
30 Datend *string `json:"hydro_datend"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
31 Persta *string `json:"hydro_persta"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
32 Perend *string `json:"hydro_perend"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
33 Objnam *string `json:"hydro_objnam"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
34 Nobjnm *string `json:"hydro_nobjnm"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
35 Inform *string `json:"hydro_inform"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
36 Ninfom *string `json:"hydro_ninfom"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
37 Scamin *int `json:"hydro_scamin"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
38 Picrep *string `json:"hydro_picrep"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
39 Txtdsc *string `json:"hydro_txtdsc"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
40 Sordat *string `json:"hydro_sordat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
41 Sorind *string `json:"hydro_sorind"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
42 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
43
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
44 // BcnlatProperties are embedded in other properties.
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
45 BcnlatProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
46 FairwayMarksProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
47 Colour *string `json:"hydro_colour"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
48 Colpat *string `json:"hydro_colpat"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
49 Condtn *int `json:"hydro_condtn"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
50 Bcnshp *int `json:"hydro_bcnshp"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
51 }
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
52
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
53 bcnlatHydroProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
54 BcnlatProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
55 Catlam *int64 `json:"hydro_catlam"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
56 }
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
57
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
58 bcnlatIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
59 BcnlatProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
60 Catlam *int64 `json:"ienc_catlam"`
4974
e1d8217954a0 Ignore fields not used as arguments to prepared statements
Tom Gottfried <tom@intevation.de>
parents: 4973
diff changeset
61 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
62 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
63
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
64 // BoylatProperties are embedded in other properties.
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
65 BoylatProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
66 FairwayMarksProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
67 Colour *string `json:"hydro_colour"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
68 Colpat *string `json:"hydro_colpat"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
69 Conrad *int `json:"hydro_conrad"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
70 Boyshp *int `json:"hydro_boyshp"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
71 }
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
72
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
73 boylatHydroProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
74 BoylatProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
75 Marsys *int64 `json:"hydro_marsys"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
76 Catlam *int64 `json:"hydro_catlam"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
77 }
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
78
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
79 boylatIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
80 BoylatProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
81 Marsys *int64 `json:"ienc_marsys"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
82 Catlam *int64 `json:"ienc_catlam"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
83 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
84
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
85 boycarProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
86 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
87 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
88 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
89 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
90 Marsys *int `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
91 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
92 Catcam *int `json:"hydro_catcam"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
93 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
94
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
95 boysawProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
96 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
97 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
98 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
99 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
100 Marsys *int64 `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
101 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
102 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
103
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
104 boysppProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
105 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
106 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
107 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
108 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
109 Marsys *int64 `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
110 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
111 Catspm *string `json:"hydro_catspm"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
112 }
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
113
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
114 // DaymarProperties are embedded in other properties.
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
115 DaymarProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
116 FairwayMarksProperties
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
117 Colour *string `json:"hydro_colour"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
118 Colpat *string `json:"hydro_colpat"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
119 Condtn *int `json:"hydro_condtn"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
120 Topshp *int `json:"hydro_topshp"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
121 }
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
122
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
123 daymarHydroProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
124 DaymarProperties
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
125 }
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
126
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
127 daymarIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
128 DaymarProperties
4974
e1d8217954a0 Ignore fields not used as arguments to prepared statements
Tom Gottfried <tom@intevation.de>
parents: 4973
diff changeset
129 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
130 Orient *float64 `json:"hydro_orient"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
131 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
132
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
133 lightsProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
134 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
135 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
136 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
137 Orient *float64 `json:"hydro_orient"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
138 Catlit *string `json:"hydro_catlit"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
139 Exclit *int `json:"hydro_exclit"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
140 Litchr *int `json:"hydro_litchr"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
141 Litvis *string `json:"hydro_litvis"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
142 Mltylt *int `json:"hydro_mltylt"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
143 Sectr1 *float64 `json:"hydro_sectr1"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
144 Sectr2 *float64 `json:"hydro_sectr2"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
145 Siggrp *string `json:"hydro_siggrp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
146 Sigper *float64 `json:"hydro_sigper"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
147 Sigseq *string `json:"hydro_sigseq"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
148 Status *string `json:"hydro_status"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
149 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
150
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
151 notmrkProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
152 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
153 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
154 Marsys *int `json:"hydro_bcnshp"`
4974
e1d8217954a0 Ignore fields not used as arguments to prepared statements
Tom Gottfried <tom@intevation.de>
parents: 4973
diff changeset
155 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
156 Orient *float64 `json:"hydro_orient"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
157 Status *string `json:"hydro_status"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
158 Addmrk *string `json:"ienc_addmrk"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
159 Catnmk *int `json:"ienc_catnmk"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
160 Disipd *float64 `json:"ienc_disipd"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
161 Disipu *float64 `json:"ienc_disipu"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
162 Disbk1 *float64 `json:"ienc_disbk1"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
163 Disbk2 *float64 `json:"ienc_disbk2"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
164 Fnctnm *int `json:"ienc_fnctnm"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
165 Bnkwtw *int `json:"ienc_bnkwtw"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
166 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
167
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
168 rtpbcnProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
169 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
170 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
171 Siggrp *string `json:"hydro_siggrp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
172 Catrtb *int `json:"hydro_catrtb"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
173 Radwal *string `json:"hydro_radwal"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
174 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
175
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
176 topmarProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
177 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
178 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
179 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
180 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
181 Topshp *int `json:"hydro_topshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
182 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
183 )
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
184
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
185 func (props *bcnlatIencProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
186 return props.Dirimp
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
187 }
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
188
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
189 func (props *daymarIencProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
190 return props.Dirimp
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
191 }
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
192
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
193 func (props *notmrkProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
194 return props.Dirimp
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
195 }
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
196
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
197 const (
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
198 // BCNLATHYDROJobKind is the unique name for the respective import.
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
199 BCNLATHYDROJobKind JobKind = "fm_bcnlat_hydro"
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
200 // BCNLATIENCJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
201 BCNLATIENCJobKind JobKind = "fm_bcnlat_ienc"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
202 // BOYLATHYDROJobKind is the unique name for the respective import.
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
203 BOYLATHYDROJobKind JobKind = "fm_boylat_hydro"
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
204 // BOYLATIENCJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
205 BOYLATIENCJobKind JobKind = "fm_boylat_ienc"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
206 // BOYCARJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
207 BOYCARJobKind JobKind = "fm_boycar"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
208 // BOYSAWJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
209 BOYSAWJobKind JobKind = "fm_boysaw"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
210 // BOYSPPJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
211 BOYSPPJobKind JobKind = "fm_boyspp"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
212 // DAYMARHYDROJobKind is the unique name for the respective import.
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
213 DAYMARHYDROJobKind JobKind = "fm_daymar_hydro"
5601
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
214 // DAYMARIENCJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
215 DAYMARIENCJobKind JobKind = "fm_daymar_ienc"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
216 // LIGHTSJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
217 LIGHTSJobKind JobKind = "fm_lights"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
218 // NOTMRKJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
219 NOTMRKJobKind JobKind = "fm_notmrk"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
220 // RTPBCNJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
221 RTPBCNJobKind JobKind = "fm_rtpbcn"
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
222 // TOPMARJobKind is the unique name for the respective import.
1222b777f51f Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5020
diff changeset
223 TOPMARJobKind JobKind = "fm_topmar"
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
224 )
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
225
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
226 func init() {
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
227 RegisterJobCreator(BCNLATHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
228 &WFSFeatureJobCreator{
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
229 description: "fairway marks bcnlat (HYDRO)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
230 depends: [2][]string{{"fairway_marks_bcnlat_hydro"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
231 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
232 prepareStmnts(
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
233 createInsertFMSQL("bcnlat_hydro",
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
234 "colour", "colpat", "condtn", "bcnshp", "catlam"),
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
235 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
236 consume,
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
237 createInvalidation("bcnlat_hydro"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
238 newPointFeature(func() interface{} { return new(bcnlatHydroProperties) }),
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
239 ),
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
240 })
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
241
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
242 RegisterJobCreator(BCNLATIENCJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
243 &WFSFeatureJobCreator{
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
244 description: "fairway marks bcnlat (IENC)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
245 depends: [2][]string{{"fairway_marks_bcnlat_ienc"}},
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
246 newConsumer: newSQLConsumer(
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
247 prepareStmnts(
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
248 createInsertFMSQL("bcnlat_ienc",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
249 "colour", "colpat", "condtn", "bcnshp", "catlam"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
250 insertBcnlatDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
251 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
252 consume,
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
253 createInvalidation("bcnlat_ienc"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
254 newPointFeature(func() interface{} { return new(bcnlatIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
255 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
256 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
257
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
258 RegisterJobCreator(BOYLATHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
259 &WFSFeatureJobCreator{
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
260 description: "fairway marks boylat (HYDRO)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
261 depends: [2][]string{{"fairway_marks_boylat_hydro"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
262 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
263 prepareStmnts(
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
264 createInsertFMSQL("boylat_hydro",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
265 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
266 "marsys", "boyshp", "catlam"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
267 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
268 consume,
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
269 createInvalidation("boylat_hydro"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
270 newPointFeature(func() interface{} { return new(boylatHydroProperties) }),
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
271 ),
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
272 })
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
273
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
274 RegisterJobCreator(BOYLATIENCJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
275 &WFSFeatureJobCreator{
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
276 description: "fairway marks boylat (IENC)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
277 depends: [2][]string{{"fairway_marks_boylat_ienc"}},
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
278 newConsumer: newSQLConsumer(
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
279 prepareStmnts(
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
280 createInsertFMSQL("boylat_ienc",
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
281 "colour", "colpat", "conrad",
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
282 "marsys", "boyshp", "catlam"),
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
283 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
284 consume,
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
285 createInvalidation("boylat_ienc"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
286 newPointFeature(func() interface{} { return new(boylatIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
287 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
288 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
289
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
290 RegisterJobCreator(BOYCARJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
291 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
292 description: "fairway marks boycar",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
293 depends: [2][]string{{"fairway_marks_boycar"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
294 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
295 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
296 createInsertFMSQL("boycar",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
297 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
298 "marsys", "boyshp", "catcam"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
299 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
300 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
301 createInvalidation("boycar"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
302 newPointFeature(func() interface{} { return new(boycarProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
303 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
304 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
305
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
306 RegisterJobCreator(BOYSAWJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
307 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
308 description: "fairway marks boysaw",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
309 depends: [2][]string{{"fairway_marks_boysaw"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
310 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
311 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
312 createInsertFMSQL("boysaw",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
313 "colour", "colpat", "conrad", "marsys", "boyshp"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
314 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
315 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
316 createInvalidation("boysaw"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
317 newPointFeature(func() interface{} { return new(boysawProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
318 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
319 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
320
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
321 RegisterJobCreator(BOYSPPJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
322 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
323 description: "fairway marks boyspp",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
324 depends: [2][]string{{"fairway_marks_boyspp"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
325 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
326 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
327 createInsertFMSQL("boyspp",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
328 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
329 "marsys", "boyshp", "catspm"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
330 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
331 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
332 createInvalidation("boyspp"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
333 newPointFeature(func() interface{} { return new(boysppProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
334 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
335 })
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
336
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
337 RegisterJobCreator(DAYMARHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
338 &WFSFeatureJobCreator{
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
339 description: "fairway marks daymar (HYDRO)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
340 depends: [2][]string{{"fairway_marks_daymar_hydro"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
341 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
342 prepareStmnts(
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
343 createInsertFMSQL("daymar_hydro",
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
344 "colour", "colpat", "condtn", "topshp"),
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
345 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
346 consume,
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
347 createInvalidation("daymar_hydro"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
348 newPointFeature(func() interface{} { return new(daymarHydroProperties) }),
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
349 ),
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
350 })
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
351
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
352 RegisterJobCreator(DAYMARIENCJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
353 &WFSFeatureJobCreator{
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
354 description: "fairway marks daymar (IENC)",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
355 depends: [2][]string{{"fairway_marks_daymar_ienc"}},
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
356 newConsumer: newSQLConsumer(
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
357 prepareStmnts(
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
358 createInsertFMSQL("daymar_ienc",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
359 "colour", "colpat", "condtn", "topshp", "orient"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
360 insertDaymarDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
361 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
362 consume,
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
363 createInvalidation("daymar_ienc"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
364 newPointFeature(func() interface{} { return new(daymarIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
365 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
366 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
367
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
368 RegisterJobCreator(LIGHTSJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
369 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
370 description: "fairway marks lights",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
371 depends: [2][]string{{"fairway_marks_lights"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
372 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
373 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
374 createInsertFMSQL("lights",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
375 "colour", "condtn", "orient",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
376 "catlit", "exclit", "litchr",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
377 "litvis", "mltylt", "sectr1",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
378 "sectr2", "siggrp", "sigper",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
379 "sigseq", "status"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
380 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
381 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
382 createInvalidation("lights"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
383 newPointFeature(func() interface{} { return new(lightsProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
384 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
385 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
386
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
387 RegisterJobCreator(NOTMRKJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
388 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
389 description: "fairway marks notmrk",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
390 depends: [2][]string{{"fairway_marks_lights"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
391 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
392 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
393 createInsertFMSQL("notmrk",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
394 "condtn", "marsys", "orient",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
395 "status", "addmrk", "catnmk",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
396 "disipd", "disipu", "disbk1",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
397 "disbk2", "fnctnm", "bnkwtw"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
398 insertNotmrkDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
399 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
400 consume,
4972
0e180d651fc6 Fix typo that let every NOTMRK import fail
Tom Gottfried <tom@intevation.de>
parents: 4970
diff changeset
401 createInvalidation("notmrk"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
402 newPointFeature(func() interface{} { return new(notmrkProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
403 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
404 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
405
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
406 RegisterJobCreator(RTPBCNJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
407 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
408 description: "fairway marks rtpbcn",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
409 depends: [2][]string{{"fairway_marks_rtpbcn"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
410 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
411 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
412 createInsertFMSQL("rtpbcn",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
413 "condtn", "siggrp", "catrtb", "radwal"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
414 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
415 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
416 createInvalidation("rtpbcn"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
417 newPointFeature(func() interface{} { return new(rtpbcnProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
418 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
419 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
420
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
421 RegisterJobCreator(TOPMARJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
422 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
423 description: "fairway marks topmar",
5020
e4ab338e7ba9 Removed unnecessary creatings of empty slices in expressing read dependencies in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5010
diff changeset
424 depends: [2][]string{{"fairway_marks_topmar"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
425 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
426 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
427 createInsertFMSQL("topmar",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
428 "colour", "colpat", "condtn", "topshp"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
429 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
430 consume,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
431 createInvalidation("topmar"),
5007
799e8248de8d First step to move geometry creation for WFS features to loader.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4978
diff changeset
432 newPointFeature(func() interface{} { return new(topmarProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
433 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
434 })
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
435 }
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
436
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
437 const (
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
438 // Format string to be completed with type and additional attributes
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
439 /* Instead of the row comparisons in the WHERE clauses
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
440 of the CTE with the UPDATE and the INSERT ... SELECT, we could have
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
441 used the row-based UNIQUE indexes as arbiter indexes
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
442 in an INSERT ... ON CONFLICT ... DO UPDATE, but that turned out
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
443 to be able to bypass the UNIQUE index in some cases.
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
444 */
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
445 insertFMSQLtmpl = `
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
446 WITH a AS (
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
447 SELECT users.current_user_area_utm() AS a
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
448 ),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
449 g AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
450 SELECT newfm
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
451 FROM ST_Transform(ST_GeomFromWKB($1, $2::integer), 4326) AS newfm (newfm)
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
452 WHERE pg_has_role('sys_admin', 'MEMBER')
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
453 OR ST_Intersects((select a from a),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
454 ST_Transform(newfm, (select ST_SRID(a) from a)))
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
455 ),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
456 t AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
457 -- Currently valid and otherwise identical entry's validity.
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
458 /* If there are no intermittent updates of validity,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
459 there will always be only one currently valid and
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
460 otherwise identical entry. */
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
461 UPDATE waterway.fairway_marks_%[1]s SET last_found = current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
462 WHERE validity @> current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
463 AND (geom,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
464 datsta, datend, persta, perend, objnam, nobjnm, inform, ninfom,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
465 scamin, picrep, txtdsc, sordat, sorind,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
466 %[2]s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
467 ) IS NOT DISTINCT FROM (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
468 (SELECT newfm FROM g),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
469 $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
470 %[3]s)
4969
5621586e7a54 Avoid checking the same condition twice
Tom Gottfried <tom@intevation.de>
parents: 4968
diff changeset
471 RETURNING 1
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
472 )
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
473 INSERT INTO waterway.fairway_marks_%[1]s (
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
474 geom,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
475 datsta,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
476 datend,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
477 persta,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
478 perend,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
479 objnam,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
480 nobjnm,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
481 inform,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
482 ninfom,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
483 scamin,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
484 picrep,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
485 txtdsc,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
486 sordat,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
487 sorind,
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
488 %[2]s
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
489 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
490 SELECT newfm, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
491 %[3]s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
492 FROM g
4969
5621586e7a54 Avoid checking the same condition twice
Tom Gottfried <tom@intevation.de>
parents: 4968
diff changeset
493 WHERE NOT EXISTS(SELECT 1 FROM t)
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
494 RETURNING id
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
495 `
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
496
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
497 // Assume validity ended for all entries not found in data source
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
498 invalidateFairwayMarksSQLtmpl = `
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
499 WITH
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
500 a AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
501 SELECT users.current_user_area_utm() AS a
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
502 )
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
503 UPDATE waterway.fairway_marks_%s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
504 SET validity = tstzrange(lower(validity), current_timestamp)
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
505 WHERE validity @> current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
506 AND last_found < current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
507 AND (pg_has_role('sys_admin', 'MEMBER')
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
508 OR ST_Intersects((select a from a),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
509 ST_Transform(CAST(geom AS geometry), (select ST_SRID(a) from a))))
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
510 `
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
511
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
512 insertBcnlatDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
513 INSERT INTO waterway.fairway_marks_bcnlat_dirimps (fm_bcnlat_id, dirimp)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
514 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
515 `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
516
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
517 insertDaymarDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
518 INSERT INTO waterway.fairway_marks_daymar_dirimps (fm_daymar_id, dirimp)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
519 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
520 `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
521
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
522 insertNotmrkDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
523 INSERT INTO waterway.fairway_marks_notmrk_dirimps (fm_notmrk_id, dirimp)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
524 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
525 `
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
526 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
527
4977
4bf6cde2d996 Generalize WFS point import job to be able to import other geometry types, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4974
diff changeset
528 func createInvalidation(fmType string) func(*SQLGeometryConsumer) error {
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
529
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
530 invalidateFairwayMarksSQL := fmt.Sprintf(invalidateFairwayMarksSQLtmpl, fmType)
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
531
4977
4bf6cde2d996 Generalize WFS point import job to be able to import other geometry types, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4974
diff changeset
532 return func(spc *SQLGeometryConsumer) error {
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
533 res, err := spc.tx.ExecContext(spc.ctx, invalidateFairwayMarksSQL)
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
534 if err != nil {
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
535 return err
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
536 }
4961
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
537 old, err := res.RowsAffected()
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
538 if err != nil {
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
539 return err
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
540 }
4961
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
541 if old == 0 {
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
542 return ErrFeaturesUnmodified
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
543 }
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
544 spc.feedback.Info("Number of features removed from data source: %d", old)
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
545 return nil
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
546 }
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
547 }
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
548
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
549 // Create INSERT statement for specific fairway marks type
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
550 func createInsertFMSQL(fmType string, attributes ...string) string {
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
551 attNums := "$16"
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
552 for i := 1; i < len(attributes); i++ {
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
553 attNums += fmt.Sprintf(",$%d", 16+i)
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
554 }
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
555
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
556 return fmt.Sprintf(
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
557 insertFMSQLtmpl,
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
558 fmType,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
559 strings.Join(attributes, ","),
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
560 attNums,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
561 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
562 }
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
563
4977
4bf6cde2d996 Generalize WFS point import job to be able to import other geometry types, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4974
diff changeset
564 func storeAttribs(spc *SQLGeometryConsumer, id int64, attrs *string) {
4947
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
565 if attrs == nil || *attrs == "" {
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
566 return
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
567 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
568 dirimps := strings.Split(*attrs, ",")
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
569 for _, dirimp := range dirimps {
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
570 if err := spc.savepoint(func() error {
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
571 _, err := spc.stmts[1].ExecContext(
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
572 spc.ctx, id, dirimp)
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
573 return err
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
574 }); err != nil {
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
575 spc.feedback.Warn(
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
576 pgxutils.ReadableError{Err: err}.Error())
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
577 spc.feedback.Info(
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
578 "Tried to import '%s' as dirimp value",
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
579 dirimp)
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
580 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
581 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
582 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
583
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
584 func consume(
4977
4bf6cde2d996 Generalize WFS point import job to be able to import other geometry types, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4974
diff changeset
585 spc *SQLGeometryConsumer,
5010
1d1be6bd5304 Wrap geometries if needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5007
diff changeset
586 geom, properties interface{},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
587 epsg int,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
588 ) error {
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
589 var fmid int64
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
590 err := spc.savepoint(func() error {
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
591 return spc.stmts[0].QueryRowContext(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
592 spc.ctx,
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
593 append(
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
594 []interface{}{
5010
1d1be6bd5304 Wrap geometries if needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5007
diff changeset
595 geom.(interface{ asWKB() []byte }).asWKB(),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
596 epsg,
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
597 },
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
598 structs.Values(properties)...)...,
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
599 ).Scan(&fmid)
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
600 })
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
601 switch {
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
602 case err == sql.ErrNoRows:
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
603 return ErrFeatureDuplicated
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
604 // ignore -> filtered by responsibility area or a duplicate
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
605 case err != nil:
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
606 spc.feedback.Error(pgxutils.ReadableError{Err: err}.Error())
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
607 return ErrFeatureIgnored
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
608 default:
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
609 if attr, ok := properties.(interface{ attrib() *string }); ok {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
610 storeAttribs(spc, fmid, attr.attrib())
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
611 }
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
612 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
613 return nil
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
614 }