Changeset 210
- Timestamp:
- 09/01/08 17:13:20 (3 months ago)
- Files:
-
- tools/osm2pgrouting/trunk/src/Export2DB.cpp (modified) (3 diffs)
- tools/osm2pgrouting/trunk/src/OSMDocument.cpp (modified) (1 diff)
- tools/osm2pgrouting/trunk/src/OSMDocumentParserCallback.cpp (modified) (1 diff)
- tools/osm2pgrouting/trunk/src/Way.cpp (modified) (1 diff)
- tools/osm2pgrouting/trunk/src/Way.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/osm2pgrouting/trunk/src/Export2DB.cpp
r207 r210 70 70 PGresult *result = PQexec(mycon, "CREATE TABLE nodes (ID integer PRIMARY KEY, lon decimal(11,8), lat decimal(11,8), numOfUse smallint);"); 71 71 std::cout << "Nodes table created" << std::endl; 72 result = PQexec(mycon, "CREATE TABLE ways (gid integer, class_id integer, cost double precision, name char(200), x1 double precision, y1 double precision, x2 double precision,y2double precision, PRIMARY KEY(gid)); SELECT AddGeometryColumn('ways','the_geom',4326,'MULTILINESTRING',2);");72 result = PQexec(mycon, "CREATE TABLE ways (gid integer, class_id integer, length double precision, name char(200), x1 double precision, y1 double precision, x2 double precision,y2 double precision, reverse_cost double precision,rule text, to_cost double precision, PRIMARY KEY(gid)); SELECT AddGeometryColumn('ways','the_geom',4326,'MULTILINESTRING',2);"); 73 73 std::cout << "Ways table created" << std::endl; 74 74 result = PQexec(mycon, "CREATE TABLE types (id integer, name char(200));"); … … 106 106 void Export2DB::exportWay(Way* way) 107 107 { 108 std::string query = "INSERT into ways(gid, class_id, cost, x1, y1, x2, y2, the_geom";108 std::string query = "INSERT into ways(gid, class_id, length, x1, y1, x2, y2, the_geom, reverse_cost"; 109 109 if(!way->name.empty()) 110 110 query+=", name"; … … 115 115 + boost::lexical_cast<std::string>(way->m_NodeRefs.back()->lon) + ","+ boost::lexical_cast<std::string>(way->m_NodeRefs.back()->lat) + ","; 116 116 query+="GeometryFromText('" + way->geom +"', 4326)"; 117 118 if(way->oneway) 119 { 120 query+=", "+ boost::lexical_cast<std::string>(way->length*1000000); 121 } 122 else 123 { 124 query+=", "+ boost::lexical_cast<std::string>(way->length); 125 } 126 117 127 if(!way->name.empty()) 118 128 query+=",$$"+ way->name +"$$"; 119 129 query+=");"; 120 //std::cout << query <<std::endl;130 //std::cout << query <<std::endl; 121 131 PGresult *result = PQexec(mycon, query.c_str()); 122 132 } tools/osm2pgrouting/trunk/src/OSMDocument.cpp
r206 r210 88 88 splitted_way->type=currentWay->type; 89 89 splitted_way->clss=currentWay->clss; 90 splitted_way->oneway=currentWay->oneway; 90 91 91 92 //GeometryFromText('MULTILINESTRING(('||x1||' '||y1||','||x2||' '||y2||'))',4326); tools/osm2pgrouting/trunk/src/OSMDocumentParserCallback.cpp
r198 r210 107 107 m_pActWay->name = v; 108 108 } 109 else if( m_pActWay && k.compare("oneway")==0 ) 110 { 111 m_pActWay->oneway = true; 112 std::cout<<"Edge "<<m_pActWay->id<<" is oneway"<<std::endl; 113 114 } 115 109 116 //else if( m_pActWay && k.compare("highway")==0 ) 110 117 else if( m_pActWay && m_rDocument.m_rConfig.m_Types.count(k) ) tools/osm2pgrouting/trunk/src/Way.cpp
r189 r210 30 30 id(id), 31 31 visible(visible), 32 length(0) 32 length(0), 33 oneway(false) 33 34 { 34 35 } tools/osm2pgrouting/trunk/src/Way.h
r198 r210 68 68 std::string geom; 69 69 //! length of the street 70 70 71 double length; 72 bool oneway; 73 71 74 public: 72 75 /**

