Mercurial > gemma
comparison pkg/imports/fm.go @ 4905:8cb201b551b3 fairway-marks-import
Replace bogus usage of pointer for type intrusion
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 07 Feb 2020 12:23:46 +0100 |
parents | 53d929f658f3 |
children | 21fea90f4002 |
comparison
equal
deleted
inserted
replaced
4904:53d929f658f3 | 4905:8cb201b551b3 |
---|---|
57 | 57 |
58 // Common operation of FM imports to get features from WFS service | 58 // Common operation of FM imports to get features from WFS service |
59 func getFMFeatures( | 59 func getFMFeatures( |
60 feedback Feedback, | 60 feedback Feedback, |
61 fm FairwayMarks, | 61 fm FairwayMarks, |
62 // Pointer to a struct representing featuretype's properties | 62 // Constructor returning a struct representing featuretype's properties |
63 props interface{}, | 63 newProps func() interface{}, |
64 ) ( | 64 ) ( |
65 // Elements can be converted to []interface{}{p, fp} with | 65 // Elements can be converted to []interface{}{p, fp} with |
66 // p being a pointSlice and fp of the type of argument props. | 66 // p being a pointSlice and fp of the type of argument props. |
67 fms [][]interface{}, | 67 fms [][]interface{}, |
68 epsg int, | 68 epsg int, |
131 if feature.Properties == nil || feature.Geometry.Coordinates == nil { | 131 if feature.Properties == nil || feature.Geometry.Coordinates == nil { |
132 missingProperties++ | 132 missingProperties++ |
133 continue | 133 continue |
134 } | 134 } |
135 | 135 |
136 if err := json.Unmarshal(*feature.Properties, props); err != nil { | 136 props := newProps() |
137 if err := json.Unmarshal(*feature.Properties, &props); err != nil { | |
137 badProperties++ | 138 badProperties++ |
138 continue | 139 continue |
139 } | 140 } |
140 | 141 |
141 switch feature.Geometry.Type { | 142 switch feature.Geometry.Type { |