annotate pkg/imports/fm.go @ 5560:f2204f91d286

Join the log lines of imports to the log exports to recover data from them. Used in SR export to extract information that where in the meta json but now are only found in the log.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 09 Feb 2022 18:34:40 +0100
parents e4ab338e7ba9
children 1222b777f51f
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 (
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
27 // Properties 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
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
44 BcnlatProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
45 FairwayMarksProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
46 Colour *string `json:"hydro_colour"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
47 Colpat *string `json:"hydro_colpat"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
48 Condtn *int `json:"hydro_condtn"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
49 Bcnshp *int `json:"hydro_bcnshp"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
50 }
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 bcnlatHydroProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
53 BcnlatProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
54 Catlam *int64 `json:"hydro_catlam"`
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
55 }
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 bcnlatIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
58 BcnlatProperties
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
59 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
60 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
61 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
62
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
63 BoylatProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
64 FairwayMarksProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
65 Colour *string `json:"hydro_colour"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
66 Colpat *string `json:"hydro_colpat"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
67 Conrad *int `json:"hydro_conrad"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
68 Boyshp *int `json:"hydro_boyshp"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
69 }
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
70
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
71 boylatHydroProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
72 BoylatProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
73 Marsys *int64 `json:"hydro_marsys"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
74 Catlam *int64 `json:"hydro_catlam"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
75 }
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
76
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
77 boylatIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
78 BoylatProperties
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
79 Marsys *int64 `json:"ienc_marsys"`
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
80 Catlam *int64 `json:"ienc_catlam"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
81 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
82
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
83 boycarProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
84 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
85 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
86 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
87 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
88 Marsys *int `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
89 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
90 Catcam *int `json:"hydro_catcam"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
91 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
92
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
93 boysawProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
94 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
95 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
96 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
97 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
98 Marsys *int64 `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
99 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
100 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
101
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
102 boysppProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
103 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
104 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
105 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
106 Conrad *int `json:"hydro_conrad"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
107 Marsys *int64 `json:"hydro_marsys"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
108 Boyshp *int `json:"hydro_boyshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
109 Catspm *string `json:"hydro_catspm"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
110 }
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
111
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
112 DaymarProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
113 FairwayMarksProperties
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
114 Colour *string `json:"hydro_colour"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
115 Colpat *string `json:"hydro_colpat"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
116 Condtn *int `json:"hydro_condtn"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
117 Topshp *int `json:"hydro_topshp"`
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
118 }
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
119
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
120 daymarHydroProperties struct {
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
121 DaymarProperties
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
122 }
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
123
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
124 daymarIencProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
125 DaymarProperties
4974
e1d8217954a0 Ignore fields not used as arguments to prepared statements
Tom Gottfried <tom@intevation.de>
parents: 4973
diff changeset
126 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
127 Orient *float64 `json:"hydro_orient"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
128 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
129
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
130 lightsProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
131 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
132 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
133 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
134 Orient *float64 `json:"hydro_orient"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
135 Catlit *string `json:"hydro_catlit"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
136 Exclit *int `json:"hydro_exclit"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
137 Litchr *int `json:"hydro_litchr"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
138 Litvis *string `json:"hydro_litvis"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
139 Mltylt *int `json:"hydro_mltylt"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
140 Sectr1 *float64 `json:"hydro_sectr1"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
141 Sectr2 *float64 `json:"hydro_sectr2"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
142 Siggrp *string `json:"hydro_siggrp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
143 Sigper *float64 `json:"hydro_sigper"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
144 Sigseq *string `json:"hydro_sigseq"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
145 Status *string `json:"hydro_status"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
146 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
147
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
148 notmrkProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
149 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
150 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
151 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
152 Dirimp *string `json:"ienc_dirimp" structs:"-"`
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
153 Orient *float64 `json:"hydro_orient"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
154 Status *string `json:"hydro_status"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
155 Addmrk *string `json:"ienc_addmrk"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
156 Catnmk *int `json:"ienc_catnmk"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
157 Disipd *float64 `json:"ienc_disipd"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
158 Disipu *float64 `json:"ienc_disipu"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
159 Disbk1 *float64 `json:"ienc_disbk1"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
160 Disbk2 *float64 `json:"ienc_disbk2"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
161 Fnctnm *int `json:"ienc_fnctnm"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
162 Bnkwtw *int `json:"ienc_bnkwtw"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
163 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
164
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
165 rtpbcnProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
166 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
167 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
168 Siggrp *string `json:"hydro_siggrp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
169 Catrtb *int `json:"hydro_catrtb"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
170 Radwal *string `json:"hydro_radwal"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
171 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
172
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
173 topmarProperties struct {
4973
adeb4f8c0d6c Honour the fact that structs.Values() can access only exported fields
Tom Gottfried <tom@intevation.de>
parents: 4972
diff changeset
174 FairwayMarksProperties
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
175 Colour *string `json:"hydro_colour"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
176 Colpat *string `json:"hydro_colpat"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
177 Condtn *int `json:"hydro_condtn"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
178 Topshp *int `json:"hydro_topshp"`
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
179 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
180 )
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
181
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
182 func (props *bcnlatIencProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
183 return props.Dirimp
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
184 }
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
185
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
186 func (props *daymarIencProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
187 return props.Dirimp
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
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
190 func (props *notmrkProperties) attrib() *string {
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
191 return props.Dirimp
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
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
194 const (
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
195 BCNLATHYDROJobKind JobKind = "fm_bcnlat_hydro"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
196 BCNLATIENCJobKind JobKind = "fm_bcnlat_ienc"
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
197 BOYLATHYDROJobKind JobKind = "fm_boylat_hydro"
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
198 BOYLATIENCJobKind JobKind = "fm_boylat_ienc"
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
199 BOYCARJobKind JobKind = "fm_boycar"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
200 BOYSAWJobKind JobKind = "fm_boysaw"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
201 BOYSPPJobKind JobKind = "fm_boyspp"
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
202 DAYMARHYDROJobKind JobKind = "fm_daymar_hydro"
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
203 DAYMARIENCJobKind JobKind = "fm_daymar_ienc"
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
204 LIGHTSJobKind JobKind = "fm_lights"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
205 NOTMRKJobKind JobKind = "fm_notmrk"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
206 RTPBCNJobKind JobKind = "fm_rtpbcn"
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
207 TOPMARJobKind JobKind = "fm_topmar"
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
208 )
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
209
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
210 func init() {
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
211 RegisterJobCreator(BCNLATHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
212 &WFSFeatureJobCreator{
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
213 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
214 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
215 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
216 prepareStmnts(
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
217 createInsertFMSQL("bcnlat_hydro",
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
218 "colour", "colpat", "condtn", "bcnshp", "catlam"),
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
219 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
220 consume,
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
221 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
222 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
223 ),
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
224 })
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
225
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
226 RegisterJobCreator(BCNLATIENCJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
227 &WFSFeatureJobCreator{
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
228 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
229 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
230 newConsumer: newSQLConsumer(
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
231 prepareStmnts(
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
232 createInsertFMSQL("bcnlat_ienc",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
233 "colour", "colpat", "condtn", "bcnshp", "catlam"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
234 insertBcnlatDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
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_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
238 newPointFeature(func() interface{} { return new(bcnlatIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
239 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
240 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
241
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
242 RegisterJobCreator(BOYLATHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
243 &WFSFeatureJobCreator{
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
244 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
245 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
246 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
247 prepareStmnts(
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
248 createInsertFMSQL("boylat_hydro",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
249 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
250 "marsys", "boyshp", "catlam"),
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,
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
253 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
254 newPointFeature(func() interface{} { return new(boylatHydroProperties) }),
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
255 ),
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
256 })
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
257
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
258 RegisterJobCreator(BOYLATIENCJobKind,
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 (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
261 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
262 newConsumer: newSQLConsumer(
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
263 prepareStmnts(
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
264 createInsertFMSQL("boylat_ienc",
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
265 "colour", "colpat", "conrad",
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
266 "marsys", "boyshp", "catlam"),
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
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_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
270 newPointFeature(func() interface{} { return new(boylatIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
271 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
272 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
273
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
274 RegisterJobCreator(BOYCARJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
275 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
276 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
277 depends: [2][]string{{"fairway_marks_boycar"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
278 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
279 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
280 createInsertFMSQL("boycar",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
281 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
282 "marsys", "boyshp", "catcam"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
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,
4958
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
285 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
286 newPointFeature(func() interface{} { return new(boycarProperties) }),
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(BOYSAWJobKind,
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 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
293 depends: [2][]string{{"fairway_marks_boysaw"}},
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("boysaw",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
297 "colour", "colpat", "conrad", "marsys", "boyshp"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
298 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
299 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
300 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
301 newPointFeature(func() interface{} { return new(boysawProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
302 ),
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 RegisterJobCreator(BOYSPPJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
306 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
307 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
308 depends: [2][]string{{"fairway_marks_boyspp"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
309 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
310 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
311 createInsertFMSQL("boyspp",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
312 "colour", "colpat", "conrad",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
313 "marsys", "boyshp", "catspm"),
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("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
317 newPointFeature(func() interface{} { return new(boysppProperties) }),
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 })
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
320
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
321 RegisterJobCreator(DAYMARHYDROJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
322 &WFSFeatureJobCreator{
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
323 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
324 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
325 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
326 prepareStmnts(
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
327 createInsertFMSQL("daymar_hydro",
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
328 "colour", "colpat", "condtn", "topshp"),
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
329 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
330 consume,
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
331 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
332 newPointFeature(func() interface{} { return new(daymarHydroProperties) }),
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
333 ),
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
334 })
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
335
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
336 RegisterJobCreator(DAYMARIENCJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
337 &WFSFeatureJobCreator{
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
338 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
339 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
340 newConsumer: newSQLConsumer(
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
341 prepareStmnts(
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
342 createInsertFMSQL("daymar_ienc",
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
343 "colour", "colpat", "condtn", "topshp", "orient"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
344 insertDaymarDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
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_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
348 newPointFeature(func() interface{} { return new(daymarIencProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
349 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
350 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
351
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
352 RegisterJobCreator(LIGHTSJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
353 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
354 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
355 depends: [2][]string{{"fairway_marks_lights"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
356 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
357 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
358 createInsertFMSQL("lights",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
359 "colour", "condtn", "orient",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
360 "catlit", "exclit", "litchr",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
361 "litvis", "mltylt", "sectr1",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
362 "sectr2", "siggrp", "sigper",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
363 "sigseq", "status"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
364 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
365 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
366 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
367 newPointFeature(func() interface{} { return new(lightsProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
368 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
369 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
370
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
371 RegisterJobCreator(NOTMRKJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
372 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
373 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
374 depends: [2][]string{{"fairway_marks_lights"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
375 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
376 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
377 createInsertFMSQL("notmrk",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
378 "condtn", "marsys", "orient",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
379 "status", "addmrk", "catnmk",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
380 "disipd", "disipu", "disbk1",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
381 "disbk2", "fnctnm", "bnkwtw"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
382 insertNotmrkDirimpSQL,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
383 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
384 consume,
4972
0e180d651fc6 Fix typo that let every NOTMRK import fail
Tom Gottfried <tom@intevation.de>
parents: 4970
diff changeset
385 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
386 newPointFeature(func() interface{} { return new(notmrkProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
387 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
388 })
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
389
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
390 RegisterJobCreator(RTPBCNJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
391 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
392 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
393 depends: [2][]string{{"fairway_marks_rtpbcn"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
394 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
395 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
396 createInsertFMSQL("rtpbcn",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
397 "condtn", "siggrp", "catrtb", "radwal"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
398 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
399 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
400 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
401 newPointFeature(func() interface{} { return new(rtpbcnProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
402 ),
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 RegisterJobCreator(TOPMARJobKind,
4978
35a3dc12050f Give better names to generalized WFS feature downloaders.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4977
diff changeset
406 &WFSFeatureJobCreator{
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
407 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
408 depends: [2][]string{{"fairway_marks_topmar"}},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
409 newConsumer: newSQLConsumer(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
410 prepareStmnts(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
411 createInsertFMSQL("topmar",
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
412 "colour", "colpat", "condtn", "topshp"),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
413 ),
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
414 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
415 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
416 newPointFeature(func() interface{} { return new(topmarProperties) }),
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
417 ),
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
418 })
4894
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
419 }
8eb36d0d5bdf Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
420
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
421 const (
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
422 // 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
423 /* 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
424 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
425 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
426 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
427 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
428 */
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
429 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
430 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
431 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
432 ),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
433 g AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
434 SELECT newfm
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
435 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
436 WHERE pg_has_role('sys_admin', 'MEMBER')
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
437 OR ST_Intersects((select a from a),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
438 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
439 ),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
440 t AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
441 -- Currently valid and otherwise identical entry's validity.
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
442 /* If there are no intermittent updates of validity,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
443 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
444 otherwise identical entry. */
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
445 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
446 WHERE validity @> current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
447 AND (geom,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
448 datsta, datend, persta, perend, objnam, nobjnm, inform, ninfom,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
449 scamin, picrep, txtdsc, sordat, sorind,
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
450 %[2]s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
451 ) IS NOT DISTINCT FROM (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
452 (SELECT newfm FROM g),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
453 $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
454 %[3]s)
4969
5621586e7a54 Avoid checking the same condition twice
Tom Gottfried <tom@intevation.de>
parents: 4968
diff changeset
455 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
456 )
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
457 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
458 geom,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
459 datsta,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
460 datend,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
461 persta,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
462 perend,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
463 objnam,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
464 nobjnm,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
465 inform,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
466 ninfom,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
467 scamin,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
468 picrep,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
469 txtdsc,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
470 sordat,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
471 sorind,
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
472 %[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
473 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
474 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
475 %[3]s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
476 FROM g
4969
5621586e7a54 Avoid checking the same condition twice
Tom Gottfried <tom@intevation.de>
parents: 4968
diff changeset
477 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
478 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
479 `
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
480
4956
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
481 // 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
482 invalidateFairwayMarksSQLtmpl = `
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
483 WITH
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
484 a AS (
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
485 SELECT users.current_user_area_utm() AS a
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
486 )
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
487 UPDATE waterway.fairway_marks_%s
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
488 SET validity = tstzrange(lower(validity), current_timestamp)
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
489 WHERE validity @> current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
490 AND last_found < current_timestamp
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
491 AND (pg_has_role('sys_admin', 'MEMBER')
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
492 OR ST_Intersects((select a from a),
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
493 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
494 `
7cc79c65a9e5 Keep the history of fairway marks
Tom Gottfried <tom@intevation.de>
parents: 4952
diff changeset
495
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
496 insertBcnlatDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
497 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
498 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
499 `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
500
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
501 insertDaymarDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
502 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
503 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
504 `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
505
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
506 insertNotmrkDirimpSQL = `
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
507 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
508 VALUES ($1, $2)
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
509 `
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
510 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
511
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
512 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
513
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
514 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
515
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
516 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
517 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
518 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
519 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
520 }
4961
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
521 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
522 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
523 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
524 }
4961
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
525 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
526 return ErrFeaturesUnmodified
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
527 }
67d78b74fe43 Be more careful with unchanged errors if features were removed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4959
diff changeset
528 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
529 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
530 }
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
531 }
6d5d6b27c3c3 Added pre commit hooks before commiting fairway marks to invalidate old.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4956
diff changeset
532
4938
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
533 // 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
534 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
535 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
536 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
537 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
538 }
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
539
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
540 return fmt.Sprintf(
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
541 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
542 fmType,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
543 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
544 attNums,
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
545 )
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
546 }
9f9d72a1d398 Save some typos and wrong parameter counts when adding new fairway mark types
Tom Gottfried <tom@intevation.de>
parents: 4931
diff changeset
547
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
548 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
549 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
550 return
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
551 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
552 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
553 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
554 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
555 _, 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
556 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
557 return err
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
558 }); err != nil {
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
559 spc.feedback.Warn(
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
560 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
561 spc.feedback.Info(
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
562 "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
563 dirimp)
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
564 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
565 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
566 }
407103c299a0 De-duped some attribute storing code in FM imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4946
diff changeset
567
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
568 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
569 spc *SQLGeometryConsumer,
5010
1d1be6bd5304 Wrap geometries if needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5007
diff changeset
570 geom, properties interface{},
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
571 epsg int,
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
572 ) error {
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
573 var fmid int64
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
574 err := spc.savepoint(func() error {
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
575 return spc.stmts[0].QueryRowContext(
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
576 spc.ctx,
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
577 append(
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
578 []interface{}{
5010
1d1be6bd5304 Wrap geometries if needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 5007
diff changeset
579 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
580 epsg,
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
581 },
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
582 structs.Values(properties)...)...,
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
583 ).Scan(&fmid)
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
584 })
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
585 switch {
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
586 case err == sql.ErrNoRows:
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
587 return ErrFeatureDuplicated
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
588 // 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
589 case err != nil:
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4961
diff changeset
590 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
591 return ErrFeatureIgnored
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
592 default:
4970
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
593 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
594 storeAttribs(spc, fmid, attr.attrib())
5890e62e6d52 Simplified storing of fm types to database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4969
diff changeset
595 }
4946
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
596 }
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
597 return nil
b0dbc0f2c748 Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4939
diff changeset
598 }