Skip to content

Commit

Permalink
Merge branch 'master' into 1.3, release as 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Jan 22, 2021
2 parents 213c34a + c256322 commit 9d2e285
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 50 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
## 1.3.1

### Bug Fixes

* fix crash when `elementsFullHistory` requests use the `filter` parameter ([#97])
* fix a bug where `groupBy/boundary` requests do ignore a given `filter` ([#99])
* update to OSHDB version 0.6.2, fixing a crash when building certain invalid multipolygon relations ([OSHDB#334])

[#97]: https://github.com/GIScience/ohsome-api/pull/97
[#99]: https://github.com/GIScience/ohsome-api/issues/99
[OSHDB#334]: https://github.com/GIScience/oshdb/issues/334


## 1.3.0

### Prominent Changes

* update OSHDB to version 0.6.0 ([#86])
* update OSHDB to version 0.6.1 ([#86])
* returned values of `length`, `area` and `perimeter` requests are more precise now: The previously used formulas could be off by a few of % in some cases, now all returned values are within half a percent from the real value. ([OSHDB#193])
* adjusted unit tests accordingly, from now on allowing up to 0.5% discrepancy in all affected tests
* improved performance of `groupBy/boundary` requests ([OSHDB#272]) and processing of complex multipolygon relations ([OSHDB#249] and [OSHDB#287])
Expand Down Expand Up @@ -35,6 +48,8 @@

## 1.2.2

### Bug Fixes

* provide contributions response as a downloadable file ([#78])

[#78]: https://github.com/GIScience/ohsome-api/pull/78
Expand All @@ -51,7 +66,7 @@

## 1.2.0

### Prominent Changes
### Prominent Changes

* several improvements to the docs (e.g. [#49] and partially in [#34])
* upgrade to ohsome-filter 1.3 ([#62])
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

The ohsome API is a generic web API for in-depth analysis of OpenStreetMap (OSM) data with a focus on it's history. It allows to get aggregated statistics about the evolution of OSM data itself and about the contributors behind the data. Furthermore, data extraction methods are provided to access the historic development of individual OSM features.

The functionalities of the ohsome API can be accessed via HTTP requests. As a basis underneath serves the [OSHDB API](https://github.com/GIScience/oshdb). The current stable version is [v1.3.0](https://github.com/GIScience/ohsome-api/releases/tag/1.3.0). Developed and maintained by [HeiGIT](https://heigit.org/).
The functionalities of the ohsome API can be accessed via HTTP requests. As a basis underneath serves the [OSHDB API](https://github.com/GIScience/oshdb). The current stable version is [v1.3.1](https://github.com/GIScience/ohsome-api/releases/tag/1.3.1). Developed and maintained by [HeiGIT](https://heigit.org/).

## Using the ohsome API

Expand Down Expand Up @@ -38,8 +38,8 @@ These instructions will get you a copy of the project up and running on your loc
2. move to your Maven project directory in a shell (e.g. Windows PowerShell)
3. enter the command `mvn -DskipTests=true package` to build the project (if you want to build it running the integrated tests too, look at the section [Testing](#testing))
4. to run the jar file enter the following (if no additional keytables file is given, you can assume that it is included):
* keytables included: `java -jar target/ohsome-api-1.3.0.jar --database.db=C:/path-to-your-data/ba-wue.oshdb`
* keytables not included: `java -jar target/ohsome-api-1.3.0.jar --database.db=C:/path-to-your-data/ba-wue.oshdb --database.keytables=C:/path-to-your-keytablesFile/keytables`
* keytables included: `java -jar target/ohsome-api-1.3.1.jar --database.db=C:/path-to-your-data/ba-wue.oshdb`
* keytables not included: `java -jar target/ohsome-api-1.3.1.jar --database.db=C:/path-to-your-data/ba-wue.oshdb --database.keytables=C:/path-to-your-keytablesFile/keytables`

Now you should have a running local API, which is ready for receiving requests under *http://localhost:8080/*.
<br>To check if it is running properly, you should be able to visit the swagger documentation under *http://localhost:8080/swagger-ui.html*.
Expand Down Expand Up @@ -97,7 +97,7 @@ Here you see an example response giving the length of residential roads for a bo
"url": "https://ohsome.org/copyrights",
"text": "© OpenStreetMap contributors"
},
"apiVersion": "1.3.0",
"apiVersion": "1.3.1",
"metadata": {
"executionTime": 858,
"description": "Total length of items in meters.",
Expand Down
78 changes: 39 additions & 39 deletions docs/endpoints.rst

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<name>ohsome API</name>
<description>A public Web-RESTful-API for "ohsome" OpenStreetMap history data.</description>
<packaging>jar</packaging>
<version>1.3.0</version>
<version>1.3.1</version>

<properties>
<apachecommons-csv.version>1.6</apachecommons-csv.version>
Expand All @@ -29,7 +29,7 @@
<jts2geojson.version>0.13.0</jts2geojson.version>
<mavenjar.version>3.2.0</mavenjar.version>
<opencsv.version>4.0</opencsv.version>
<oshdb.version>0.6.1</oshdb.version>
<oshdb.version>0.6.2</oshdb.version>
<projectlombok.version>1.18.16</projectlombok.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
<springfox.version>2.9.2</springfox.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.SortedMap;
import java.util.function.Consumer;
import java.util.stream.Collectors;
Expand All @@ -25,6 +26,7 @@
import org.heigit.bigspatialdata.oshdb.util.OSHDBTimestamp;
import org.heigit.bigspatialdata.oshdb.util.geometry.Geo;
import org.heigit.bigspatialdata.oshdb.util.time.TimestampFormatter;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.ohsomeapi.Application;
import org.heigit.ohsome.ohsomeapi.exception.BadRequestException;
import org.heigit.ohsome.ohsomeapi.exception.ExceptionMessages;
Expand Down Expand Up @@ -351,6 +353,10 @@ private ElementsResult[] fillElementsResult(SortedMap<OSHDBTimestamp, ? extends
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
preResult = mapAgg.map(OSMEntitySnapshot::getGeometry);
switch (requestResource) {
case COUNT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ public void extract() throws Exception {
String endTimestamp = IsoDateTimeParser.parseIsoDateTime(requestParameters.getTime()[1])
.format(DateTimeFormatter.ISO_DATE_TIME);
MapReducer<List<OSMContribution>> mapRedContributions = mapRedContribution.groupByEntity();
MapReducer<List<OSMEntitySnapshot>> mapRedSnapshots = mapRedSnapshot.groupByEntity();
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapRedSnapshot = mapRedSnapshot.filter(filter.get());
mapRedSnapshots = mapRedSnapshots.filter(filter.get());
mapRedContributions = mapRedContributions.filter(filter.get());
}
final boolean isContainingSimpleFeatureTypes = processingData.isContainingSimpleFeatureTypes();
Expand All @@ -124,8 +125,7 @@ public void extract() throws Exception {
MapReducer<Feature> snapshotPreResult = null;
if (!isContributionsEndpoint) {
// handles cases where valid_from = t_start, valid_to = t_end; i.e. non-modified data
snapshotPreResult = mapRedSnapshot
.groupByEntity()
snapshotPreResult = mapRedSnapshots
.filter(snapshots -> snapshots.size() == 2)
.filter(snapshots -> snapshots.get(0).getGeometry() == snapshots.get(1).getGeometry()
&& snapshots.get(0).getEntity().getVersion() == snapshots.get(1).getEntity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
Expand Down Expand Up @@ -191,6 +192,10 @@ public static <P extends Geometry & Polygonal> Response aggregateGroupByBoundary
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
ExecutionUtils exeUtils = new ExecutionUtils(processingData);
var preResult = mapAgg.map(f -> exeUtils.mapSnapshotToTags(keysInt, valuesInt, f))
.aggregateBy(Pair::getKey, zeroFill).map(Pair::getValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.SortedMap;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand All @@ -22,6 +23,7 @@
import org.heigit.bigspatialdata.oshdb.osm.OSMType;
import org.heigit.bigspatialdata.oshdb.util.OSHDBTimestamp;
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.ohsomeapi.Application;
import org.heigit.ohsome.ohsomeapi.exception.BadRequestException;
import org.heigit.ohsome.ohsomeapi.exception.ExceptionMessages;
Expand Down Expand Up @@ -313,6 +315,10 @@ public static <P extends Geometry & Polygonal> Response countGroupByBoundary(
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
SortedMap<OSHDBCombinedIndex<OSHDBTimestamp, Integer>, Integer> result =
mapAgg.map(OSMContribution::getContributorUserId).countUniq();
SortedMap<Integer, SortedMap<OSHDBTimestamp, Integer>> groupByResult;
Expand Down

0 comments on commit 9d2e285

Please sign in to comment.