Tabnine Logo
GraphHopperOSM
Code IndexAdd Tabnine to your IDE (free)

How to use
GraphHopperOSM
in
com.graphhopper.reader.osm

Best Java code snippets using com.graphhopper.reader.osm.GraphHopperOSM (Showing top 11 results out of 315)

origin: graphhopper/graphhopper

public static void main(String[] strs) throws Exception {
  CmdArgs args = CmdArgs.read(strs);
  GraphHopper hopper = new GraphHopperOSM().init(args).importOrLoad();
  boolean debug = args.getBool("minigraphui.debug", false);
  new MiniGraphUI(hopper, debug).visualize();
}
origin: graphhopper/graphhopper

public String getOSMFile() {
  return getDataReaderFile();
}
origin: graphhopper/graphhopper

@Override
protected DataReader createReader(GraphHopperStorage ghStorage) {
  return initDataReader(new OSMReader(ghStorage));
}
origin: graphhopper/graphhopper

public GraphHopperManaged(CmdArgs configuration, ObjectMapper objectMapper) {
  String splitAreaLocation = configuration.get(Parameters.Landmark.PREPARE + "split_area_location", "");
  JsonFeatureCollection landmarkSplittingFeatureCollection;
  try (Reader reader = splitAreaLocation.isEmpty() ? new InputStreamReader(LandmarkStorage.class.getResource("map.geo.json").openStream(), UTF_CS) : new InputStreamReader(new FileInputStream(splitAreaLocation), UTF_CS)) {
    landmarkSplittingFeatureCollection = objectMapper.readValue(reader, JsonFeatureCollection.class);
  } catch (IOException e1) {
    logger.error("Problem while reading border map GeoJSON. Skipping this.", e1);
    landmarkSplittingFeatureCollection = null;
  }
  graphHopper = new GraphHopperOSM(landmarkSplittingFeatureCollection).forServer();
  String spatialRuleLocation = configuration.get("spatial_rules.location", "");
  if (!spatialRuleLocation.isEmpty()) {
    final BBox maxBounds = BBox.parseBBoxString(configuration.get("spatial_rules.max_bbox", "-180, 180, -90, 90"));
    try (final InputStreamReader reader = new InputStreamReader(new FileInputStream(spatialRuleLocation), UTF_CS)) {
      JsonFeatureCollection jsonFeatureCollection = objectMapper.readValue(reader, JsonFeatureCollection.class);
      SpatialRuleLookupHelper.buildAndInjectSpatialRuleIntoGH(graphHopper, maxBounds, jsonFeatureCollection);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  graphHopper.init(configuration);
}
origin: cpesch/RouteConverter

if (((GraphHopperOSM)hopper).getOSMFile().equals(file.getAbsolutePath()))
  return;
hopper = new GraphHopperOSM().
    setOSMFile(file.getAbsolutePath()).
    forDesktop().
    setEncodingManager(new EncodingManager(getAvailableTravelModeNames(), BYTES_FOR_EDGE_FLAGS)).
    setCHEnabled(false).
origin: graphhopper/map-matching

count = args.getInt("count");
GraphHopper graphHopper = new GraphHopperOSM();
graphHopper.init(graphHopperConfiguration).forDesktop();
graphHopper.getCHFactoryDecorator().setEnabled(false);
origin: graphhopper/graphhopper

  @Override
  protected void loadOrPrepareLM() {
    if (!getLMFactoryDecorator().isEnabled() || getLMFactoryDecorator().getPreparations().isEmpty())
      return;

    if (landmarkSplittingFeatureCollection != null && !landmarkSplittingFeatureCollection.getFeatures().isEmpty()) {
      SpatialRuleLookup ruleLookup = SpatialRuleLookupBuilder.buildIndex(landmarkSplittingFeatureCollection, "area", new SpatialRuleLookupBuilder.SpatialRuleFactory() {
        @Override
        public SpatialRule createSpatialRule(final String id, List<Polygon> polygons) {
          return new DefaultSpatialRule() {
            @Override
            public String getId() {
              return id;
            }
          }.setBorders(polygons);
        }
      });
      for (PrepareLandmarks prep : getLMFactoryDecorator().getPreparations()) {
        // the ruleLookup splits certain areas from each other but avoids making this a permanent change so that other algorithms still can route through these regions.
        if (ruleLookup != null && ruleLookup.size() > 0) {
          prep.setSpatialRuleLookup(ruleLookup);
        }
      }
    }

    super.loadOrPrepareLM();
  }
}
origin: graphhopper/map-matching

@Override
public void run(Bootstrap<?> bootstrap, Namespace args) {
  CmdArgs graphHopperConfiguration = new CmdArgs();
  graphHopperConfiguration.put("graph.flag_encoders", args.getString("vehicle"));
  graphHopperConfiguration.put("datareader.file", args.getString("datasource"));
  graphHopperConfiguration.put("graph.location", "graph-cache");
  GraphHopper hopper = new GraphHopperOSM().init(graphHopperConfiguration);
  hopper.getCHFactoryDecorator().setEnabled(false);
  hopper.importOrLoad();
}
origin: com.rgi-corp/graphhopper-reader-osm

@Override
protected DataReader createReader(GraphHopperStorage ghStorage) {
  return initDataReader(new OSMReader(ghStorage));
}
origin: com.rgi-corp/graphhopper-reader-osm

public String getOSMFile() {
  return getDataReaderFile();
}
origin: graphhopper/map-matching

CmdArgs graphHopperConfiguration = new CmdArgs();
graphHopperConfiguration.put("graph.location", "graph-cache");
GraphHopper hopper = new GraphHopperOSM().init(graphHopperConfiguration);
hopper.getCHFactoryDecorator().setEnabled(false);
System.out.println("loading graph from cache");
com.graphhopper.reader.osmGraphHopperOSM

Javadoc

This class is the simplified entry to all functionality if you import from OpenStreetMap data.

Most used methods

  • <init>
  • getDataReaderFile
  • init
  • initDataReader
  • forDesktop
  • forServer
  • getLMFactoryDecorator
  • getOSMFile
  • importData
  • loadOrPrepareLM
  • prepareCH
  • setOSMFile
    This file can be an osm xml (.osm), a compressed xml (.osm.zip or .osm.gz) or a protobuf file (.pbf)
  • prepareCH,
  • setOSMFile

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JTable (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now