Skip to content

Commit

Permalink
Water Area checks (osmlab#346)
Browse files Browse the repository at this point in the history
* Partially working water area test

Signed-off-by: Taylor Smock <[email protected]>

* More false positives, but catches issues

Signed-off-by: Taylor Smock <[email protected]>

* Improve check (ignore dams, better intersection handling)

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Continue through area checks instead of stopping at the first problem

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Remove unnecessary line

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Add default config values

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Expand variable names

* Lambda functions have expanded variables
* Other variables should be expanded

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Move discrete checks to separate functions

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Configuration: FIXUP: Failing tests

* ConfigurationDeserializer#locateMap had an issue with a configuration variable

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheck: Add docs

Signed-off-by: Taylor Smock <[email protected]>

* WaterAreaCheckTest: FIXUP: Remove extraneous TODO comment

Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock authored Sep 9, 2020
1 parent a67d217 commit fe52307
Show file tree
Hide file tree
Showing 6 changed files with 757 additions and 2 deletions.
21 changes: 21 additions & 0 deletions config/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,5 +1068,26 @@
"difficulty": "EASY",
"defaultPriority": "LOW"
}
},
"WaterAreaCheck": {
"intersect.minimum.limit": 0.01,
"water.tags.crossing.ignore": [
"waterway->dam"
],
"water.tags.filters": [
"natural->water&water->*|waterway->riverbank"
],
"water.tags.filtersrequireswaterway": [
"natural->water&water->river,stream_pool,canal,lock|waterway->riverbank"
],
"waterway.tags.filters": [
"waterway->*"
],
"challenge": {
"description": "Overlapping waterway areas",
"blurb": "Edit overlapping waterway features so they either validly intersect or do not overlap.",
"instruction": "Open your favorite editor and edit the features overlapping the ocean so they either validly overlap or do not overlap.",
"difficulty": "MEDIUM"
}
}
}
5 changes: 3 additions & 2 deletions docs/available_checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ This document is a list of tables with a description and link to documentation f
| [OceanBleedingCheck](checks/oceanBleedingCheck.md) | The purpose of this check is to identify streets, buildings, and railways that bleed into (intersect) an ocean feature. |
| [OverlappingAOIPolygonCheck](checks/overlappingAOIPolygonCheck.md) | The purpose of this check is to identify areas of interest (AOIs) that are overlapping one another. |
| [PedestrianAreaOverlappingEdgeCheck](checks/pedestrianAreaOverlappingEdgeCheck.md) | The purpose of this check is to identify pedestrian areas overlapping with roads that are not snapped to car navigable edges. |
| [PoolSizeCheck](tutorials/tutorial1-PoolSizeCheck.md) | The purpose of this check is to identify pools that are larger than 5,000,000 square meters or smaller than 5 square meters. This check was created to be used as a tutorial for developing new checks. |
| [PoolSizeCheck](tutorials/tutorial1-PoolSizeCheck.md) | The purpose of this check is to identify pools that are larger than 5,000,000 square meters or smaller than 5 square meters. This check was created to be used as a tutorial for developing new checks. |
| [ShadowDetectionCheck](checks/shadowDetectionCheck.md) | The purpose of this check is to identify floating buildings. |
| [SpikyBuildingCheck](checks/spikyBuildingCheck.md) | The purpose of this check is to identify buildings with extremely sharp angles in their geometry. |
| [WaterAreaCheck](checks/waterAreaCheck.md) | Find overlapping water areas and water areas that should have a waterway. |
| [WaterbodyAndIslandSizeCheck](checks/waterbodyAndIslandSizeCheck.md) | The purpose of this check is to identify waterbodies and islands which are either too small or too large in size. |

## Highways
Expand Down Expand Up @@ -97,4 +98,4 @@ This document is a list of tables with a description and link to documentation f
| LineCrossingBuildingCheck | The purpose of this check is to identify line items (edges or lines) that are crossing buildings invalidly. |
| LineCrossingWaterBodyCheck | The purpose of this check is to identify line items (edges or lines) and optionally buildings, that cross water bodies invalidly. |
| MalformedPolyLineCheck | This check identifies lines that have only one point, or none, and the ones that are too long. |
| [SelfIntersectingPolylineCheck](checks/selfIntersectingPolylineCheck.md) | The purpose of this check is to identify all edges/lines/areas in Atlas that have self-intersecting polylines, or geometries that intersects itself in some form. |
| [SelfIntersectingPolylineCheck](checks/selfIntersectingPolylineCheck.md) | The purpose of this check is to identify all edges/lines/areas in Atlas that have self-intersecting polylines, or geometries that intersects itself in some form. |
38 changes: 38 additions & 0 deletions docs/checks/waterAreaCheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Water Area Check

#### Description
This check identifies waterbodies that cross each other or are missing a waterway (if the water area requires a water way).

#### Live Example
1) This [riverbank](https://www.openstreetmap.org/way/661564606) is missing a river waterway (on 2020-09-09).

2) This [pond](https://www.openstreetmap.org/way/448755487) is overlapping another [pond](https://www.openstreetmap.org/way/455609665).

#### Code Review
In [Atlas](https://github.com/osmlab/atlas), OSM elements are represented as Edges, Points, Lines,
Nodes, Areas & Relations; in our case, we’re are looking at [Areas](https://github.com/osmlab/atlas/blob/dev/src/main/java/org/openstreetmap/atlas/geography/atlas/items/Area.java).

Our first goal is to validate the incoming Atlas object. Valid features for this check will satisfy
the following conditions:
* Must be an Area with one of the following tags:
* `natural=WATER` AND `water=*`
* `wterway=RIVERBANK`

After the preliminary filtering, each object goes through a series of checks, the first of which checks to see if there should be a waterway inside the object, the second checks to ensure that water has a place to go (waterway exists the water body), and the third checks for overlapping waterways.


### Sample configuration (defaults)
```
{
"WaterAreaCheck": {
"intersect.minimum.limit": 0.01,
"water.tags.crossing.ignore": ["waterway->dam"],
"water.tags.filters": ["waterway->*"],
"water.tags.filtersrequireswaterway": ["natural->water&water->river,stream_pool,canal,lock|waterway->riverbank"],
"waterway.tags.filters": ["natural->water&water->*|waterway->riverbank"]
}
}
```

To learn more about the code, please look at the comments in the source code for the check.
[WaterAreaCheck.java](../../src/main/java/org/openstreetmap/atlas/checks/validation/areas/WaterbodyAreaCheck.java)
Loading

0 comments on commit fe52307

Please sign in to comment.