This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/config.hpp> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <fstream> | |
//To include the lib file from a local dir: http://stackoverflow.com/questions/15935207/adding-header-files-to-eclipse-build-path-for-c | |
#include "postgres.h" | |
#include <boost/graph/adjacency_list.hpp> | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/config.hpp> | |
#include <iostream> | |
#include "postgres.h" | |
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/iteration_macros.hpp> | |
#include <boost/graph/graph_traits.hpp> | |
#include <boost/graph/dijkstra_shortest_paths.hpp> | |
#include <boost/property_map/property_map.hpp> | |
#include <boost/graph/astar_search.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <boost/graph/adjacency_list.hpp> | |
//The obj of this struct will hold the import file data | |
typedef struct { | |
int64_t id; | |
int64_t source; | |
int64_t target; | |
} pgr_edge_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/graph/adjacency_list.hpp> | |
template <typename UndirectedGraph> | |
void undirected_graph_demo1(){ | |
/*The value of V is not imp, we need it just to pass into constructor at "UndirectedGraph undigraph(V);" to initialize it. | |
Later on we can add as many vertices as we want*/ | |
const int V = 0; | |
UndirectedGraph undigraph(V); | |
typename boost::graph_traits<UndirectedGraph>::vertex_descriptor zero, one, two; | |
typename boost::graph_traits<UndirectedGraph>::out_edge_iterator out, out_end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/graph/adjacency_list.hpp> | |
template <typename DirectedGraph> | |
void directed_graph_demo(){ | |
/*The value of V is not imp, we need it just to pass into constructor at "UndirectedGraph undigraph(V);" to initialize it. | |
Later on we can add as many vertices as we want*/ | |
const int V = 0; | |
DirectedGraph digraph(V); | |
typename boost::graph_traits<DirectedGraph>::vertex_descriptor u, v; | |
//edge_property_type Weight will be used to pass weight values for each edge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/breadth_first_search.hpp> | |
#include <boost/pending/indirect_cmp.hpp> | |
#include <boost/range/irange.hpp> | |
#include <iostream> | |
template < typename TimeMap > class bfs_time_visitor:public boost::default_bfs_visitor { | |
typedef typename boost::property_traits < TimeMap >::value_type T; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/depth_first_search.hpp> | |
#include <boost/range/irange.hpp> | |
#include <boost/pending/indirect_cmp.hpp> | |
#include <iostream> | |
template < typename TimeMap > class dfs_time_visitor:public boost::default_dfs_visitor { | |
typedef typename boost::property_traits < TimeMap >::value_type T; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/config.hpp> | |
#include <iostream> | |
#include <fstream> | |
#include <boost/graph/graph_traits.hpp> | |
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/dijkstra_shortest_paths.hpp> | |
#include <boost/property_map/property_map.hpp> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from xml.dom import minidom | |
from osgeo import ogr | |
import os, sys | |
abs_file_path = "<path_to_planet_osm_file>/planet.osm"; | |
xmldoc = minidom.parse(abs_file_path) | |
json_list = list() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from xml.dom import minidom | |
def coord(way_id): | |
abs_file_path = "/Users/zia/Documents/Test/osm_road_length_data/itu_maslak.osm"; | |
xmldoc = minidom.parse(abs_file_path) | |
way = xmldoc.getElementsByTagName("way") | |
def node_coord(node_id): | |
node = xmldoc.getElementsByTagName("node") |
OlderNewer