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

Releases/v4.1 #86

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
f0857c6
ORS modifications
takb Oct 4, 2021
db5699e
Merge branch 'ors_3.0-upgrade' into ors_4.0
takb Oct 4, 2021
ecd11db
fix obvious compilation errors
takb Oct 4, 2021
1e0b5b9
make compile, CHGraphImpl needs splitting up
takb Oct 4, 2021
4af7289
adjust version tags
takb Oct 4, 2021
c3f0793
Fix issues with ORS graph extensions
Oct 5, 2021
98b30c7
Make flag inORS usable from static contexts
Oct 5, 2021
11a01f0
Reintroduce GraphExtension as a temporary fix
Oct 11, 2021
cd299ba
use jdk17 ga and jdk18 ea (#2419)
karussell Oct 4, 2021
ed9d3c7
Turn ExtendedStorageSequence back into a GraphExtension
Oct 11, 2021
0bb21e0
Add method to set extended storages in GraphHopperStorage
Oct 13, 2021
60ca04c
Enable core preparation
aoles Nov 2, 2021
6fdc983
Preliminary adaptations for time-dependent core routing
aoles Nov 3, 2021
757919b
Adjustments in order to accommodate CorePreparationHandler
aoles Nov 5, 2021
675c0e3
Enable core landmark preparation
aoles Nov 15, 2021
b2471a3
Fixes to core proparation
aoles Nov 22, 2021
7ab0646
Disable node level check when adding core shortcuts
aoles Nov 26, 2021
4d1c4e7
Move and rename ORS hook
aoles Nov 26, 2021
8038b88
Remove deprecated method getSpeed
Dec 2, 2021
448efc9
Fixes to core landmarks preparation
aoles Dec 16, 2021
291ae06
log4j version bump
takb Dec 16, 2021
3854dba
Merge branch 'ors_4.0' of https://github.com/GIScience/graphhopper in…
takb Dec 16, 2021
cd8ae36
More fixes to core landmarks preparation
aoles Dec 17, 2021
4acd596
log4j version
takb Jan 3, 2022
d153171
Add ors hook
Jan 13, 2022
74f9715
Fix access level
Jan 13, 2022
e47fde9
Facilitate not adding core nodes to the contraction queue
aoles Jan 14, 2022
6192280
Fix to core landmark storage
aoles Jan 26, 2022
06d7baa
Fixes to OSMReader
aoles Feb 15, 2022
8df76c9
Re-enable use of GraphStorageFactory
aoles Feb 15, 2022
863bc99
fix additionalEdgeFilter declaration
takb Feb 16, 2022
06b6899
Minor change to method visibility
aoles Feb 22, 2022
53dc343
Expose some methods to ORS
aoles Feb 25, 2022
777b2e5
fix extended storages & extra info
takb Feb 28, 2022
30bea49
fix PathProcessor
takb Mar 1, 2022
c05634b
Fix missing setup of maximum speed parameter
Mar 3, 2022
75dd63f
fix unit test fails related to PathProcessor
takb Mar 3, 2022
8771180
Facilitate keeping Core profiles separate from CH profiles
aoles Mar 21, 2022
511b700
Minor fix to previous commit
aoles Mar 22, 2022
ff30a73
Move edge filter initialization for the sake of complexity reduction
aoles Mar 30, 2022
a6f545d
Enable edge filter injection for LM routing
aoles Mar 30, 2022
6b771e8
Expose a method to ORS
aoles Apr 4, 2022
ecd485f
Enable initialization with core LMProfiles
aoles Apr 8, 2022
9fac2f6
Refactor speed calculator initialization
aoles Apr 13, 2022
6f86181
Move method to ORSGraphHopperStorage subclass
aoles May 4, 2022
f796daa
Update us.dustinj.timezonemap to version 4.5
koebi May 12, 2022
f996758
Fix TimeDependentAccessEdgeFilterTest
koebi May 18, 2022
4292862
Re-enable tests
koebi May 18, 2022
2071c51
Enable overriding the method quering for the number of graph nodes
aoles May 18, 2022
2e5508b
adapt CarFlagEncoder Access Tags
koebi May 19, 2022
3ca839d
Merge pull request #48 from GIScience/ors_4.0_tdtests
takb May 24, 2022
02e1bb9
Do not check for turn costs in node based CH routing
aoles May 27, 2022
e4fec1b
activate reader-gtfs module
koebi Jun 13, 2022
6ce98ad
add init & adjust weighting creation
takb Jun 28, 2022
1e7f16a
improved weighting creation
takb Jun 29, 2022
da09e5a
correct fix for unit tests
takb Jun 29, 2022
dca6f3e
avoid NPE since times will be null in gtfs
koebi Jun 28, 2022
5a5736a
uncomment single failing line and add TODO
koebi Jun 29, 2022
223a156
fix PtRouterImpl.RequestHandler
takb Jul 5, 2022
8803c06
fix unit tests
takb Jul 8, 2022
dd67d4c
fix instruction handling
takb Jul 13, 2022
c341e54
Do not declare constanst to be overriden as static
aoles Jul 15, 2022
3360315
fix elevation output
takb Jul 20, 2022
b5f2c04
multimodal test fixed itself
koebi Jul 20, 2022
b0e15f3
TODOs
takb Jul 27, 2022
b1efb86
Update TODO comments
Aug 4, 2022
201b3d5
stop storing pt edge names
takb Aug 8, 2022
c112db5
patch GTFS 5.0
takb Aug 11, 2022
db19c86
fix PtRouterImpl.Factory transfer parsing issue
takb Aug 15, 2022
5a4d245
Remove obsolete class
Aug 15, 2022
25e54cf
fix memory usage calculation
takb Aug 10, 2022
df54c18
use EdgeFilter while snapping
takb Sep 6, 2022
3d36895
fix edgefilter in CoreALT
takb Sep 6, 2022
20f007f
remove deprecated setSimplifyResponse()
koebi Sep 6, 2022
9179dc0
fix pt leg output & instructions
takb Sep 8, 2022
4e938e5
implemented GTFS shape matching and output
takb Sep 9, 2022
3490ce9
fix waypoint indices & empty shape handling
takb Sep 13, 2022
90f84f1
Add reverseDirection parameter to PathExtractor time calculation
Sep 15, 2022
8ac1ca1
fix pt distance calculation
takb Sep 19, 2022
7a0c22c
merge master on ors_4.0
takb Sep 27, 2022
d2c42cb
fix weighting selection
takb Sep 28, 2022
a7fe8e7
detect cases where entry and exit PT stations cannot be reached withi…
takb Sep 30, 2022
4564063
Methods for handling OSM tags containing enumerations
aoles Oct 5, 2022
ebe370d
improve error messages
takb Oct 7, 2022
6971ed9
Use time-aware calcEdgeWeight methods
aoles Oct 13, 2022
433518c
Expose certain methods to be able to call them from ORS
aoles Oct 31, 2022
b43dec8
Remove obsolete class
aoles Oct 31, 2022
bd442ad
Remove another obsolete class
aoles Oct 31, 2022
2d6e862
Remove obsolete methods and commented out code
aoles Oct 31, 2022
f8e2ffb
additional method for overriding handleNodeTags in AbstractFlagencoder
takb Oct 31, 2022
86a994f
fix elevation reading from pbf
takb Oct 31, 2022
56f3414
fix ele parsing
takb Oct 31, 2022
d9f30fd
handle bad number formatting in ele tags
takb Nov 2, 2022
b7c8855
Facilitate logging for `CoreLMPreparationHandler`
aoles Nov 18, 2022
912e5fc
Fix: re-enable ORS soft weightings
Feb 8, 2023
4eca8c4
Merge pull request #54 from GIScience/fix/re-enable_soft_weightings
takb Feb 8, 2023
c4c2c9d
fix: enable overriding of `initCHPreparationHandler`
aoles Feb 12, 2023
0801f7b
Merge pull request #55 from GIScience/fix/enable_overriding_CHPrepara…
takb Feb 21, 2023
c40fd38
fix: obtain speed from `speedCalculator` in `fastestWeighting`
aoles Feb 22, 2023
173550c
Merge pull request #56 from GIScience/fix/use_speed_calculator
takb Feb 22, 2023
a7c7858
Reintroduce actual lengths of ways for ferry duration calculation
rabidllama Mar 1, 2023
6dbb40b
reintroduce passing graph build date
takb Mar 1, 2023
43dcfcb
modifications to foot/bike network tag parsers
takb Mar 1, 2023
6365e8d
fix relation tags preference
takb Mar 1, 2023
02f118a
fix unit tests: IndexStructureInfo, zipped sample feed, route geometry
takb Mar 7, 2023
71fccc7
fix unit tests
takb Mar 8, 2023
3c27ad6
Merge branch 'ors_4.0_gtfs' into ors_4.0
takb Mar 8, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ android/libs/graphhopper-*-android.jar
!/core/src/test/resources/com/graphhopper/reader/osm/*.pbf
*.dem
*.log
core/TODO*.txt
core/files/dem*
/logs
srtmprovider/
cgiarprovider/
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ env:
matrix:
include:
- jdk: openjdk8
- env: JDK='OpenJDK 16'
install: . ./install-jdk.sh -F 16 -C --url 'https://api.adoptopenjdk.net/v3/binary/latest/16/ga/linux/x64/jdk/hotspot/normal/adoptopenjdk'
- env: JDK='OpenJDK 17'
install: . ./install-jdk.sh -F 17 -C --url 'https://api.adoptopenjdk.net/v3/binary/latest/17/ea/linux/x64/jdk/hotspot/normal/adoptopenjdk'
install: . ./install-jdk.sh -F 17 -C
- env: JDK='OpenJDK 18'
install: . ./install-jdk.sh -F ea -C

# avoid default dependency command for maven, 'true' means 'return true' and continue
install: true
Expand Down
4 changes: 4 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [ ] I have clearly marked my changes with comments '// ORS-GH MOD START' and '// ORS-GH MOD END'
- [ ] I have written a short in-line comment for code changes explaining why the change is required
- [ ] I have tested the latest version of **openrouteservice** `development` branch against the .jar build of this PR
- [ ] I have adjusted failing tests in **openrouteservice** API tests
44 changes: 39 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<artifactId>graphhopper-core</artifactId>
<name>GraphHopper Core</name>
<version>4.0</version>
<version>4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>
GraphHopper is a fast and memory efficient Java road routing engine
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-parent</artifactId>
<version>4.0</version>
<version>4.0-SNAPSHOT</version>
</parent>

<properties>
Expand Down Expand Up @@ -70,6 +70,19 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>ch.poole</groupId>
<artifactId>ConditionalRestrictionParser</artifactId>
<!-- TODO ORS: where is this defined? <version>${crparser.version}</version> -->
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>ch.poole</groupId>
<artifactId>OpeningHoursParser</artifactId>
<!-- TODO ORS: where is this defined? <version>${ohparser.version}</version> -->
<version>0.25.0</version>
</dependency>

<!-- for using CGIAR: elevation data importing via tif files-->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
Expand All @@ -93,14 +106,27 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>log4j-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<type>pom</type>
<version>2.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>us.dustinj.timezonemap</groupId>
<artifactId>timezonemap</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -146,6 +172,14 @@
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>

<!-- make version available at runtime via version file -->
Expand All @@ -170,4 +204,4 @@
</resource>
</resources>
</build>
</project>
</project>
98 changes: 91 additions & 7 deletions core/src/main/java/com/graphhopper/GraphHopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.graphhopper.routing.util.countryrules.CountryRuleFactory;
import com.graphhopper.routing.util.parsers.DefaultTagParserFactory;
import com.graphhopper.routing.util.parsers.TagParserFactory;
import com.graphhopper.routing.weighting.TimeDependentAccessWeighting;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.routing.weighting.custom.CustomProfile;
import com.graphhopper.routing.weighting.custom.CustomWeighting;
Expand All @@ -51,8 +52,10 @@
import com.graphhopper.util.Parameters.Landmark;
import com.graphhopper.util.Parameters.Routing;
import com.graphhopper.util.details.PathDetailsBuilderFactory;
import com.graphhopper.util.shapes.BBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import us.dustinj.timezonemap.TimeZoneMap;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -79,7 +82,9 @@
*/
public class GraphHopper {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Map<String, Profile> profilesByName = new LinkedHashMap<>();
// ORS-GH MOD START change access private -> protected
protected final Map<String, Profile> profilesByName = new LinkedHashMap<>();
// ORS-GH MOD END
private final String fileLockName = "gh.lock";
// utils
private final TranslationMap trMap = new TranslationMap().doImport();
Expand Down Expand Up @@ -125,6 +130,24 @@ public class GraphHopper {
private TagParserFactory tagParserFactory = new DefaultTagParserFactory();
private PathDetailsBuilderFactory pathBuilderFactory = new PathDetailsBuilderFactory();

// ORS-GH MOD START
protected PathProcessorFactory pathProcessorFactory = PathProcessorFactory.DEFAULT;
protected WeightingFactory weightingFactory;
protected GraphStorageFactory graphStorageFactory;

public void setPathProcessorFactory(PathProcessorFactory newFactory) {
this.pathProcessorFactory = newFactory;
}

public void setWeightingFactory(WeightingFactory weightingFactory) {
this.weightingFactory = weightingFactory;
}

public void setGraphStorageFactory(GraphStorageFactory graphStorageFactory) {
this.graphStorageFactory = graphStorageFactory;
}
// ORS-GH MOD END

public EncodingManager.Builder getEncodingManagerBuilder() {
return emBuilder;
}
Expand Down Expand Up @@ -283,6 +306,18 @@ public GraphHopper setElevation(boolean includeElevation) {
return this;
}

// ORS-GH MOD START
// CALT
@Deprecated
public boolean isSimplifyResponse() {
return getRouterConfig().isSimplifyResponse();
}

public boolean isFullyLoaded() {
return fullyLoaded;
}
// ORS-GH MOD END

/**
* Sets the distance distance between elevation samples on long edges
*/
Expand Down Expand Up @@ -694,7 +729,7 @@ protected void importOSM() {
AreaIndex<CustomArea> areaIndex = new AreaIndex<>(customAreas);

logger.info("start creating graph from " + osmFile);
OSMReader reader = new OSMReader(ghStorage).setFile(_getOSMFile()).
OSMReader reader = createOSMReader().setFile(_getOSMFile()).
setAreaIndex(areaIndex).
setElevationProvider(eleProvider).
setWorkerThreads(dataReaderWorkerThreads).
Expand All @@ -715,6 +750,12 @@ protected void importOSM() {
ghStorage.getProperties().put("datareader.data.date", f.format(reader.getDataDate()));
}

// ORS-GH MOD START add method for overriding
protected OSMReader createOSMReader() {
return new OSMReader(ghStorage);
}
// ORS-GH MOD END

private List<CustomArea> readCustomAreas() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JtsModule());
Expand Down Expand Up @@ -783,7 +824,14 @@ public boolean load(String graphHopperFolder) {
}

GHDirectory dir = new GHDirectory(ghLocation, dataAccessType);
ghStorage = new GraphHopperStorage(dir, encodingManager, hasElevation(), encodingManager.needsTurnCostsSupport(), defaultSegmentSize);

// ORS-GH MOD START use storage factory in ORSGraphHopper
if (graphStorageFactory != null) {
ghStorage = graphStorageFactory.createStorage(dir, this);
} else {
ghStorage = new GraphHopperStorage(dir, encodingManager, hasElevation(), encodingManager.needsTurnCostsSupport(), defaultSegmentSize);
}
// ORS-GH MOD END
checkProfilesConsistency();

if (lmPreparationHandler.isEnabled())
Expand All @@ -799,6 +847,10 @@ public boolean load(String graphHopperFolder) {

ghStorage.addCHGraphs(chConfigs);

// ORS-GH MOD START add preparation hook
loadORS();
// ORS-GH MOD START

if (!new File(graphHopperFolder).exists())
return false;

Expand All @@ -825,6 +877,10 @@ public boolean load(String graphHopperFolder) {
}
}

// ORS-GH MOD START add preparation hook
protected void loadORS() {}
// ORS-GH MOD START

private void checkProfilesConsistency() {
EncodingManager encodingManager = getEncodingManager();
for (Profile profile : profilesByName.values()) {
Expand Down Expand Up @@ -892,7 +948,9 @@ public final CHPreparationHandler getCHPreparationHandler() {
return chPreparationHandler;
}

private void initCHPreparationHandler() {
// ORS-GH MOD START change access private -> protected
protected void initCHPreparationHandler() {
// ORS-GH MOD END
if (chPreparationHandler.hasCHConfigs()) {
return;
}
Expand Down Expand Up @@ -978,8 +1036,13 @@ protected void postProcessing(boolean closeEarly) {
} else {
prepareCH(closeEarly);
}
// ORS-GH MOD START add post processing hook
postProcessingHook(closeEarly);
}

protected void postProcessingHook(boolean closeEarly) {}
// ORS-GH MOD END

protected void importPublicTransit() {
}

Expand Down Expand Up @@ -1019,6 +1082,23 @@ protected WeightingFactory createWeightingFactory() {
return new DefaultWeightingFactory(ghStorage, getEncodingManager());
}

// ORS-GH MOD START - additional method
/**
* Potentially wraps the specified weighting into a TimeDependentAccessWeighting.
*/
public Weighting createTimeDependentAccessWeighting(Weighting weighting, String algo) {
FlagEncoder flagEncoder = weighting.getFlagEncoder();
if (encodingManager.hasEncodedValue(EncodingManager.getKey(flagEncoder, ConditionalEdges.ACCESS)) && isAlgorithmTimeDependent(algo))
return new TimeDependentAccessWeighting(weighting, ghStorage, flagEncoder);
else
return weighting;
}
// ORS-GH MOD END

private boolean isAlgorithmTimeDependent(String algo) {
return ("td_dijkstra".equals(algo) || "td_astar".equals(algo)) ? true : false;
}

public GHResponse route(GHRequest request) {
return createRouter().route(request);
}
Expand Down Expand Up @@ -1082,11 +1162,15 @@ private boolean isCHPrepared() {
return "true".equals(ghStorage.getProperties().get(CH.PREPARE + "done"));
}

private String getProfileVersion(String profile) {
// ORS-GH MOD START change access private -> protected
protected String getProfileVersion(String profile) {
// ORS-GH MOD END
return ghStorage.getProperties().get("graph.profiles." + profile + ".version");
}

private void setProfileVersion(String profile, int version) {
// ORS-GH MOD START change access private -> protected
protected void setProfileVersion(String profile, int version) {
// ORS-GH MOD END
ghStorage.getProperties().put("graph.profiles." + profile + ".version", version);
}

Expand Down Expand Up @@ -1223,4 +1307,4 @@ public boolean getFullyLoaded() {
public RouterConfig getRouterConfig() {
return routerConfig;
}
}
}
49 changes: 49 additions & 0 deletions core/src/main/java/com/graphhopper/coll/GHLongArrayList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to GraphHopper GmbH under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* GraphHopper GmbH licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.graphhopper.coll;

import com.carrotsearch.hppc.LongArrayList;

/**
* @author Andrzej Oles
*/
public class GHLongArrayList extends LongArrayList {
public GHLongArrayList() {
super(10);
}

public GHLongArrayList(int capacity) {
super(capacity);
}

public GHLongArrayList(GHLongArrayList list) {
super(list);
}

public final GHLongArrayList reverse() {
final long[] buffer = this.buffer;
long tmp;
for (int start = 0, end = size() - 1; start < end; start++, end--) {
// swap the values
tmp = buffer[start];
buffer[start] = buffer[end];
buffer[end] = tmp;
}
return this;
}
}
Loading
Loading