diff --git a/.gitignore b/.gitignore index da3ffed76..6acae78a3 100644 --- a/.gitignore +++ b/.gitignore @@ -201,3 +201,4 @@ ModelManifest.xml /IsraelHiking.Web/platforms /IsraelHiking.Web/plugins /IsraelHiking.Web/ul_web_hooks/android +/Graphhopper/data diff --git a/Graphhopper/docker-compose-gh-rebuild.yml b/Graphhopper/docker-compose-gh-rebuild.yml new file mode 100644 index 000000000..8b7f9ce6a --- /dev/null +++ b/Graphhopper/docker-compose-gh-rebuild.yml @@ -0,0 +1,11 @@ +version: '3.4' + +services: + graphhopper-rebuild: + image: harelmazor/graphhopper:1.0-pre33.4.7 + container_name: graphhopper-rebuild + volumes: + - ./data:/data:rw + - ./gh-config.yml:/data/gh-config.yml + entrypoint: ./graphhopper.sh + command: import asia_israel-and-palestine.pbf -c /data/gh-config.yml -fd -o /data/default-gh/ \ No newline at end of file diff --git a/Graphhopper/gh-config.yml b/Graphhopper/gh-config.yml new file mode 100644 index 000000000..2735014f9 --- /dev/null +++ b/Graphhopper/gh-config.yml @@ -0,0 +1,209 @@ +graphhopper: + + # OpenStreetMap input file PBF or XML, can be changed via command line -Ddw.graphhopper.datareader.file=some.pbf + datareader.file: "" + # Local folder used by graphhopper to store its data + graph.location: graph-cache + + ##### Vehicles ##### + + + # More options: foot,hike,bike,bike2,mtb,racingbike,motorcycle,car4wd,wheelchair (comma separated) + # bike2 takes elevation data into account (like up-hill is slower than down-hill) and requires enabling graph.elevation.provider below. + graph.flag_encoders: car4wd|block_fords=false|block_barriers=false,foot|block_fords=false,bike2|block_fords=false,car + + # Add additional information to every edge. Used for path details (#1548), better instructions (#1844) and tunnel/bridge interpolation (#798). + # Default values are: road_class,road_class_link,road_environment,max_speed,road_access (since #1805) + # More are: surface,max_width,max_height,max_weight,max_axle_load,max_length,hazmat,hazmat_tunnel,hazmat_water,toll,track_type + graph.encoded_values: road_class,road_class_link,road_environment,max_speed,road_access,track_type,surface + + ##### Routing Profiles #### + + # Routing can be done for the following list of profiles. Note that it is required to specify all the profiles you + # would like to use here. The fields of each profile are as follows: + # - name (required): a unique string identifier for the profile + # - vehicle (required): refers to the `graph.flag_encoders` used for this profile + # - weighting (required): the weighting used for this profile, e.g. fastest,shortest or short_fastest + # - turn_costs (true/false, default: false): whether or not turn restrictions should be applied for this profile. + # this will only work if the `graph.flag_encoders` for the given `vehicle` is configured with `|turn_costs=true`. + # + # Depending on the above fields there are other properties that can be used, e.g. + # - distance_factor: 0.1 (can be used to fine tune the time/distance trade-off of short_fastest weighting) + # - u_turn_costs: 60 (time-penalty for doing a u-turn in seconds (only possible when `turn_costs: true`)). + # Note that since the u-turn costs are given in seconds the weighting you use should also calculate the weight + # in seconds, so for example it does not work with shortest weighting. + # + # To prevent long running routing queries you should usually enable either speed or hybrid mode for all the given + # profiles (see below). Otherwise you should at least limit the number of `routing.max_visited_nodes`. + profiles: + - name: car4wd + vehicle: car4wd + weighting: short_fastest + - name: foot + vehicle: foot + weighting: short_fastest + - name: bike2 + vehicle: bike2 + weighting: short_fastest + - name: car + vehicle: car + weighting: short_fastest + + # - name: car_with_turn_costs + # vehicle: car + # weighting: short_fastest + # distance_factor: 0.1 + # turn_costs: true + # u_turn_costs: 60 + + # Speed mode: + # Its possible to speed up routing by doing a special graph preparation (Contraction Hierarchies, CH). This requires + # more RAM/disk space for holding the prepared graph but also means less memory usage per request. Using the following + # list you can define for which of the above routing profiles such preparation shall be performed. Note that to support + # profiles with `turn_costs: true` a more elaborate preparation is required (longer preparation time and more memory + # usage) and the routing will also be slower than with `turn_costs: false`. + profiles_ch: + - profile: car4wd + - profile: foot + - profile: bike2 + - profile: car + + # Hybrid mode: + # Similar to speed mode, the hybrid mode (Landmarks, LM) also speeds up routing by doing calculating auxiliary data + # in advance. Its not as fast as speed mode, but more flexible. + # + # Advanced usage: It is possible to use the same preparation for multiple profiles which saves memory and preparation + # time. To do this use e.g. `preparation_profile: my_other_profile` where `my_other_profile` is the name of another + # profile for which an LM profile exists. Important: This only will give correct routing results if the weights + # calculated for the profile are equal or larger (for every edge) than those calculated for the profile that was used + # for the preparation (`my_other_profile`) + profiles_lm: [] + + ##### Elevation ##### + + + # To populate your graph with elevation data use SRTM, default is noop (no elevation). Read more about it in docs/core/elevation.md + graph.elevation.provider: srtm + + + # default location for cache is /tmp/srtm + graph.elevation.cache_dir: /data/elevation-cache/ + + + # If you have a slow disk or plenty of RAM change the default MMAP to: + graph.elevation.dataaccess: RAM_STORE + + + + #### Speed, hybrid and flexible mode #### + + + # To make CH preparation faster for multiple profiles you can increase the default threads if you have enough RAM. + # Change this setting only if you know what you are doing and if the default worked for you. + # prepare.ch.threads: 1 + + # To tune the performance vs. memory usage for the hybrid mode use + # prepare.lm.landmarks: 16 + + # Make landmark preparation parallel if you have enough RAM. Change this only if you know what you are doing and if + # the default worked for you. + # prepare.lm.threads: 1 + + + # avoid being stuck in a (oneway) subnetwork, see https://discuss.graphhopper.com/t/93 + prepare.min_network_size: 200 + prepare.min_one_way_network_size: 200 + + + + ##### Routing ##### + + + # You can define the maximum visited nodes when routing. This may result in not found connections if there is no + # connection between two points within the given visited nodes. The default is Integer.MAX_VALUE. Useful for flexibility mode + # routing.max_visited_nodes: 1000000 + + + # If enabled, allows a user to run flexibility requests even if speed mode is enabled. Every request then has to include a hint ch.disable=true. + # Attention, non-CH route calculations take way more time and resources, compared to CH routing. + # A possible attacker might exploit this to slow down your service. Only enable it if you need it and with routing.maxVisitedNodes + # routing.ch.disabling_allowed: true + + + # If enabled, allows a user to run flexible mode requests even if the hybrid mode is enabled. Every such request then has to include a hint routing.lm.disable=true. + # routing.lm.disabling_allowed: true + + # Control how many active landmarks are picked per default, this can improve query performance + # routing.lm.active_landmarks: 4 + + + # You can limit the max distance between two consecutive waypoints of flexible routing requests to be less or equal + # the given distance in meter. Default is set to 1000km. + routing.non_ch.max_waypoint_distance: 1000000 + + + ##### Storage ##### + + + # configure the memory access, use RAM_STORE for well equipped servers (default and recommended) + graph.dataaccess: RAM_STORE + + + # will write way names in the preferred language (language code as defined in ISO 639-1 or ISO 639-2): + # datareader.preferred_language: en + + + # Sort the graph after import to make requests roughly ~10% faster. Note that this requires significantly more RAM on import. + # graph.do_sort: true + + + + ##### Spatial Rules ##### + # Spatial Rules require some configuration and only work with the DataFlagEncoder. + + + # Spatial Rules require you to provide Polygons in which the rules are enforced + # The line below contains the default location for the files which define these borders + # spatial_rules.borders_directory: core/files/spatialrules + + # You can define the maximum BBox for which spatial rules are loaded. + # You might want to do this if you are only importing a small area and don't need rules for other countries. + # Having less rules, might result in a smaller graph. The line below contains the world-wide bounding box, uncomment and adapt to your need. + # spatial_rules.max_bbox: -180,180,-90,90 + + +# Uncomment the following to point /maps to the source directory in the filesystem instead of +# the Java resource path. Helpful for development of the web client. +# Assumes that the web module is the working directory. +# +# assets: +# overrides: +# /maps: web/src/main/resources/assets/ + +# Dropwizard server configuration +server: + application_connectors: + - type: http + port: 8989 + # for security reasons bind to localhost + bind_host: localhost + request_log: + appenders: [] + admin_connectors: + - type: http + port: 8990 + bind_host: localhost +# See https://www.dropwizard.io/1.3.8/docs/manual/configuration.html#logging +logging: + appenders: + - type: file + time_zone: UTC + current_log_filename: logs/graphhopper.log + log_format: "%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" + archive: true + archived_log_filename_pattern: ./logs/graphhopper-%d.log.gz + archived_file_count: 30 + never_block: true + - type: console + time_zone: UTC + log_format: "%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" diff --git a/Graphhopper/refrash-graph.ps1 b/Graphhopper/refrash-graph.ps1 new file mode 100644 index 000000000..055dc1266 --- /dev/null +++ b/Graphhopper/refrash-graph.ps1 @@ -0,0 +1,9 @@ +docker rm graphhopper-rebuild +Remove-Item -Path ./data/default-gh -Recurse +docker-compose -f ./docker-compose-gh-rebuild.yml up +docker container create --name dummy -v site_ghdata:/root hello-world +cd .. +docker-compose stop graphhopper +docker cp ./Graphhopper/data/default-gh/ dummy:/root/ +docker rm dummy +docker-compose start graphhopper \ No newline at end of file diff --git a/IsraelHiking.sln b/IsraelHiking.sln index ff9d9ce2a..b9622b1ba 100644 --- a/IsraelHiking.sln +++ b/IsraelHiking.sln @@ -19,7 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore docker-compose.yml = docker-compose.yml Dockerfile = Dockerfile - gh-config.yml = gh-config.yml README.md = README.md EndProjectSection EndProject @@ -44,6 +43,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3E9EFE32-6 docs\faq.md = docs\faq.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Graphhopper", "Graphhopper", "{C5007659-0E97-48ED-8638-0622B63B5011}" + ProjectSection(SolutionItems) = preProject + Graphhopper\docker-compose-gh-rebuild.yml = Graphhopper\docker-compose-gh-rebuild.yml + Graphhopper\gh-config.yml = Graphhopper\gh-config.yml + Graphhopper\refrash-graph.ps1 = Graphhopper\refrash-graph.ps1 + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -147,6 +153,7 @@ Global {32A771F8-7A45-4359-9E22-B3CF5155C9A8} = {F72D33D1-176B-4BC5-851A-F71C1ABA74D9} {3585675D-C9A0-4E48-A11D-4B9E789A0B0A} = {F82C943F-37C1-45DF-A2CF-7EFFB9C0B467} {3E9EFE32-6A08-4960-AD00-83AC5FEAB259} = {F82C943F-37C1-45DF-A2CF-7EFFB9C0B467} + {C5007659-0E97-48ED-8638-0622B63B5011} = {F82C943F-37C1-45DF-A2CF-7EFFB9C0B467} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {82D60BA1-DDEE-4F6B-B842-56EF5620175E} diff --git a/OpenCover/OpenCover.UI.config b/OpenCover/OpenCover.UI.config deleted file mode 100644 index bbd20977e..000000000 --- a/OpenCover/OpenCover.UI.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - All - user - *.ExcludeFromCodeCoverage* - "+[*]*API* +[*]*Database* +[*]*GPSBabel* -[*]*JsonResponse* -[*]*GpxTypes* -[*]*Tests*" - - \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 795c06d7a..25eb4f753 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,14 +24,14 @@ services: - 9300:9300 restart: always graphhopper: - image: graphhopper/graphhopper + image: harelmazor/graphhopper:1.0-pre33.4.7 container_name: graphhopper volumes: - ghdata:/data:rw - - ./gh-config.yml:/data/gh-config.yml + - ./Graphhopper/gh-config.yml:/data/gh-config.yml ports: - 8989:8989 - command: asia_israel-and-palestine.pbf -c /data/gh-config.yml -fd + command: -i - -c /data/gh-config.yml -o /data/default-gh/ restart: always volumes: esdata: diff --git a/gh-config.yml b/gh-config.yml deleted file mode 100644 index df3b96ad0..000000000 --- a/gh-config.yml +++ /dev/null @@ -1,178 +0,0 @@ -graphhopper: - - # OpenStreetMap input file - #datareader.file: ./israel-and-palestine-latest.osm.pbf - - ##### Vehicles ##### - - - # More options: foot,bike,bike2,mtb,racingbike,motorcycle (comma separated) - # bike2 takes elevation data into account (like up-hill is slower than down-hill) and requires enabling graph.elevation.provider below. - graph.flag_encoders: car4wd|block_fords=false|block_barriers=false,foot|block_fords=false,bike2|block_fords=false - - # Enable turn restrictions for car or motorcycle. - # graph.flag_encoders: car|turn_costs=true - graph.bytes_for_flags: 8 - # Add additional information to every edge. Used for path details. - # If road_environment is added and elevation is enabled then also a tunnel and bridge interpolation is done, see #798. - # More options are: surface,max_width,max_height,max_weight,max_axle_load,max_length,hazmat,hazmat_tunnel,hazmat_water,toll,track_type - graph.encoded_values: road_class,road_class_link,road_environment,max_speed,road_access - - ##### Elevation ##### - - - # To populate your graph with elevation data use SRTM, default is noop (no elevation) - graph.elevation.provider: srtm - - - # default location for cache is /tmp/srtm - graph.elevation.cache_dir: ../data/elevation-cache/ - - - # If you have a slow disk or plenty of RAM change the default MMAP to: - graph.elevation.dataaccess: RAM_STORE - - - - #### Speed, hybrid and flexible mode #### - - - # By default the speed mode with the 'fastest' weighting is used. Internally a graph preparation via - # contraction hierarchies (CH) is done to speed routing up. This requires more RAM/disc space for holding the - # graph but less for every request. You can also setup multiple weightings, by providing a comma separated list. - # To enable finite u-turn costs use something like fastest|u_turn_costs=30, where 30 are the u-turn costs in seconds - # (given as integer). Note that since the u-turn costs are given in seconds the weighting you use should also - # calculate the weight in seconds. The u-turn costs will only be applied for edge_based, see below. - prepare.ch.weightings: fastest - - # Turn costs can be enabled also for speed mode (contraction hierarchies), but this requires a special kind of graph - # preparation (which uses edge- instead of node-based graph traversal), which takes more time and memory than a - # node-based preparation. You can also perform both node- and edge-based preparation for the same vehicle. This will - # allow switching between faster node-based routing and slower edge-based routing which supports turn costs. - # Using the following option you can specify what kind of preparation shall be performed for the different vehicles. - # You can choose: - # 'off': there will be no edge-based preparation for any of the vehicles, you will not be able to use turn costs - # with speed mode - # 'edge_or_node': use edge-based preparation for all vehicles with |turn_costs=true (see graph.flag_encoders) and - # node-based preparation for all others - # 'edge_and_node': use node-based preparation for all vehicles and additionally use edge-based preparation for all - # vehicles with |turn_costs=true - prepare.ch.edge_based: off - - - # Disable the speed mode. Should be used only with routing.max_visited_nodes or when the hybrid mode is enabled instead - # prepare.ch.weightings: no - - - # To make CH preparation faster for multiple flagEncoders you can increase the default threads if you have enough RAM. - # Change this setting only if you know what you are doing and if the default worked for you. - # prepare.ch.threads: 1 - - - # The hybrid mode can be enabled with - # prepare.lm.weightings: fastest - - # To tune the performance vs. memory usage for the hybrid mode use - # prepare.lm.landmarks: 16 - - # Make landmark preparation parallel if you have enough RAM. Change this only if you know what you are doing and if the default worked for you. - # prepare.lm.threads: 1 - - - # avoid being stuck in a (oneway) subnetwork, see https://discuss.graphhopper.com/t/93 - prepare.min_network_size: 200 - prepare.min_one_way_network_size: 200 - - - - ##### Routing ##### - - - # You can define the maximum visited nodes when routing. This may result in not found connections if there is no - # connection between two points within the given visited nodes. The default is Integer.MAX_VALUE. Useful for flexibility mode - # routing.max_visited_nodes: 1000000 - - - # If enabled, allows a user to run flexibility requests even if speed mode is enabled. Every request then has to include a hint ch.disable=true. - # Attention, non-CH route calculations take way more time and resources, compared to CH routing. - # A possible attacker might exploit this to slow down your service. Only enable it if you need it and with routing.maxVisitedNodes - # routing.ch.disabling_allowed: true - - - # If enabled, allows a user to run flexible mode requests even if the hybrid mode is enabled. Every such request then has to include a hint routing.lm.disable=true. - # routing.lm.disabling_allowed: true - - # Control how many active landmarks are picked per default, this can improve query performance - # routing.lm.active_landmarks: 4 - - - # You can limit the max distance between two consecutive waypoints of flexible routing requests to be less or equal - # the given distance in meter. Default is set to 1000km. - routing.non_ch.max_waypoint_distance: 1000000 - - - ##### Storage ##### - - - # configure the memory access, use RAM_STORE for well equipped servers (default and recommended) - graph.dataaccess: RAM_STORE - - - # will write way names in the preferred language (language code as defined in ISO 639-1 or ISO 639-2): - # datareader.preferred_language: en - datareader.instructions: false - - # Sort the graph after import to make requests roughly ~10% faster. Note that this requires significantly more RAM on import. - # graph.do_sort: true - - - - ##### Spatial Rules ##### - # Spatial Rules require some configuration and only work with the DataFlagEncoder. - - - # Spatial Rules require you to provide Polygons in which the rules are enforced - # The line below contains the default location for these rules - # spatial_rules.location: core/files/spatialrules/countries.geo.json - - # You can define the maximum BBox for which spatial rules are loaded. - # You might want to do this if you are only importing a small area and don't need rules for other countries. - # Having less rules, might result in a smaller graph. The line below contains the world-wide bounding box, uncomment and adapt to your need. - # spatial_rules.max_bbox: -180,180,-90,90 - - -# Uncomment the following to point /maps to the source directory in the filesystem instead of -# the Java resource path. Helpful for development of the web client. -# Assumes that the web module is the working directory. -# -# assets: -# overrides: -# /maps: web/src/main/resources/assets/ - -# Dropwizard server configuration -server: - applicationConnectors: - - type: http - port: 8989 - # for security reasons bind to localhost - bindHost: localhost - requestLog: - appenders: [] - adminConnectors: - - type: http - port: 8990 - bindHost: localhost -# See https://www.dropwizard.io/1.3.8/docs/manual/configuration.html#logging -logging: - appenders: - - type: file - timeZone: UTC - currentLogFilename: logs/graphhopper.log - logFormat: "%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" - archive: true - archivedLogFilenamePattern: ./logs/graphhopper-%d.log.gz - archivedFileCount: 30 - neverBlock: true - - type: console - timeZone: UTC - logFormat: "%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"