com.graphhopper

Class GraphHopper

    • Constructor Detail

      • GraphHopper

        public GraphHopper()
    • Method Detail

      • setEncodingManager

        public GraphHopper setEncodingManager(EncodingManager em)
        Specify which vehicles can be read by this GraphHopper instance. An encoding manager defines how data from every vehicle is written (und read) into edges of the graph.
      • getWorkerThreads

        protected int getWorkerThreads()
        Threads for data reading.
      • getWayPointMaxDistance

        protected double getWayPointMaxDistance()
        Return maximum distance (in meter) to reduce points via douglas peucker while OSM import.
      • setWayPointMaxDistance

        public GraphHopper setWayPointMaxDistance(double wayPointMaxDistance)
        This parameter specifies how to reduce points via douglas peucker while OSM import. Higher value means more details, unit is meter. Default is 1. Disable via 0.
      • setTraversalMode

        public GraphHopper setTraversalMode(TraversalMode traversalMode)
        Sets the default traversal mode used for the algorithms and preparation.
      • forServer

        public GraphHopper forServer()
        Configures the underlying storage and response to be used on a well equipped server. Result also optimized for usage in the web module i.e. try reduce network IO.
      • forDesktop

        public GraphHopper forDesktop()
        Configures the underlying storage to be used on a Desktop computer or within another Java application with enough RAM but no network latency.
      • forMobile

        public GraphHopper forMobile()
        Configures the underlying storage to be used on a less powerful machine like Android or Raspberry Pi with only few MB of RAM.
      • setPreciseIndexResolution

        public GraphHopper setPreciseIndexResolution(int precision)
        Precise location resolution index means also more space (disc/RAM) could be consumed and probably slower query times, which would be e.g. not suitable for Android. The resolution specifies the tile width (in meter).
      • setMinNetworkSize

        public GraphHopper setMinNetworkSize(int minNetworkSize,                                     int minOneWayNetworkSize)
      • setInMemory

        public GraphHopper setInMemory()
        This method call results in an in-memory graph.
      • setStoreOnFlush

        public GraphHopper setStoreOnFlush(boolean storeOnFlush)
        Only valid option for in-memory graph and if you e.g. want to disable store on flush for unit tests. Specify storeOnFlush to true if you want that existing data will be loaded FROM disc and all in-memory data will be flushed TO disc after flush is called e.g. while OSM import.
        Parameters:
        storeOnFlush - true by default
      • setMemoryMapped

        public GraphHopper setMemoryMapped()
        Enable memory mapped configuration if not enough memory is available on the target platform.
      • setCHWeightings

        public GraphHopper setCHWeightings(String... weightingNames)
        Deprecated. Use getCHFactoryDecorator().setWeightingsAsStrings() instead. Will be removed in 0.8.
        Wrapper method for setCHWeightings(List)
      • setCHWeightings

        public GraphHopper setCHWeightings(List<String> weightingList)
        Deprecated. Use getCHFactoryDecorator().setWeightingsAsStrings() instead. Will be removed in 0.8.
        Enables the use of contraction hierarchies to reduce query times. Enabled by default.
        Parameters:
        weightingList - A list containing multiple weightings like: "fastest", "shortest" or your own weight-calculation type.
      • getCHWeightings

        public List<String> getCHWeightings()
        Deprecated. Use getCHFactoryDecorator().getWeightingsAsStrings() instead. Will be removed in 0.8.
        Returns all CHWeighting names
      • setCHPrepareThreads

        public GraphHopper setCHPrepareThreads(int prepareThreads)
        Deprecated. Use getCHFactoryDecorator().setCHPrepareThreads() instead. Will be removed in 0.8.
        This method changes the number of threads used for preparation on import. Default is 1. Make sure that you have enough memory to increase this number!
      • getCHPrepareThreads

        public int getCHPrepareThreads()
        Deprecated. Use getCHFactoryDecorator().getCHPrepareThreads() instead. Will be removed in 0.8.
      • setCHEnable

        public GraphHopper setCHEnable(boolean enable)
        Deprecated. Use setEnabled() instead. Will be removed in 0.8.
      • setCHEnabled

        public GraphHopper setCHEnabled(boolean enable)
        Enables or disables contraction hierarchies (CH). This speed-up mode is enabled by default.
      • isCHEnabled

        public final boolean isCHEnabled()
      • setMaxVisitedNodes

        public void setMaxVisitedNodes(int maxVisitedNodes)
        This methods stops the algorithm from searching further if the resulting path would go over the specified node count, important if CH is disabled.
      • hasElevation

        public boolean hasElevation()
        Returns:
        true if storing and fetching elevation data is enabled. Default is false
      • setElevation

        public GraphHopper setElevation(boolean includeElevation)
        Enable storing and fetching elevation data. Default is false
      • setEnableInstructions

        public GraphHopper setEnableInstructions(boolean b)
        This method specifies if the import should include way names to be able to return instructions for a route.
      • setPreferredLanguage

        public GraphHopper setPreferredLanguage(String preferredLanguage)
        This method specifies the preferred language for way names during import.

        Language code as defined in ISO 639-1 or ISO 639-2.

        • If no preferred language is specified, only the default language with no tag will be imported.
        • If a language is specified, it will be imported if its tag is found, otherwise fall back to default language.

      • getPreferredLanguage

        public String getPreferredLanguage()
      • setEnableCalcPoints

        public GraphHopper setEnableCalcPoints(boolean b)
        This methods enables gps point calculation. If disabled only distance will be calculated.
      • setGraphHopperLocation

        public GraphHopper setGraphHopperLocation(String ghLocation)
        Sets the graphhopper folder.
      • getGraphHopperLocation

        public String getGraphHopperLocation()
      • setOSMFile

        public GraphHopper setOSMFile(String osmFileStr)
        This file can be an osm xml (.osm), a compressed xml (.osm.zip or .osm.gz) or a protobuf file (.pbf).
      • getOSMFile

        public String getOSMFile()
      • setLocationIndex

        protected void setLocationIndex(LocationIndex locationIndex)
      • setSortGraph

        public GraphHopper setSortGraph(boolean sortGraph)
        Sorts the graph which requires more RAM while import. See #12
      • setAllowWrites

        public GraphHopper setAllowWrites(boolean allowWrites)
        Specifies if it is allowed for GraphHopper to write. E.g. for read only filesystems it is not possible to create a lock file and so we can avoid write locks.
      • isAllowWrites

        public boolean isAllowWrites()
      • init

        public GraphHopper init(CmdArgs args)
        Reads configuration from a CmdArgs object. Which can be manually filled, or via main(String[] args) ala CmdArgs.read(args) or via configuration file ala CmdArgs.readFromConfig("config.properties", "graphhopper.config")
      • importOrLoad

        public GraphHopper importOrLoad()
        Imports provided data from disc and creates graph. Depending on the settings the resulting graph will be stored to disc so on a second call this method will only load the graph from disc which is usually a lot faster.
      • load

        public boolean load(String graphHopperFolder)
        Opens existing graph.
        Specified by:
        load in interface GraphHopperAPI
        Parameters:
        graphHopperFolder - is the folder containing graphhopper files. Can be a compressed file too ala folder-content.ghz.
        Returns:
        true if successfully connected or loaded
      • createCHPreparations

        protected void createCHPreparations()
        Deprecated. use getCHFactoryDecorator().createPreparations() instead. Will be removed in 0.8.
        This method creates prepations.
      • postProcessing

        protected void postProcessing()
        Does the preparation and creates the location index
      • createWeighting

        public Weighting createWeighting(HintsMap weightingMap,                                 FlagEncoder encoder)
        Based on the weightingParameters and the specified vehicle a Weighting instance can be created. Note that all URL parameters are available in the weightingParameters as String if you use the GraphHopper Web module.
        Parameters:
        weightingMap - all parameters influencing the weighting. E.g. parameters coming via GHRequest.getHints or directly via "&api.xy=" from the URL of the web UI
        encoder - the required vehicle
        Returns:
        the weighting to be used for route calculation
        See Also:
        HintsMap
      • route

        public GHResponse route(GHRequest request)
        Description copied from interface: GraphHopperAPI
        Calculates the path from specified request visiting the specified locations.

        Specified by:
        route in interface GraphHopperAPI
        Returns:
        the response with the route and possible errors
      • initLocationIndex

        protected void initLocationIndex()
        Initializes the location index after the import is done.
      • prepare

        protected void prepare()
      • cleanUp

        protected void cleanUp()
        Internal method to clean up the graph.
      • flush

        protected void flush()
      • close

        public void close()
        Releases all associated resources like memory or files. But it does not remove them. To remove the files created in graphhopperLocation you have to call clean().
      • clean

        public void clean()
        Removes the on-disc routing files. Call only after calling close or before importOrLoad or load
      • ensureNotLoaded

        protected void ensureNotLoaded()
      • ensureWriteAccess

        protected void ensureWriteAccess()

Copyright © 2012–2016. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14