Verified Commit 8978f49f authored by Johannes Visintini's avatar Johannes Visintini
Browse files

Update to OSHDB 1.0.0 and Merge branch 'oshdb-snapshot' into oshdb-stable

parents 81eb10f3 b6926535
Pipeline #3552 created
......@@ -3,12 +3,12 @@
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="active-configuration" value="HTTP_URL:https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/parent/raw/2.11/ohsome-codestyle/src/main/resources/checkstyle-google-ohsome.xml:ohsome Google Checks" />
<entry key="checkstyle-version" value="8.41.1" />
<entry key="active-configuration" value="HTTP_URL:https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/parent/raw/2.12.1/ohsome-codestyle/src/main/resources/checkstyle-google-ohsome.xml:ohsome Google Checks" />
<entry key="checkstyle-version" value="8.44" />
<entry key="copy-libs" value="false" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="location-2" value="HTTP_URL:https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/parent/raw/2.11/ohsome-codestyle/src/main/resources/checkstyle-google-ohsome.xml:ohsome Google Checks" />
<entry key="location-2" value="HTTP_URL:https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/parent/raw/2.12.1/ohsome-codestyle/src/main/resources/checkstyle-google-ohsome.xml:ohsome Google Checks" />
<entry key="property-2.org.checkstyle.google.suppressionfilter.config" value="" />
<entry key="property-2.org.checkstyle.google.suppressionxpathfilter.config" value="" />
<entry key="scan-before-checkin" value="false" />
......
......@@ -16,11 +16,11 @@
<parent>
<groupId>org.heigit.ohsome</groupId>
<artifactId>ohsome-parent</artifactId>
<version>2.11</version>
<version>2.12.1</version>
</parent>
<properties>
<oshdb.version>[0.7.0,0.8.0-a0)</oshdb.version>
<oshdb.version>[1.0.0,1.1.0-a0)</oshdb.version>
</properties>
<repositories>
......
package org.heigit.ohsome.oshdb.examples.analyses;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.util.SortedMap;
import java.util.TimeZone;
import org.heigit.ohsome.oshdb.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.OSHDBTimestamp;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
import org.heigit.ohsome.oshdb.api.mapreducer.OSMContributionView;
import org.heigit.ohsome.oshdb.util.mappable.OSMContribution;
import org.heigit.ohsome.oshdb.util.time.OSHDBTimestamps.Interval;
import org.heigit.ohsome.oshdb.util.time.TimestampFormatter;
@SuppressWarnings("java:S106")
public class DistinctContributors {
......@@ -19,13 +20,9 @@ public class DistinctContributors {
// database
OSHDBH2 oshdb = new OSHDBH2(
DistinctContributors.class.getResource("/test.oshdb.mv.db").getFile())
.multithreading(true);
// keytables
OSHDBH2 oshdbKeytables = new OSHDBH2(
DistinctContributors.class.getResource("/test.oshdb.keytables.mv.db").getFile())) {
.multithreading(true)) {
// query
result = OSMContributionView.on(oshdb)
.keytables(oshdbKeytables)
.areaOfInterest(
OSHDBBoundingBox.bboxWgs84Coordinates(71.45, -1.16, 74.7, 7.47)) // maldives
.timestamps("2007-01-01", "2017-12-01", Interval.MONTHLY)
......@@ -35,9 +32,11 @@ public class DistinctContributors {
.countUniq();
}
// output
var dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
for (Map.Entry<OSHDBTimestamp, Integer> entry : result.entrySet()) {
System.out.format("%s\t%.2f%n",
TimestampFormatter.getInstance().isoDateTime(entry.getKey()),
dateFormatter.format(entry.getKey()),
entry.getValue().doubleValue()
);
}
......
package org.heigit.ohsome.oshdb.examples.analyses;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TimeZone;
import org.heigit.ohsome.oshdb.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.OSHDBTimestamp;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
import org.heigit.ohsome.oshdb.api.mapreducer.OSMEntitySnapshotView;
import org.heigit.ohsome.oshdb.util.geometry.Geo;
import org.heigit.ohsome.oshdb.util.time.OSHDBTimestamps.Interval;
import org.heigit.ohsome.oshdb.util.time.TimestampFormatter;
@SuppressWarnings("java:S106")
public class RoadLength {
......@@ -29,14 +30,9 @@ public class RoadLength {
OSHDBH2 oshdb = new OSHDBH2(RoadLength.class.getResource("/test.oshdb.mv.db")
.getFile()
.replace(".mv.db", ""))
.multithreading(true);
OSHDBH2 oshdbKeytables = new OSHDBH2(
RoadLength.class.getResource("/test.oshdb.keytables.mv.db")
.getFile()
.replace(".mv.db", ""))) {
.multithreading(true)) {
// query
result = OSMEntitySnapshotView.on(oshdb)
.keytables(oshdbKeytables)
.areaOfInterest(
OSHDBBoundingBox.bboxWgs84Coordinates(71.45, -1.16, 74.7, 7.47)) // maldives
.timestamps("2007-01-01", "2017-12-01", Interval.MONTHLY)
......@@ -45,9 +41,11 @@ public class RoadLength {
.sum(snapshot -> Geo.lengthOf(snapshot.getGeometry()) / 1000);
}
// output
var dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
for (Map.Entry<OSHDBTimestamp, Number> entry : result.entrySet()) {
System.out.format("%s\t%.2f%n",
TimestampFormatter.getInstance().isoDateTime(entry.getKey()),
dateFormatter.format(entry.getKey()),
entry.getValue().doubleValue()
);
}
......
......@@ -7,7 +7,6 @@ import java.util.SortedMap;
import org.heigit.ohsome.oshdb.OSHDBTimestamp;
import org.heigit.ohsome.oshdb.api.db.OSHDBDatabase;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
import org.heigit.ohsome.oshdb.api.db.OSHDBJdbc;
import org.heigit.ohsome.oshdb.api.mapreducer.OSMContributionView;
import org.heigit.ohsome.oshdb.util.celliterator.ContributionType;
import org.heigit.ohsome.oshdb.util.function.SerializableBinaryOperator;
......@@ -24,13 +23,9 @@ public class AdvancedExample {
SortedMap<OSHDBTimestamp, Map<ContributionType, Integer>> reduce;
try (OSHDBDatabase oshdb = new OSHDBH2(AdvancedExample.class.getResource("/test.oshdb.mv.db")
.getFile()
.replace(".mv.db", ""));
OSHDBJdbc keytables = new OSHDBH2(Tutorial.class.getResource("/test.oshdb.keytables.mv.db")
.getFile()
.replace(".mv.db", ""))) {
.replace(".mv.db", ""))) {
//Define MapReducer
reduce = OSMContributionView.on(oshdb)
.keytables(keytables)
.timestamps("2014-01-01", "2015-01-01", OSHDBTimestamps.Interval.MONTHLY)
.filter("geometry:polygon and building=*")
.map(new Mapper())
......
......@@ -3,7 +3,6 @@ package org.heigit.ohsome.oshdb.tutorial;
import org.heigit.ohsome.oshdb.OSHDBBoundingBox;
import org.heigit.ohsome.oshdb.api.db.OSHDBDatabase;
import org.heigit.ohsome.oshdb.api.db.OSHDBH2;
import org.heigit.ohsome.oshdb.api.db.OSHDBJdbc;
import org.heigit.ohsome.oshdb.api.mapreducer.MapReducer;
import org.heigit.ohsome.oshdb.api.mapreducer.OSMEntitySnapshotView;
import org.heigit.ohsome.oshdb.util.function.SerializableFunction;
......@@ -29,16 +28,6 @@ public class Tutorial {
// create a MapReducer on Snapshots
MapReducer<OSMEntitySnapshot> mapReducer = OSMEntitySnapshotView.on(oshdb);
// -- MANDATORY SETTINGS --
// declare and open a link to keytables
OSHDBJdbc tagsDatabase = new OSHDBH2(
Tutorial.class.getResource("/test.oshdb.keytables.mv.db")
.getFile()
.replace(".mv.db", "")
);
// add keytables to the MapReducer
mapReducer = mapReducer.keytables(tagsDatabase);
// Setting spatial extent
// create BoundingBox
OSHDBBoundingBox boundingBox = OSHDBBoundingBox
......@@ -66,7 +55,6 @@ public class Tutorial {
// --Tear Down --
oshdb.close();
tagsDatabase.close();
// -- RESULT --
System.out.println(result);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment