comparison pkg/controllers/cross.go @ 2547:5afca5bc1d7a

Cross profile endpoint: Normalized logging.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 07 Mar 2019 18:05:20 +0100
parents 478cc0d26d33
children c50d955372b9
comparison
equal deleted inserted replaced
2546:bf4a884fc306 2547:5afca5bc1d7a
78 78
79 tree, err := octree.FromCache( 79 tree, err := octree.FromCache(
80 ctx, conn, 80 ctx, conn,
81 csi.Properties.Bottleneck, csi.Properties.Date.Time) 81 csi.Properties.Bottleneck, csi.Properties.Date.Time)
82 82
83 log.Printf("loading octree took: %s\n", time.Since(start)) 83 log.Printf("info: loading octree took %s\n", time.Since(start))
84 if err != nil { 84 if err != nil {
85 return 85 return
86 } 86 }
87 87
88 if tree == nil { 88 if tree == nil {
110 } 110 }
111 defer rp.Close() 111 defer rp.Close()
112 112
113 coords, err := reproject(ctx, rp, csi.Geometry.Coordinates) 113 coords, err := reproject(ctx, rp, csi.Geometry.Coordinates)
114 114
115 log.Printf("transforming input coords took: %s\n", time.Since(start)) 115 log.Printf("info: transforming input coords took %s\n", time.Since(start))
116 if err != nil { 116 if err != nil {
117 return 117 return
118 } 118 }
119 119
120 start = time.Now() 120 start = time.Now()
133 line = append(line, ls) 133 line = append(line, ls)
134 } 134 }
135 }) 135 })
136 136
137 if len(line) > 0 { 137 if len(line) > 0 {
138 log.Printf("line length: %d\n", len(line)) 138 log.Printf("info: line length: %d\n", len(line))
139 // They are all on the segment (c1.Lat, c1.Lon) - (c2.Lat, c2.Lon). 139 // They are all on the segment (c1.Lat, c1.Lon) - (c2.Lat, c2.Lon).
140 // Sort them by project them on this line. 140 // Sort them by project them on this line.
141 joined := line.JoinOnLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon) 141 joined := line.JoinOnLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon)
142 log.Printf("joined length: %d\n", len(joined)) 142 log.Printf("info: joined length: %d\n", len(joined))
143 segments = append(segments, joined...) 143 segments = append(segments, joined...)
144 } 144 }
145 145
146 } 146 }
147 log.Printf("octree traversal took: %s\n", time.Since(start)) 147 log.Printf("info: octree traversal took %s\n", time.Since(start))
148 148
149 start = time.Now() 149 start = time.Now()
150 150
151 var joined models.GeoJSONMultiLineCoordinatesZ 151 var joined models.GeoJSONMultiLineCoordinatesZ
152 joined, err = projectBack( 152 joined, err = projectBack(
153 ctx, 153 ctx,
154 segments, tree.EPSG, 154 segments, tree.EPSG,
155 conn, 155 conn,
156 ) 156 )
157 157
158 log.Printf("projecting back took: %s\n", time.Since(start)) 158 log.Printf("info: projecting back took %s\n", time.Since(start))
159 if err != nil { 159 if err != nil {
160 return 160 return
161 } 161 }
162 162
163 jr = JSONResult{ 163 jr = JSONResult{