Skip to content

Commit

Permalink
Merge pull request #369 from GIScience/refactor-oshdb-core
Browse files Browse the repository at this point in the history
refactor oshdb core (and more)
  • Loading branch information
rtroilo authored Apr 29, 2021
2 parents 9fb78f1 + c5a865f commit ece7b85
Show file tree
Hide file tree
Showing 159 changed files with 1,618 additions and 1,356 deletions.
35 changes: 25 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,54 @@ Changelog

### breaking changes

* reorganizing java packages, moving them from `org/heigit/bigspatialdata` to `org/heigit/ohsome`
* reorganize java packages, moving them from `org/heigit/bigspatialdata` to `org/heigit/ohsome`
* integrate [ohsome-filter](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/libs/ohsome-filter) module fully into this repository, renaming it to `oshdb-filter` ([#306])
* rename methods and move classes/interfaces ([#369])

When switching to the OSHDB version 0.7 you need to change your imports to the new path, e.g.:
```java
import org.heigit.ohsome.oshdb.api.db.OSHDBDatabase;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
```
> See the _upgrading from 0.6_ section below for instructions how to update your code according to these breaking changes.
### performance improvements

* replace an unnecessarily used Map with a more lightweight implementation using a List. ([#352])

### other changes

* integrate [ohsome-filter](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/libs/ohsome-filter) module fully into this repository, renaming it to `oshdb-filter`. ([#306])
* make sure predicate-filters are always serializable. ([#353])
* improve maintainability of parts of important central processing algorithms for determining entity modification history: refactoring improves code structure, adds inline documentation and enhances test coverage. ([#327])
* make sure predicate-filters are always serializable ([#353])
* improve maintainability of parts of important central processing algorithms for determining entity modification history: refactoring improves code structure, adds inline documentation and enhances test coverage ([#327])
* reorganize and update ohsome parent module ([#360])
* add new interfaces `OSHDBTemporal` and `OSHDBBoundable` ([#369])

### bugfixes

* when filtering for `geometry:other`: also consider GeometryCollections occurring 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`.
* Since the java package namespace was updated, you need to change your imports to the new path, e.g.:
```java
import org.heigit.ohsome.oshdb.api.db.OSHDBDatabase;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
```
* If you 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`.
* the following methods, classes and packages were renamed or moved:
| | old | new |
| --- | --- | --- |
| renamed method | `OSMWay.getRef()` | `OSMWay.getMember()` |
| renamed method | `OSHDBTimestamp.getRawUnixTimestamp()` | `OSHDBTimestamp.getEpochSecond()` |
| moved class | `oshdb.util.OSHDBTimestamp` | `oshdb.OSHDBTimestamp` |
| moved class | `oshdb.util.OSHDBTag` | `oshdb.OSHDBTag` |
| moved class | `CellIterator.OSHEntityFilter` | `oshdb-util/oshdb.osh.OSHEntityFilter` |
| moved class | `CellIterator.OSMEntityFilter` | `oshdb-util/oshdb.osm.OSMEntityFilter` |
| moved class | `oshdb-api.generic.function` | `oshdb-util/oshdb.util.function` |


[#306]: https://github.com/GIScience/oshdb/pull/306
[#327]: https://github.com/GIScience/oshdb/issues/327
[#338]: https://github.com/GIScience/oshdb/issues/338
[#352]: https://github.com/GIScience/oshdb/pull/352
[#353]: https://github.com/GIScience/oshdb/pull/353
[#360]: https://github.com/GIScience/oshdb/pull/360
[#369]: https://github.com/GIScience/oshdb/pull/369


## 0.6.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.heigit.ohsome.oshdb.OSHDBBoundable;
import org.heigit.ohsome.oshdb.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.api.object.OSMContribution;
import org.heigit.ohsome.oshdb.api.object.OSMEntitySnapshot;
import org.heigit.ohsome.oshdb.util.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.util.celliterator.ContributionType;
import org.heigit.ohsome.oshdb.util.celliterator.LazyEvaluatedObject;
import org.heigit.ohsome.oshdb.util.geometry.OSHDBGeometryBuilder;
import org.heigit.ohsome.oshdb.util.geometry.fip.FastBboxInPolygon;
import org.heigit.ohsome.oshdb.util.geometry.fip.FastBboxOutsidePolygon;
import org.heigit.ohsome.oshdb.util.geometry.fip.FastPolygonOperations;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Polygonal;
Expand Down Expand Up @@ -85,9 +87,9 @@ D getData() {
* @return a list of OSMEntitySnapshot objects
*/
public Map<U, OSMEntitySnapshot> splitOSMEntitySnapshot(OSMEntitySnapshot data) {
OSHDBBoundingBox oshBoundingBox = data.getOSHEntity().getBoundingBox();
OSHDBBoundable oshBoundingBox = data.getOSHEntity();
@SuppressWarnings("unchecked") // STRtree works with raw types unfortunately
List<U> candidates = (List<U>) spatialIndex.query(
List<U> candidates = spatialIndex.query(
OSHDBGeometryBuilder.getGeometry(oshBoundingBox).getEnvelopeInternal()
);
return candidates.stream()
Expand Down Expand Up @@ -149,9 +151,9 @@ public Map<U, OSMEntitySnapshot> splitOSMEntitySnapshot(OSMEntitySnapshot data)
* @return a list of OSMContribution objects
*/
public Map<U, OSMContribution> splitOSMContribution(OSMContribution data) {
OSHDBBoundingBox oshBoundingBox = data.getOSHEntity().getBoundingBox();
OSHDBBoundable oshBoundingBox = data.getOSHEntity();
@SuppressWarnings("unchecked") // STRtree works with raw types unfortunately
List<U> candidates = (List<U>) spatialIndex.query(
List<U> candidates = spatialIndex.query(
OSHDBGeometryBuilder.getGeometry(oshBoundingBox).getEnvelopeInternal()
);
return candidates.stream()
Expand All @@ -176,12 +178,9 @@ public Map<U, OSMContribution> splitOSMContribution(OSMContribution data) {
contributionGeometryBefore.getEnvelopeInternal()
);
} else {
contributionGeometryBbox = OSHDBGeometryBuilder.boundingBoxOf(
contributionGeometryBefore.getEnvelopeInternal()
);
contributionGeometryBbox.add(OSHDBGeometryBuilder.boundingBoxOf(
contributionGeometryAfter.getEnvelopeInternal()
));
Envelope env = contributionGeometryBefore.getEnvelopeInternal();
env.expandToInclude(contributionGeometryAfter.getEnvelopeInternal());
contributionGeometryBbox = OSHDBGeometryBuilder.boundingBoxOf(env);
}

if (bops.get(index).test(contributionGeometryBbox)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.heigit.ohsome.oshdb.api.mapreducer;

import java.io.Serializable;
import org.heigit.ohsome.oshdb.api.generic.function.SerializableFunction;
import org.heigit.ohsome.oshdb.util.function.SerializableFunction;

/**
* Interface for MapReducers or MapAggregators that can be aggregated by an arbitrary index.
Expand Down
Loading

0 comments on commit ece7b85

Please sign in to comment.