comparison pkg/imports/dmv.go @ 3778:1b11ff97c1d1

Add wwname to import of virtual distance marks.
author Sascha Wilde <wilde@intevation.de>
date Thu, 04 Jul 2019 16:30:19 +0200
parents a5448426e4e2
children 8b75ac5e243e
comparison
equal deleted inserted replaced
3777:c373758ca2df 3778:1b11ff97c1d1
64 const ( 64 const (
65 insertDistanceMarksVirtualSQL = ` 65 insertDistanceMarksVirtualSQL = `
66 INSERT INTO waterway.distance_marks_virtual ( 66 INSERT INTO waterway.distance_marks_virtual (
67 location_code, 67 location_code,
68 geom, 68 geom,
69 related_enc 69 related_enc,
70 wwname
70 ) 71 )
71 VALUES ( 72 VALUES (
72 ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int), 73 ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int),
73 ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography, 74 ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography,
74 $8 75 $8,
76 $9
75 ) ON CONFLICT (location_code) DO UPDATE SET 77 ) ON CONFLICT (location_code) DO UPDATE SET
76 geom = ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography, 78 geom = ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography,
77 related_enc = $8 79 related_enc = $8,
80 wwname = $9
78 ` 81 `
79 ) 82 )
80 83
81 func (dmv *DistanceMarksVirtual) Do( 84 func (dmv *DistanceMarksVirtual) Do(
82 ctx context.Context, 85 ctx context.Context,
138 feedback.Warn("missing relenc: %s", code) 141 feedback.Warn("missing relenc: %s", code)
139 ignored++ 142 ignored++
140 continue 143 continue
141 } 144 }
142 145
146 if dr.Wwname.Loc == nil {
147 feedback.Warn("missing wwname: %s", code)
148 ignored++
149 continue
150 }
151
143 if _, err := insertStmt.ExecContext( 152 if _, err := insertStmt.ExecContext(
144 ctx, 153 ctx,
145 code.CountryCode, 154 code.CountryCode,
146 code.LoCode, 155 code.LoCode,
147 code.FairwaySection, 156 code.FairwaySection,
148 code.Orc, 157 code.Orc,
149 code.Hectometre, 158 code.Hectometre,
150 float64(*dr.Lon), float64(*dr.Lat), 159 float64(*dr.Lon), float64(*dr.Lat),
151 string(*dr.Relenc), 160 string(*dr.Relenc),
161 string(*dr.Wwname.Loc),
152 ); err != nil { 162 ); err != nil {
153 return nil, err 163 return nil, err
154 } 164 }
155 features++ 165 features++
156 } 166 }