Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,18 @@ protected int createTaskItems(String schema) throws TooManyResourcesClaimed,
infoLog(STEP_EXECUTE, this, "Added affected tiles from delta in version range "
+ versionRef +". Intermediate result size: "+ affectedTiles.size());

//Get affected Tiles from list of Feature in version [versionRef.getStartVersion()]
runReadQuerySync(getAffectedTilesFromBase(changedFeatureIds, new Ref(versionRef.getStart().getVersion())),
db(), 0, rs -> {
while (rs.next()){
affectedTiles.add(rs.getString("tile"));
}
return null;
});
infoLog(STEP_EXECUTE, this, "Added affected tiles from base version "
+ versionRef.getStart().getVersion() +". Final Result size: "+ affectedTiles.size());
if(!changedFeatureIds.isEmpty()){
//Get affected Tiles from list of Feature in version [versionRef.getStartVersion()]
runReadQuerySync(getAffectedTilesFromBase(changedFeatureIds, new Ref(versionRef.getStart().getVersion())),
db(), 0, rs -> {
while (rs.next()){
affectedTiles.add(rs.getString("tile"));
}
return null;
});
infoLog(STEP_EXECUTE, this, "Added affected tiles from base version "
+ versionRef.getStart().getVersion() +". Final Result size: "+ affectedTiles.size());
}

//Write taskList with all unique tileIds which we need to export
for(String tileId : affectedTiles){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ public class ExportSpaceToFiles extends TaskedSpaceBasedStep<ExportSpaceToFiles>
@JsonView({Internal.class, Static.class})
protected boolean restrictExtendOfSpatialFilter = true;

public void setRestrictExtendOfSpatialFilter(boolean restrictExtendOfSpatialFilter) {
this.restrictExtendOfSpatialFilter = restrictExtendOfSpatialFilter;
}

public ExportSpaceToFiles withRestrictExtendOfSpatialFilter(boolean restrictExtendOfSpatialFilter) {
setRestrictExtendOfSpatialFilter(restrictExtendOfSpatialFilter);
return this;
}

public ExportSpaceToFiles withStepExecutionHeartBeatTimeoutOverride(int timeOutSeconds) {
setStepExecutionHeartBeatTimeoutOverride(timeOutSeconds);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void cleanup() throws SQLException {
}

@Test
public void ExportChangedTilesStepVersion0to1() throws IOException, InterruptedException {
public void Export_Version0to1() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("0..1") , List.of(), new FeatureCollection().withFeatures(
List.of(new Feature().withId("point1_delta"),new Feature().withId("point2_delta"),
Expand All @@ -237,15 +237,15 @@ public void ExportChangedTilesStepVersion0to1() throws IOException, InterruptedE
}

@Test
public void ExportChangedTilesStepVersion0to4() throws IOException, InterruptedException {
public void Export_Version0to4() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("0..4") , List.of("1269"), new FeatureCollection().withFeatures(
List.of(new Feature().withId("point1_delta"),new Feature().withId("point3_delta"))
));
}

@Test
public void ExportChangedTilesStepVersion1to2() throws IOException, InterruptedException {
public void Export_Version1to2() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("1..2") , List.of(), //1440 is missing, because point2_base remains in it
new FeatureCollection().withFeatures(
Expand All @@ -255,15 +255,15 @@ public void ExportChangedTilesStepVersion1to2() throws IOException, InterruptedE
}

@Test
public void ExportChangedTilesStepVersion2to4() throws IOException, InterruptedException {
public void Export_Version2to4() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("2..4") , List.of("1269", "1423"), new FeatureCollection().withFeatures(
List.of() //only deletions have happened
));
}

@Test
public void ExportChangedTilesStepVersion0toHEAD() throws IOException, InterruptedException {
public void Export_Version0toHEAD() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("0..HEAD") , List.of("1269"), new FeatureCollection().withFeatures(
List.of(
Expand All @@ -276,7 +276,7 @@ public void ExportChangedTilesStepVersion0toHEAD() throws IOException, Interrupt
}

@Test
public void ExportChangedTilesStepVersion2to4WithPropertyFilter() throws IOException, InterruptedException {
public void Export_Version2to4WithPropertyFilter() throws IOException, InterruptedException {
executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 5, QuadType.HERE_QUAD,
new Ref("1..2") ,null, PropertiesQuery.fromString("p.value=Africa"),
List.of("1269", "1423"), new FeatureCollection().withFeatures(
Expand All @@ -287,7 +287,7 @@ public void ExportChangedTilesStepVersion2to4WithPropertyFilter() throws IOExcep
}

@Test
public void ExportChangedTilesStepVersion0toHEADWithSpatialFilterClipped() throws IOException, InterruptedException, InvalidGeometryException {
public void Export_Version0toHEADWithSpatialFilterClipped() throws IOException, InterruptedException, InvalidGeometryException {

PolygonCoordinates polygonCoordinates = new PolygonCoordinates();
LinearRingCoordinates lrc = new LinearRingCoordinates();
Expand Down Expand Up @@ -316,7 +316,7 @@ public void ExportChangedTilesStepVersion0toHEADWithSpatialFilterClipped() throw
}

@Test
public void ExportChangedTilesStepVersion0toHEADWithSpatialFilterNotClipped() throws IOException, InterruptedException, InvalidGeometryException {
public void Export_SpatialFilterWithoutHittingChanges() throws IOException, InterruptedException, InvalidGeometryException {

PolygonCoordinates polygonCoordinates = new PolygonCoordinates();
LinearRingCoordinates lrc = new LinearRingCoordinates();
Expand Down Expand Up @@ -345,4 +345,26 @@ public void ExportChangedTilesStepVersion0toHEADWithSpatialFilterNotClipped() th
)
));
}

@Test
public void ExportChangedTilesStepVersion0toHEADWithSpatialFilterNotClipped() throws IOException, InterruptedException, InvalidGeometryException {
PolygonCoordinates polygonCoordinates = new PolygonCoordinates();
LinearRingCoordinates lrc = new LinearRingCoordinates();

//No change is inside this polygon
lrc.add(new Position(46.45782151089023, 11.866315363309141));
lrc.add(new Position(46.45782151089023, 8.970767248921192));
lrc.add(new Position(51.31537254401951, 8.970767248921192));
lrc.add(new Position(51.31537254401951, 11.866315363309141));
lrc.add(new Position(46.45782151089023, 11.866315363309141)); // Closing the ring

polygonCoordinates.add(lrc);

executeExportChangedTilesStepAndCheckResults(SPACE_ID_EXT, 8, QuadType.HERE_QUAD,
new Ref("0..HEAD") ,
new SpatialFilter()
.withGeometry(new Polygon().withCoordinates(polygonCoordinates))
.withClip(false), null,
List.of(), new FeatureCollection());
}
}
Loading