1
1
/*
2
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
3
- * in compliance with the License. You may obtain a copy of the License at
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to you under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
4
8
*
5
9
* http://www.apache.org/licenses/LICENSE-2.0
6
10
*
7
- * Unless required by applicable law or agreed to in writing, software distributed under the License
8
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
9
- * or implied. See the License for the specific language governing permissions and limitations under
10
- * the License.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
11
16
*/
12
17
13
18
package org .apache .baremaps .tdtiles ;
20
25
import java .sql .Statement ;
21
26
import java .util .*;
22
27
import javax .sql .DataSource ;
23
- import org .apache .baremaps .database .tile .*;
24
- import org .apache .baremaps .openstreetmap .utils .GeometryUtils ;
25
28
import org .apache .baremaps .tdtiles .building .Building ;
29
+ import org .apache .baremaps .tilestore .TileStoreException ;
30
+ import org .apache .baremaps .utils .GeometryUtils ;
26
31
import org .locationtech .jts .geom .Geometry ;
27
32
import org .slf4j .Logger ;
28
33
import org .slf4j .LoggerFactory ;
@@ -34,7 +39,7 @@ public class TdTilesStore {
34
39
35
40
private static final Logger logger = LoggerFactory .getLogger (TdTilesStore .class );
36
41
private static final String QUERY =
37
- "select st_asbinary(geom), tags -> 'buildings:height', tags -> 'height', tags -> 'buildings:levels' from osm_ways where tags ? 'building' and st_intersects( st_force3d( geom,0) , st_makeenvelope(%1$s, %2$s, %3$s, %4$s, 4326)) LIMIT %5$s" ;
42
+ "select st_asbinary(geom), tags -> 'buildings:height', tags -> 'height', tags -> 'buildings:levels' from osm_ways where tags ? 'building' and st_intersects(geom, st_makeenvelope(%1$s, %2$s, %3$s, %4$s, 4326)) LIMIT %5$s" ;
38
43
39
44
40
45
private final DataSource datasource ;
@@ -50,10 +55,13 @@ public List<Building> read(float xmin, float xmax, float ymin, float ymax, int l
50
55
51
56
String sql = String .format (QUERY , ymin * 180 / (float ) Math .PI , xmin * 180 / (float ) Math .PI ,
52
57
ymax * 180 / (float ) Math .PI , xmax * 180 / (float ) Math .PI , limit );
58
+
53
59
logger .debug ("Executing query: {}" , sql );
60
+ System .out .println (sql );
54
61
55
62
List <Building > buildings = new ArrayList <>();
56
63
64
+
57
65
try (ResultSet resultSet = statement .executeQuery (sql )) {
58
66
while (resultSet .next ()) {
59
67
byte [] bytes = resultSet .getBytes (1 );
0 commit comments