Skip to content

Commit 41506a0

Browse files
committed
Fix minor issues related to the rebase
1 parent 8ee7e1b commit 41506a0

File tree

12 files changed

+120
-55
lines changed

12 files changed

+120
-55
lines changed

baremaps-cli/src/main/java/org/apache/baremaps/cli/tdtiles/Serve.java

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.cli.tdtiles;
@@ -19,9 +24,9 @@
1924
import java.util.concurrent.Callable;
2025
import javax.sql.DataSource;
2126
import org.apache.baremaps.cli.Options;
22-
import org.apache.baremaps.database.PostgresUtils;
2327
import org.apache.baremaps.server.CorsFilter;
2428
import org.apache.baremaps.server.TdTilesResources;
29+
import org.apache.baremaps.utils.PostgresUtils;
2530
import org.glassfish.hk2.utilities.binding.AbstractBinder;
2631
import org.glassfish.jersey.server.ResourceConfig;
2732
import org.slf4j.Logger;
@@ -50,7 +55,7 @@ public class Serve implements Callable<Integer> {
5055

5156
@Override
5257
public Integer call() throws Exception {
53-
var datasource = PostgresUtils.dataSource(database);
58+
var datasource = PostgresUtils.createDataSource(database);
5459

5560
// Configure the application
5661
var application =

baremaps-cli/src/main/java/org/apache/baremaps/cli/tdtiles/TdTiles.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.cli.tdtiles;

baremaps-core/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ limitations under the License.
6666
<groupId>de.bytefish</groupId>
6767
<artifactId>pgbulkinsert</artifactId>
6868
</dependency>
69+
<dependency>
70+
<groupId>de.javagl</groupId>
71+
<artifactId>jgltf-model</artifactId>
72+
</dependency>
6973
<dependency>
7074
<groupId>de.javagl</groupId>
7175
<artifactId>jgltf-model-builder</artifactId>
76+
<version>${version.lib.jgltf}</version>
7277
</dependency>
7378
<dependency>
7479
<groupId>it.unimi.dsi</groupId>

baremaps-core/src/main/java/org/apache/baremaps/tdtiles/GltfBuilder.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.tdtiles;

baremaps-core/src/main/java/org/apache/baremaps/tdtiles/TdTilesStore.java

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.tdtiles;
@@ -20,9 +25,9 @@
2025
import java.sql.Statement;
2126
import java.util.*;
2227
import javax.sql.DataSource;
23-
import org.apache.baremaps.database.tile.*;
24-
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
2528
import org.apache.baremaps.tdtiles.building.Building;
29+
import org.apache.baremaps.tilestore.TileStoreException;
30+
import org.apache.baremaps.utils.GeometryUtils;
2631
import org.locationtech.jts.geom.Geometry;
2732
import org.slf4j.Logger;
2833
import org.slf4j.LoggerFactory;
@@ -34,7 +39,7 @@ public class TdTilesStore {
3439

3540
private static final Logger logger = LoggerFactory.getLogger(TdTilesStore.class);
3641
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";
3843

3944

4045
private final DataSource datasource;
@@ -50,10 +55,13 @@ public List<Building> read(float xmin, float xmax, float ymin, float ymax, int l
5055

5156
String sql = String.format(QUERY, ymin * 180 / (float) Math.PI, xmin * 180 / (float) Math.PI,
5257
ymax * 180 / (float) Math.PI, xmax * 180 / (float) Math.PI, limit);
58+
5359
logger.debug("Executing query: {}", sql);
60+
System.out.println(sql);
5461

5562
List<Building> buildings = new ArrayList<>();
5663

64+
5765
try (ResultSet resultSet = statement.executeQuery(sql)) {
5866
while (resultSet.next()) {
5967
byte[] bytes = resultSet.getBytes(1);

baremaps-core/src/main/java/org/apache/baremaps/tdtiles/building/Building.java

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
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
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
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.
16+
*/
17+
118
package org.apache.baremaps.tdtiles.building;
219

320
import org.locationtech.jts.geom.Geometry;
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.tdtiles.subtree;
1419

1520
public record Availability(boolean constant) {
16-
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.tdtiles.subtree;
1419

1520
public record Subtree(Availability tileAvailability,
16-
Availability contentAvailability,
17-
Availability childSubtreeAvailability) {
21+
Availability contentAvailability,
22+
Availability childSubtreeAvailability) {
1823

19-
}
24+
}

baremaps-server/src/main/java/org/apache/baremaps/server/TdTilesResources.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/*
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
48
*
59
* http://www.apache.org/licenses/LICENSE-2.0
610
*
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.
1116
*/
1217

1318
package org.apache.baremaps.server;

baremaps-server/src/main/resources/tdtiles/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
// Set initial position
3232
viewer.camera.setView({
33-
destination : Cesium.Cartesian3.fromDegrees(9.5209, 47.1410, 300)
33+
destination : Cesium.Cartesian3.fromDegrees(6.6323, 46.5197, 300)
3434
});
3535
</script>
3636
</div>

basemap/import.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default {
5353
"file": "data/natural_earth_vector/packages/natural_earth_vector.gpkg",
5454
"database": config.database,
5555
"sourceSRID": 4326,
56-
"targetSRID": 3857
56+
"targetSRID": 4326
5757
},
5858
{
5959
"type": "ExecuteSql",
@@ -146,7 +146,7 @@ export default {
146146
"type": "ImportOsmPbf",
147147
"file": "data/data.osm.pbf",
148148
"database": config.database,
149-
"databaseSrid": 3857,
149+
"databaseSrid": 4326,
150150
"replaceExisting": true,
151151
"cleanCache": true,
152152
},

pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ limitations under the License.
9494
<version.lib.ipresource>1.52</version.lib.ipresource>
9595
<version.lib.jackson>2.13.0</version.lib.jackson>
9696
<version.lib.jakarta>2.1.6</version.lib.jakarta>
97-
<version.lib.jersey>2.37</version.lib.jersey>
9897
<version.lib.jaxb-runtime>2.3.5</version.lib.jaxb-runtime>
9998
<version.lib.jdbi>3.24.1</version.lib.jdbi>
99+
<version.lib.jersey>2.37</version.lib.jersey>
100100
<version.lib.jgltf>2.0.3</version.lib.jgltf>
101101
<version.lib.jmh>1.35</version.lib.jmh>
102102
<version.lib.jts>1.19.0</version.lib.jts>
@@ -192,6 +192,11 @@ limitations under the License.
192192
<artifactId>pgbulkinsert</artifactId>
193193
<version>${version.lib.pgbulkinsert}</version>
194194
</dependency>
195+
<dependency>
196+
<groupId>de.javagl</groupId>
197+
<artifactId>jgltf-model</artifactId>
198+
<version>${version.lib.jgltf}</version>
199+
</dependency>
195200
<dependency>
196201
<groupId>de.javagl</groupId>
197202
<artifactId>jgltf-model-builder</artifactId>

0 commit comments

Comments
 (0)