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

fix(fastisochrones): use correct edge filter fast-isochrones snapping #1572

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ RELEASING:
- Fix the max visited nodes bug for fast-isochrones ([#1538](https://github.com/GIScience/openrouteservice/pull/1538))
- adjust weighting of heat stress routing to avoid large detours
- fix isochrones snapping ([#1566](https://github.com/GIScience/openrouteservice/pull/1566))
- fix fast-isochrones snapping ([#1572](https://github.com/GIScience/openrouteservice/pull/1572))

## [7.1.0] - 2023-06-13
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@
import com.carrotsearch.hppc.IntHashSet;
import com.carrotsearch.hppc.IntObjectMap;
import com.carrotsearch.hppc.cursors.IntObjectCursor;
import com.graphhopper.GraphHopper;
import com.graphhopper.coll.GHIntObjectHashMap;
import com.graphhopper.routing.SPTEntry;
import com.graphhopper.routing.ev.Subnetwork;
import com.graphhopper.routing.querygraph.QueryGraph;
import com.graphhopper.routing.util.EdgeFilter;
import com.graphhopper.routing.util.HikeFlagEncoder;
import com.graphhopper.routing.util.TraversalMode;
import com.graphhopper.routing.util.*;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.storage.Graph;
import com.graphhopper.storage.GraphHopperStorage;
import com.graphhopper.storage.index.Snap;
import com.graphhopper.util.*;
import com.graphhopper.util.shapes.GHPoint3D;
import org.heigit.ors.util.ProfileTools;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.index.quadtree.Quadtree;
import org.locationtech.jts.operation.union.UnaryUnionOp;
import org.apache.log4j.Logger;
import org.heigit.ors.common.TravelRangeType;
import org.heigit.ors.exceptions.InternalServerException;
Expand Down Expand Up @@ -135,8 +139,15 @@ public IsochroneMap compute(IsochroneSearchParameters parameters) throws Excepti
Weighting weighting = ORSWeightingFactory.createIsochroneWeighting(searchcontext, parameters.getRangeType());

Coordinate loc = parameters.getLocation();

FlagEncoder encoder = searchcontext.getEncoder();
String profileName = ProfileTools.makeProfileName(encoder.toString(), weighting.getName(), false);
GraphHopper gh = searchcontext.getGraphHopper();
GraphHopperStorage graphHopperStorage = gh.getGraphHopperStorage();
EdgeFilter defaultSnapFilter = new DefaultSnapFilter(weighting, graphHopperStorage.getEncodingManager().getBooleanEncodedValue(Subnetwork.key(profileName)));

ORSEdgeFilterFactory edgeFilterFactory = new ORSEdgeFilterFactory();
EdgeFilterSequence edgeFilterSequence = getEdgeFilterSequence(edgeFilterFactory);
EdgeFilterSequence edgeFilterSequence = getEdgeFilterSequence(edgeFilterFactory, defaultSnapFilter);
Snap res = searchcontext.getGraphHopper().getLocationIndex().findClosest(loc.y, loc.x, edgeFilterSequence);
List<Snap> snaps = new ArrayList<>(1);
snaps.add(res);
Expand Down Expand Up @@ -255,9 +266,9 @@ public IsochroneMap compute(IsochroneSearchParameters parameters) throws Excepti
return isochroneMap;
}

private EdgeFilterSequence getEdgeFilterSequence(ORSEdgeFilterFactory edgeFilterFactory) throws Exception {
private EdgeFilterSequence getEdgeFilterSequence(ORSEdgeFilterFactory edgeFilterFactory, EdgeFilter prependFilter) throws Exception {
EdgeFilterSequence edgeFilterSequence = new EdgeFilterSequence();
EdgeFilter edgeFilter = edgeFilterFactory.createEdgeFilter(searchcontext.getProperties(), searchcontext.getEncoder(), searchcontext.getGraphHopper().getGraphHopperStorage());
EdgeFilter edgeFilter = edgeFilterFactory.createEdgeFilter(searchcontext.getProperties(), searchcontext.getEncoder(), searchcontext.getGraphHopper().getGraphHopperStorage(), prependFilter);
edgeFilterSequence.add(edgeFilter);
edgeFilterSequence.add(new AvoidFeaturesEdgeFilter(AvoidFeatureFlags.FERRIES, searchcontext.getGraphHopper().getGraphHopperStorage()));
return edgeFilterSequence;
Expand Down
Loading