public List<Street> createStreets(Map<String, OSMNode> nodes, 
		List<OSMWay> osmWays, boolean isDirected) {

		List<Street> streets = new ArrayList<Street>();
		
		int count = 0;
		
		// generate the streets
		for (int i = 0; i < osmWays.size(); i++) {
			OSMWay thisStreet = osmWays.get(i);
			List<String> refs = thisStreet.getRefs();
			int level = thisStreet.getLevel();

			for (int j = 1; j < refs.size(); j++) {
				String start = refs.get(j - 1);
				OSMNode startNode = nodes.get(start);
				String end = refs.get(j);
				OSMNode endNode = nodes.get(end);
				
				if (startNode == null || endNode == null) { continue; }
				
				// Calculate the distance
				double distance = GeoCalculator.calculateDistance(
					startNode.getLonLat(), endNode.getLonLat());
				
				streets.add(new Street(count, startNode, endNode, 
					distance, level));
				count++;
				
				// check whether needs to generate a directed graph or not, and
				// whether this street is one-way.
				if (isDirected && !thisStreet.oneway()) {
					streets.add(new Street(count, endNode, startNode, 
						distance, level));
					count++;
				}
				
			}
		}

		return streets;
	}