Package org.neo4j.gis.spatial.osm

Examples of org.neo4j.gis.spatial.osm.OSMDataset


  private void checkOSMAPI(Layer layer) {
    HashMap<Long, Integer> waysFound = new HashMap<Long, Integer>();
    long mostCommon = 0;
    int mostCount = 0;
    OSMDataset osm = (OSMDataset) layer.getDataset();
    Node wayNode = osm.getAllWayNodes().iterator().next();
    Way way = osm.getWayFrom(wayNode);
    System.out.println("Got first way " + way);
    for (WayPoint n : way.getWayPoints()) {
      Way w = n.getWay();
      Long wayId = w.getNode().getId();
      if (!waysFound.containsKey(wayId)) {
        waysFound.put(wayId, 0);
      }
      waysFound.put(wayId, waysFound.get(wayId) + 1);
      if (waysFound.get(wayId) > mostCount) {
        mostCommon = wayId;
      }
    }
    assertTrue("Start way should be most found way", way.equals(osm.getWayFromId(mostCommon)));
  }
View Full Code Here


  }

  public void testAnalysis2(String osm, int years, int days) throws IOException {
    SpatialDatabaseService spatial = new SpatialDatabaseService(graphDb());
    OSMLayer layer = (OSMLayer) spatial.getLayer(osm);
    OSMDataset dataset = (OSMDataset) layer.getDataset();
    Map<String, User> userIndex = new HashMap<String, User>();
    long latestTimestamp = 0L;
    long firstTimestamp = Long.MAX_VALUE;

    for (Node cNode : dataset.getAllChangesetNodes()) {
      long timestamp = (Long) cNode.getProperty("timestamp", 0L);
      Node userNode = dataset.getUser(cNode);
      String name = (String) userNode.getProperty("name");

      User user = userIndex.get(name);
      if (user == null) {
        user = new User(userNode.getId(), name);
View Full Code Here

TOP

Related Classes of org.neo4j.gis.spatial.osm.OSMDataset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.