Mercurial > gemma
comparison pkg/controllers/cross.go @ 5490:5f47eeea988d logging
Use own logging package.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 20 Sep 2021 17:45:39 +0200 |
parents | f4abfd0ee8ad |
children |
comparison
equal
deleted
inserted
replaced
5488:a726a92ea5c9 | 5490:5f47eeea988d |
---|---|
15 | 15 |
16 import ( | 16 import ( |
17 "context" | 17 "context" |
18 "database/sql" | 18 "database/sql" |
19 "fmt" | 19 "fmt" |
20 "log" | |
21 "net/http" | 20 "net/http" |
22 "time" | 21 "time" |
23 | 22 |
23 "gemma.intevation.de/gemma/pkg/log" | |
24 "gemma.intevation.de/gemma/pkg/mesh" | 24 "gemma.intevation.de/gemma/pkg/mesh" |
25 "gemma.intevation.de/gemma/pkg/models" | 25 "gemma.intevation.de/gemma/pkg/models" |
26 | 26 |
27 mw "gemma.intevation.de/gemma/pkg/middleware" | 27 mw "gemma.intevation.de/gemma/pkg/middleware" |
28 ) | 28 ) |
76 | 76 |
77 tree, err := mesh.FromCache( | 77 tree, err := mesh.FromCache( |
78 ctx, conn, | 78 ctx, conn, |
79 csi.Properties.Bottleneck, csi.Properties.Date.Time) | 79 csi.Properties.Bottleneck, csi.Properties.Date.Time) |
80 | 80 |
81 log.Printf("info: loading mesh took %s\n", time.Since(start)) | 81 log.Infof("loading mesh took %s\n", time.Since(start)) |
82 if err != nil { | 82 if err != nil { |
83 return | 83 return |
84 } | 84 } |
85 | 85 |
86 if tree == nil { | 86 if tree == nil { |
108 } | 108 } |
109 defer rp.Close() | 109 defer rp.Close() |
110 | 110 |
111 coords, err := reproject(ctx, rp, csi.Geometry.Coordinates) | 111 coords, err := reproject(ctx, rp, csi.Geometry.Coordinates) |
112 | 112 |
113 log.Printf("info: transforming input coords took %s\n", time.Since(start)) | 113 log.Infof("transforming input coords took %s\n", time.Since(start)) |
114 if err != nil { | 114 if err != nil { |
115 return | 115 return |
116 } | 116 } |
117 | 117 |
118 start = time.Now() | 118 start = time.Now() |
131 line = append(line, ls) | 131 line = append(line, ls) |
132 } | 132 } |
133 }) | 133 }) |
134 | 134 |
135 if len(line) > 0 { | 135 if len(line) > 0 { |
136 log.Printf("info: line length: %d\n", len(line)) | 136 log.Infof("line length: %d\n", len(line)) |
137 // They are all on the segment (c1.Lat, c1.Lon) - (c2.Lat, c2.Lon). | 137 // They are all on the segment (c1.Lat, c1.Lon) - (c2.Lat, c2.Lon). |
138 // Sort them by project them on this line. | 138 // Sort them by project them on this line. |
139 joined := line.JoinOnLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon) | 139 joined := line.JoinOnLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon) |
140 log.Printf("info: joined length: %d\n", len(joined)) | 140 log.Infof("joined length: %d\n", len(joined)) |
141 segments = append(segments, joined...) | 141 segments = append(segments, joined...) |
142 } | 142 } |
143 | 143 |
144 } | 144 } |
145 log.Printf("info: mesh traversal took %s\n", time.Since(start)) | 145 log.Infof("mesh traversal took %s\n", time.Since(start)) |
146 | 146 |
147 start = time.Now() | 147 start = time.Now() |
148 | 148 |
149 var joined models.GeoJSONMultiLineCoordinatesZ | 149 var joined models.GeoJSONMultiLineCoordinatesZ |
150 joined, err = projectBack( | 150 joined, err = projectBack( |
151 ctx, | 151 ctx, |
152 segments, tree.EPSG(), | 152 segments, tree.EPSG(), |
153 conn, | 153 conn, |
154 ) | 154 ) |
155 | 155 |
156 log.Printf("info: projecting back took %s\n", time.Since(start)) | 156 log.Infof("projecting back took %s\n", time.Since(start)) |
157 if err != nil { | 157 if err != nil { |
158 return | 158 return |
159 } | 159 } |
160 | 160 |
161 jr = mw.JSONResult{ | 161 jr = mw.JSONResult{ |