Commit 8c088e9f authored by Martin Raifer's avatar Martin Raifer
Browse files

Merge branch 'update-oshdb-0.7' into 'master'

update code to OSHDB version 0.7

See merge request !11
parents 5d61381b 147e7db4
Pipeline #2584 created
......@@ -22,13 +22,13 @@
</scm>
<properties>
<oshdb.version>[0.6.0,0.7.0-a0)</oshdb.version>
<oshdb.version>[0.7.0,0.8.0-a0)</oshdb.version>
</properties>
<dependencies>
<dependency>
<groupId>org.heigit.ohsome</groupId>
<artifactId>oshdb-api</artifactId>
<artifactId>oshdb-api-ignite</artifactId>
<version>${oshdb.version}</version>
</dependency>
......
......@@ -29,31 +29,31 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.ScanQuery;
import org.h2.tools.RunScript;
import org.heigit.bigspatialdata.oshdb.api.db.OSHDBIgnite;
import org.heigit.bigspatialdata.oshdb.api.db.OSHDBJdbc;
import org.heigit.bigspatialdata.oshdb.grid.GridOSHEntity;
import org.heigit.bigspatialdata.oshdb.grid.GridOSHNodes;
import org.heigit.bigspatialdata.oshdb.grid.GridOSHRelations;
import org.heigit.bigspatialdata.oshdb.grid.GridOSHWays;
import org.heigit.bigspatialdata.oshdb.index.XYGridTree;
import org.heigit.bigspatialdata.oshdb.index.XYGridTree.CellIdRange;
import org.heigit.bigspatialdata.oshdb.osh.OSHEntity;
import org.heigit.bigspatialdata.oshdb.osh.OSHNode;
import org.heigit.bigspatialdata.oshdb.osh.OSHRelation;
import org.heigit.bigspatialdata.oshdb.osh.OSHWay;
import org.heigit.bigspatialdata.oshdb.osm.OSMEntity;
import org.heigit.bigspatialdata.oshdb.osm.OSMMember;
import org.heigit.bigspatialdata.oshdb.osm.OSMRelation;
import org.heigit.bigspatialdata.oshdb.util.CellId;
import org.heigit.bigspatialdata.oshdb.util.OSHDBBoundingBox;
import org.heigit.bigspatialdata.oshdb.util.OSHDBRole;
import org.heigit.bigspatialdata.oshdb.util.OSHDBTag;
import org.heigit.bigspatialdata.oshdb.util.OSHDBTagKey;
import org.heigit.bigspatialdata.oshdb.util.TableNames;
import org.heigit.bigspatialdata.oshdb.util.geometry.OSHDBGeometryBuilder;
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.filter.FilterParser;
import org.heigit.ohsome.oshdb.api.db.OSHDBIgnite;
import org.heigit.ohsome.oshdb.api.db.OSHDBJdbc;
import org.heigit.ohsome.oshdb.grid.GridOSHEntity;
import org.heigit.ohsome.oshdb.grid.GridOSHNodes;
import org.heigit.ohsome.oshdb.grid.GridOSHRelations;
import org.heigit.ohsome.oshdb.grid.GridOSHWays;
import org.heigit.ohsome.oshdb.index.XYGridTree;
import org.heigit.ohsome.oshdb.index.XYGridTree.CellIdRange;
import org.heigit.ohsome.oshdb.osh.OSHEntity;
import org.heigit.ohsome.oshdb.osh.OSHNode;
import org.heigit.ohsome.oshdb.osh.OSHRelation;
import org.heigit.ohsome.oshdb.osh.OSHWay;
import org.heigit.ohsome.oshdb.osm.OSMEntity;
import org.heigit.ohsome.oshdb.osm.OSMMember;
import org.heigit.ohsome.oshdb.osm.OSMRelation;
import org.heigit.ohsome.oshdb.util.CellId;
import org.heigit.ohsome.oshdb.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.util.OSHDBRole;
import org.heigit.ohsome.oshdb.OSHDBTag;
import org.heigit.ohsome.oshdb.util.OSHDBTagKey;
import org.heigit.ohsome.oshdb.util.TableNames;
import org.heigit.ohsome.oshdb.util.geometry.OSHDBGeometryBuilder;
import org.heigit.ohsome.oshdb.util.tagtranslator.TagTranslator;
import org.heigit.ohsome.oshdb.filter.FilterExpression;
import org.heigit.ohsome.oshdb.filter.FilterParser;
import org.locationtech.jts.geom.Geometry;
import org.wololo.jts2geojson.GeoJSONReader;
import org.wololo.jts2geojson.GeoJSONWriter;
......@@ -80,7 +80,7 @@ public class CreateH2Extract {
List<Double> bboxCoords = Arrays.stream(cmdArgs.bbox.split(","))
.map(Double::parseDouble).collect(Collectors.toList());
OSHDBBoundingBox bbox = new OSHDBBoundingBox(
OSHDBBoundingBox bbox = OSHDBBoundingBox.bboxWgs84Coordinates(
bboxCoords.get(0), bboxCoords.get(1), bboxCoords.get(2), bboxCoords.get(3));
Class.forName("org.h2.Driver");
......@@ -163,24 +163,19 @@ public class CreateH2Extract {
TableNames.T_NODES.toString(cmdArgs.inPrefix));
QueryCursor<GridOSHEntity> cursor = cache.query(scanQuery, cacheEntry -> {
GridOSHEntity gridEntry = cacheEntry.getValue();
try {
return GridOSHNodes.rebase(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHNode) x)
.filter(osh -> osh.getBoundingBox().intersects(bbox))
.filter(filter::applyOSH)
.collect(Collectors.toList())
);
} catch (IOException e) {
e.printStackTrace();
return null;
}
return GridOSHNodes.rebase(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHNode) x)
.filter(osh -> osh.intersects(bbox))
.filter(filter::applyOSH)
.collect(Collectors.toList())
);
})
) {
for (GridOSHEntity filteredGridEntry : cursor) {
......@@ -193,24 +188,19 @@ public class CreateH2Extract {
.cache(TableNames.T_WAYS.toString(cmdArgs.inPrefix));
QueryCursor<GridOSHEntity> cursor = cache.query(scanQuery, cacheEntry -> {
GridOSHEntity gridEntry = cacheEntry.getValue();
try {
return GridOSHWays.compact(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHWay) x)
.filter(osh -> osh.getBoundingBox().intersects(bbox))
.filter(filter::applyOSH)
.collect(Collectors.toList())
);
} catch (IOException e) {
e.printStackTrace();
return null;
}
return GridOSHWays.compact(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHWay) x)
.filter(osh -> osh.intersects(bbox))
.filter(filter::applyOSH)
.collect(Collectors.toList())
);
})
) {
for (GridOSHEntity filteredGridEntry : cursor) {
......@@ -224,31 +214,26 @@ public class CreateH2Extract {
.cache(TableNames.T_RELATIONS.toString(cmdArgs.inPrefix));
QueryCursor<GridOSHEntity> cursor = cache.query(scanQuery, cacheEntry -> {
GridOSHEntity gridEntry = cacheEntry.getValue();
try {
return GridOSHRelations.compact(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHRelation) x)
.filter(osh -> osh.getBoundingBox().intersects(bbox))
.filter(filter::applyOSH)
.filter(oshRel -> !cmdArgs.skipLargeRelations
|| StreamSupport.stream(oshRel.getVersions().spliterator(), false)
.flatMap(osmrel -> Arrays.stream(osmrel.getMembers()))
.map(OSMMember::getEntity)
.filter(Objects::nonNull)
.anyMatch(member -> member.getBoundingBox().intersects(bbox))
)
.collect(Collectors.toList())
);
} catch (IOException e) {
e.printStackTrace();
return null;
}
return GridOSHRelations.compact(
gridEntry.getId(),
gridEntry.getLevel(),
0,
0,
0,
0,
StreamSupport.stream(gridEntry.getEntities().spliterator(), false)
.map(x -> (OSHRelation) x)
.filter(osh -> osh.intersects(bbox))
.filter(filter::applyOSH)
.filter(oshRel -> !cmdArgs.skipLargeRelations
|| StreamSupport.stream(oshRel.getVersions().spliterator(), false)
.flatMap(osmrel -> Arrays.stream(osmrel.getMembers()))
.map(OSMMember::getEntity)
.filter(Objects::nonNull)
.anyMatch(member -> member.intersects(bbox))
)
.collect(Collectors.toList())
);
})
) {
for (GridOSHEntity filteredGridEntry : cursor) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment