Skip to content

Commit

Permalink
POI-writer: add calculated bounds to metadata, if not set in paramete…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 authored and devemux86 committed Sep 20, 2017
1 parent 5993a2c commit b77132a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,18 @@ private void writeMetadata() throws SQLException {
// Bounds
pStmtMetadata.setString(1, DbConstants.METADATA_BOUNDS);
BoundingBox bb = this.configuration.getBboxConfiguration();
if (bb == null) {
// This may produce implausible bounds, but this depends on the source map.
String FIND_MAX_BOUND = "SELECT MIN(minLat), MIN(minLon), MAX(maxLat), MAX(maxLon) FROM poi_index";

Statement maxBoundStmt = this.conn.createStatement();
ResultSet rs = maxBoundStmt.executeQuery(FIND_MAX_BOUND);
if (rs.next()) {
bb = new BoundingBox(rs.getDouble(1), rs.getDouble(2), rs.getDouble(3), rs.getDouble(4));
}
rs.close();
maxBoundStmt.close();
}
if (bb != null) {
pStmtMetadata.setString(2, bb.minLatitude + "," + bb.minLongitude + "," + bb.maxLatitude + "," + bb.maxLongitude);
} else {
Expand Down

0 comments on commit b77132a

Please sign in to comment.