Skip to content

Support fords - #320

Closed
florent-morel wants to merge 6 commits into
graphhopper:masterfrom
florent-morel:supportFords
Closed

florent-morel wants to merge 6 commits into
graphhopper:masterfrom
florent-morel:supportFords

Conversation

@florent-morel

Copy link
Copy Markdown

PR for ford support.
During graph creation, I check config.properties for FlagEncoder allowing crossing fords.

To enable ford crossing for a given FlagEncoder, amend config.properties with:
graph.flagEncoders.supportFord=foot

As for graph.flagEncoders, possible options are: car,foot,bike,bike2,mtb,racingbike,motorcycle (comma separated). A non-existing value will throw an Exception.

Note
I'm building a Map<String, FlagEncoder> mapEncoder to iterate over instantiated FlagEncoder to set BlockFords to false. Not sure the map is the most efficient way though, any suggestion?

Could you check this PR please?
Florent.

@karussell

Copy link
Copy Markdown
Member

Thanks! I'll integrate the tests and your additional check.

But regarding the configuration: I do not see a reason to make it that complex. If you need a special setting why not do:

hopper.setEncodingManager(new SomeEncoder().setBlockFords(true|false))

?

I would avoid to add a new method to FlagEncoder for every possible configuration, especially as this ford settings could potentially be different per country. One alternative could be to use a similar configuration schema per encoder like we already do for turnCosts:

parseBoolean(propertiesStr, "turnCosts", false)

@florent-morel

Copy link
Copy Markdown
Author

Hi,
I changed the way the configuration is read and used a "turnCosts" approach.

We can now use:
graph.flagEncoders=car,foot|allowFords=true

I used boolean in AbstractFlagEncoder, as I'm not sure why there is int for turnCosts.
Could you please explain?

@karussell

Copy link
Copy Markdown
Member

Thanks!

Some minor things: Instead of creating an additional parameter in the AbstractFlagEncoder constructor just set the variable within the 'string'-constructors:

this(bla, blup);
this.setBlockFords(parseBoolean(propertiesStr, "blockFords", false))

and either use blockFords as variable AND as configuration option or allowFords for both. Also remove setBlockFords and isBlockFords methods from the FlagEncoder interface. These should stay just public or even better protected methods in AbstractFlagEncoder.

Replacing "allowFords=true" by "blockFords=false" in config.properties
to align with variable.
@florent-morel

Copy link
Copy Markdown
Author

Hi,

I'm not sure why the build failed on openjdk7 (1044.1). The other 2 and my local build went fine.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project graphhopper: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Could not transfer artifact commons-lang:commons-lang:jar:2.1 from/to central (https://repo.maven.apache.org/maven2): GET request of: commons-lang/commons-lang/2.1/commons-lang-2.1.jar from central failed: Connection reset -> [Help 1]

Could you launch the build again manually to check if it was a temporary issue?

Regards,
Florent.

@karussell

Copy link
Copy Markdown
Member

Thanks! This is important as I've seen this before and needed an example for travis-ci/travis-ci#3160 :)

@karussell karussell closed this in 35add0c Mar 23, 2015
dabiih pushed a commit to dabiih/graphhopper that referenced this pull request Jan 7, 2025
…raphhopper#316)

* initial version

* custom model is kept even when switching back and forth between desktop and mobile size

* fix bug when mobile view is changed to compact view and no new route is calculated because of an invalid custom model due to missing encoded values (recreation of CustomModelBox without the previously expected /info endpoint being called)

* move CustomModelBox into SettingsBox but outside of settingsTable

* minor -> warn

* minor css fix

* make settings css better fit the rest

* 1. URL with custom_model should trigger a routing request with it; 2. avoid route re-calculation if settings box is shown; 3. invalid custom model is reset to custom model before if settings box is closed

* tricky to fix error 'Cannot use import statement outside a module' in tests: 1. insist on transpiling custom model editor code to avoid ES6 modules for jest and 2. allowJs in tsconfig and 3. explicitly transform js files using ts-jest - why?

* remove CustomModel from QueryStore state

* formatting

* revert change with SettingsContext to use ShowDistanceInMilesContext

* format and clean up imports

* show error message if invalid custom model (not possible at Settings construction time)

* not many benefits to use validateJson as e.g. encoded values not yet known

* revert commit 96108d7e07af7811bdf908d32b8fc4f6804c3e89

* remove TODO NOW

* Use string to represent custom model state (graphhopper#320)

* Move custom model examples to separate file

* Minor rename

* Extract custom model area function

* Remove openSettingsHandle

* Rename custom model examples file

* Remove warning that can never occur

* Move state from settings to query store, query store even depended on settings..

* minor

* move custom model box out of settings

* oops, made a mistake

* Use string to represent custom model state!

* much better

* add todos

* Rename action

* no shadow, use text instead

* i18n: update

* separate custom model box and settings box and use gear as indicator instead of shadow

* format

---------

Co-authored-by: easbar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants