Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor oshdb core (and more) #369

Merged
merged 36 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b84d0b2
unify: rename getRefs to getMembers
rtroilo Apr 12, 2021
5354178
rename getRawUnixTimestamp to getEpochSecond
rtroilo Apr 12, 2021
73e0d0f
refactor oshdbtimestamp
rtroilo Apr 12, 2021
46885aa
move oshdbtag, deprecated rawTag access
rtroilo Apr 12, 2021
fb7e3b0
move oshdbboundingbox, make inmutable, add new interface
rtroilo Apr 12, 2021
e4821d3
moveing OSH/OSMEntityFilter to oshdb/osm package
rtroilo Apr 12, 2021
d08ca8d
fix find&replace to much lines
rtroilo Apr 12, 2021
943197e
Merge branch 'master' into refactor-oshdb-core
rtroilo Apr 12, 2021
e18c3f8
fix wrong min/max lon/lat
rtroilo Apr 12, 2021
7c577bd
bbox for nodes without header_bbox
rtroilo Apr 12, 2021
50c3be3
moving oshdb-api.generic.function to oshdb.util.function
rtroilo Apr 12, 2021
24e5231
remove some debug leftovers and auto save actions
rtroilo Apr 12, 2021
3222fdb
remove some debug leftovers and auto save actions
rtroilo Apr 12, 2021
ba0c2fa
remove some debug leftovers and auto save actions
rtroilo Apr 12, 2021
56cc6be
Merge branch 'master' into refactor-oshdb-core
rtroilo Apr 13, 2021
0813337
moving oshdb.util.function to oshdb-util module
rtroilo Apr 13, 2021
d45d2d8
revert reorder import
rtroilo Apr 14, 2021
7ab2991
revert reorder import
rtroilo Apr 14, 2021
644afc0
revert reorder import
rtroilo Apr 16, 2021
811bff3
Merge branch 'master' into refactor-oshdb-core
rtroilo Apr 21, 2021
abb1b7d
fix comment/checkstyle
rtroilo Apr 27, 2021
12d65f2
fix checkstyle
rtroilo Apr 27, 2021
f15537f
rename intersect to intersection
rtroilo Apr 27, 2021
f1a2ba1
update changelog
rtroilo Apr 27, 2021
1c59dfc
reorganize breaking changes, table for renamed/moved stuff
tyrasd Apr 27, 2021
0aea420
remove getBoundingBox from OSHDBBoundable
rtroilo Apr 27, 2021
484b3a2
Merge branch 'refactor-oshdb-core' of github.com:GIScience/oshdb into…
rtroilo Apr 27, 2021
a8c8a8a
fix failing test, rename inside to coveredBy
rtroilo Apr 27, 2021
4beb0bf
remove static isBefore/isAfter methodes
rtroilo Apr 27, 2021
066d204
move upgrade instructions in to dedicated section
tyrasd Apr 27, 2021
f8d91cc
remove unused imports
tyrasd Apr 29, 2021
642dbb6
fix bug, dead-store
rtroilo Apr 29, 2021
cbfb661
rename OSHDBTimeable to OSHDBTemporal
rtroilo Apr 29, 2021
77604c7
Merge branch 'refactor-oshdb-core' of github.com:GIScience/oshdb into…
rtroilo Apr 29, 2021
d42986c
remove getTimestamp from OSHDBTemporal
rtroilo Apr 29, 2021
c5a865f
add some more javadoc and unit tests
tyrasd Apr 29, 2021
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
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