@@ -161,9 +161,6 @@ public void createMV(Canvas c, int layerId) throws Exception {
161
161
// set common variables
162
162
setCommonVariables ();
163
163
164
- // transform geo to screen coordinates if needed
165
- if (!ssv .getGeoLatCol ().isEmpty ()) getGeoCoords ();
166
-
167
164
// compute cluster aggregations
168
165
long st = System .nanoTime ();
169
166
computeClusterAggs ();
@@ -198,6 +195,9 @@ private void setCommonVariables() throws Exception {
198
195
overlappingThreshold = Math .max (overlappingThreshold , ssv .getOverlap ());
199
196
System .out .println ("Overlapping threshold: " + overlappingThreshold );
200
197
198
+ // transform geo to screen coordinates if needed
199
+ if (!ssv .getGeoLatCol ().isEmpty ()) getGeoCoords ();
200
+
201
201
// store raw query results into memory
202
202
rawRows = DbConnector .getQueryResult (ssv .getDb (), ssv .getQuery ());
203
203
for (int i = 0 ; i < rawRows .size (); i ++)
@@ -220,7 +220,7 @@ private void getGeoCoords() throws Exception {
220
220
System .out .println (sql );
221
221
rawDbStmt .executeUpdate (sql );
222
222
223
- sql = "DROP FUNCTION get_coord" ;
223
+ sql = "DROP FUNCTION IF EXISTS get_coord; " ;
224
224
System .out .println (sql );
225
225
rawDbStmt .executeUpdate (sql );
226
226
@@ -249,7 +249,11 @@ private void getGeoCoords() throws Exception {
249
249
sql =
250
250
"UPDATE "
251
251
+ ssv .getRawTable ()
252
- + " SET kyrix_geo_x = ((get_coord(latitude::float, longitude::float)->>'x')::float),"
252
+ + " SET kyrix_geo_x = ((get_coord("
253
+ + ssv .getGeoLatCol ()
254
+ + "::float, "
255
+ + ssv .getGeoLonCol ()
256
+ + "::float)->>'x')::float),"
253
257
+ " kyrix_geo_y = ((get_coord(latitude::float, longitude::float)->>'y')::float);" ;
254
258
System .out .println (sql );
255
259
rawDbStmt .executeUpdate (sql );
@@ -479,8 +483,8 @@ private void calculateBGRP(RTreeData[] rds, int level)
479
483
480
484
private void cleanUp () throws SQLException {
481
485
// commit & close connections
482
- rawDbStmt .close ();
483
- bboxStmt .close ();
486
+ if ( rawDbStmt != null ) rawDbStmt .close ();
487
+ if ( bboxStmt != null ) bboxStmt .close ();
484
488
DbConnector .closeConnection (ssv .getDb ());
485
489
DbConnector .closeConnection (Config .databaseName );
486
490
0 commit comments