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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ import org.heigit.ohsome.oshdb.api.db.OSHDBH2;

### bugfixes

* when filtering for `geometry:other`: also consider GeometryCollections occuring as a side effect of clipping ([#338])

### upgrading from 0.6

* If you already used the “ohsome filter” functionality from OSHDB version 0.6 and imported one or more classes from the ohsome filter module, you would need to adjust the package names from `org.heigit.ohsome.filter` to `org.heigit.ohsome.oshdb.filter`.

[#306]: https://github.com/GIScience/oshdb/pull/306
[#338]: https://github.com/GIScience/oshdb/issues/338


## 0.6.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ public Set<OSMType> getOSMTypes() {
case LINE:
return EnumSet.of(OSMType.WAY);
case POLYGON:
return POLYGON_TYPES;
case OTHER:
default:
return EnumSet.of(OSMType.RELATION);
return POLYGON_TYPES;
}
}

Expand All @@ -102,10 +101,9 @@ private boolean checkOSMType(OSMType osmType) {
case LINE:
return osmType == OSMType.WAY;
case POLYGON:
return POLYGON_TYPES.contains(osmType);
case OTHER:
default:
return osmType == OSMType.RELATION;
return POLYGON_TYPES.contains(osmType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ public void testGeometryTypeFilterPolygon() throws IOException {
@Test
public void testGeometryTypeFilterOther() throws IOException {
FilterExpression expression = parser.parse("geometry:other");
assertFalse(expression.applyOSH(createTestOSHEntityWay(
createTestOSMEntityWay(new long[] {})
)));
assertFalse(expression.applyOSH(createTestOSHEntityNode(
createTestOSMEntityNode()
)));
assertTrue(expression.applyOSH(createTestOSHEntityWay(
createTestOSMEntityWay(new long[] {})
)));
assertTrue(expression.applyOSH(createTestOSHEntityRelation(
createTestOSMEntityRelation()
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public void testGeometryTypeFilterOther() {
assertFalse(expression.applyOSMGeometry(validRelation, gf.createMultiPoint()));
assertFalse(expression.applyOSMGeometry(validRelation, gf.createMultiLineString()));
assertFalse(expression.applyOSMGeometry(validRelation, gf.createMultiPolygon()));

// also ways can result in GeometryCollections after a clipping operation!
OSMEntity validWay = createTestOSMEntityWay(new long[]{1, 2, 3, 4, 1});
assertTrue(expression.applyOSMGeometry(validWay, gf.createGeometryCollection()));
assertFalse(expression.applyOSMGeometry(validWay, gf.createPolygon()));
assertFalse(expression.applyOSMGeometry(validWay, gf.createMultiPoint()));
assertFalse(expression.applyOSMGeometry(validWay, gf.createMultiLineString()));
assertFalse(expression.applyOSMGeometry(validWay, gf.createMultiPolygon()));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public void testGeometryTypeFilterPolygon() {
@Test
public void testGeometryTypeFilterOther() {
FilterExpression expression = parser.parse("geometry:other");
assertFalse(expression.applyOSM(createTestOSMEntityWay(new long[] {})));
assertFalse(expression.applyOSM(createTestOSMEntityNode()));
assertTrue(expression.applyOSM(createTestOSMEntityWay(new long[] {})));
assertTrue(expression.applyOSM(createTestOSMEntityRelation()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void testGeometryTypeFilterOther() {
assertTrue(expression instanceof GeometryTypeFilter);
assertEquals(GeometryType.OTHER, ((GeometryTypeFilter) expression).getGeometryType());
assertEquals(
Collections.singleton(OSMType.RELATION),
EnumSet.of(OSMType.WAY, OSMType.RELATION),
((GeometryTypeFilter) expression).getOSMTypes()
);
assertEquals("geometry:other", expression.toString());
Expand Down