Skip to content

Commit

Permalink
Fix minor issues related to the rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 27, 2023
1 parent 8ee7e1b commit 41506a0
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.cli.tdtiles;
Expand All @@ -19,9 +24,9 @@
import java.util.concurrent.Callable;
import javax.sql.DataSource;
import org.apache.baremaps.cli.Options;
import org.apache.baremaps.database.PostgresUtils;
import org.apache.baremaps.server.CorsFilter;
import org.apache.baremaps.server.TdTilesResources;
import org.apache.baremaps.utils.PostgresUtils;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
import org.slf4j.Logger;
Expand Down Expand Up @@ -50,7 +55,7 @@ public class Serve implements Callable<Integer> {

@Override
public Integer call() throws Exception {
var datasource = PostgresUtils.dataSource(database);
var datasource = PostgresUtils.createDataSource(database);

// Configure the application
var application =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.cli.tdtiles;
Expand Down
5 changes: 5 additions & 0 deletions baremaps-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,14 @@ limitations under the License.
<groupId>de.bytefish</groupId>
<artifactId>pgbulkinsert</artifactId>
</dependency>
<dependency>
<groupId>de.javagl</groupId>
<artifactId>jgltf-model</artifactId>
</dependency>
<dependency>
<groupId>de.javagl</groupId>
<artifactId>jgltf-model-builder</artifactId>
<version>${version.lib.jgltf}</version>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.tdtiles;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.tdtiles;
Expand All @@ -20,9 +25,9 @@
import java.sql.Statement;
import java.util.*;
import javax.sql.DataSource;
import org.apache.baremaps.database.tile.*;
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
import org.apache.baremaps.tdtiles.building.Building;
import org.apache.baremaps.tilestore.TileStoreException;
import org.apache.baremaps.utils.GeometryUtils;
import org.locationtech.jts.geom.Geometry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -34,7 +39,7 @@ public class TdTilesStore {

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


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

String sql = String.format(QUERY, ymin * 180 / (float) Math.PI, xmin * 180 / (float) Math.PI,
ymax * 180 / (float) Math.PI, xmax * 180 / (float) Math.PI, limit);

logger.debug("Executing query: {}", sql);
System.out.println(sql);

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


try (ResultSet resultSet = statement.executeQuery(sql)) {
while (resultSet.next()) {
byte[] bytes = resultSet.getBytes(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.tdtiles.building;

import org.locationtech.jts.geom.Geometry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.tdtiles.subtree;

public record Availability(boolean constant) {
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.tdtiles.subtree;

public record Subtree(Availability tileAvailability,
Availability contentAvailability,
Availability childSubtreeAvailability) {
Availability contentAvailability,
Availability childSubtreeAvailability) {

}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.baremaps.server;
Expand Down
2 changes: 1 addition & 1 deletion baremaps-server/src/main/resources/tdtiles/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

// Set initial position
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(9.5209, 47.1410, 300)
destination : Cesium.Cartesian3.fromDegrees(6.6323, 46.5197, 300)
});
</script>
</div>
Expand Down
4 changes: 2 additions & 2 deletions basemap/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default {
"file": "data/natural_earth_vector/packages/natural_earth_vector.gpkg",
"database": config.database,
"sourceSRID": 4326,
"targetSRID": 3857
"targetSRID": 4326
},
{
"type": "ExecuteSql",
Expand Down Expand Up @@ -146,7 +146,7 @@ export default {
"type": "ImportOsmPbf",
"file": "data/data.osm.pbf",
"database": config.database,
"databaseSrid": 3857,
"databaseSrid": 4326,
"replaceExisting": true,
"cleanCache": true,
},
Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ limitations under the License.
<version.lib.ipresource>1.52</version.lib.ipresource>
<version.lib.jackson>2.13.0</version.lib.jackson>
<version.lib.jakarta>2.1.6</version.lib.jakarta>
<version.lib.jersey>2.37</version.lib.jersey>
<version.lib.jaxb-runtime>2.3.5</version.lib.jaxb-runtime>
<version.lib.jdbi>3.24.1</version.lib.jdbi>
<version.lib.jersey>2.37</version.lib.jersey>
<version.lib.jgltf>2.0.3</version.lib.jgltf>
<version.lib.jmh>1.35</version.lib.jmh>
<version.lib.jts>1.19.0</version.lib.jts>
Expand Down Expand Up @@ -192,6 +192,11 @@ limitations under the License.
<artifactId>pgbulkinsert</artifactId>
<version>${version.lib.pgbulkinsert}</version>
</dependency>
<dependency>
<groupId>de.javagl</groupId>
<artifactId>jgltf-model</artifactId>
<version>${version.lib.jgltf}</version>
</dependency>
<dependency>
<groupId>de.javagl</groupId>
<artifactId>jgltf-model-builder</artifactId>
Expand Down

0 comments on commit 41506a0

Please sign in to comment.