Changeset 665
- Timestamp:
- 03/06/08 16:04:47 (9 months ago)
- Location:
- trunk/plugins/input/osm
- Files:
-
- 3 added
- 4 modified
-
osm_datasource.cpp (modified) (3 diffs)
-
osm_featureset.cpp (modified) (1 diff)
-
osmparser.cpp (modified) (1 diff)
-
osmtagtypes.h (added)
-
render.cpp (modified) (1 diff)
-
test2.xml (added)
-
test3.xml (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/input/osm/osm_datasource.cpp
r664 r665 28 28 #include "osm_datasource.hpp" 29 29 #include "osm_featureset.hpp" 30 #include "osmtagtypes.h" 30 31 #include <set> 31 32 … … 53 54 if (osm_data_->load(osm_filename.c_str(),parser)==false) 54 55 { 55 throw datasource_exception("Error loading OSM data"); 56 //throw datasource_exception("Error loading OSM data"); 57 return ; 56 58 } 59 60 osm_tag_types tagtypes; 61 tagtypes.add_type("maxspeed",mapnik::Integer); 62 tagtypes.add_type("z_order",mapnik::Integer); 57 63 58 64 osm_data_->rewind(); … … 63 69 // all of type String 64 70 for(std::set<std::string>::iterator i=keys.begin(); i!=keys.end(); i++) 65 desc_.add_descriptor(attribute_descriptor(*i, String));71 desc_.add_descriptor(attribute_descriptor(*i,tagtypes.get_type(*i))); 66 72 67 73 // Get the bounds of the data and set extent_ accordingly -
trunk/plugins/input/osm/osm_featureset.cpp
r664 r665 119 119 //only add if in the specified set of attribute names 120 120 if(attribute_names_.find(i->first) != attribute_names_.end()) 121 (*feature)[i->first] = tr_->transcode(i->second );121 (*feature)[i->first] = tr_->transcode(i->second.c_str()); 122 122 i++; 123 123 } -
trunk/plugins/input/osm/osmparser.cpp
r664 r665 72 72 way->id = atol((char*)xid); 73 73 cur_item = way; 74 // Prevent ways with no name being assigned a name of "0" 75 cur_item->keyvals["name"] = ""; 74 76 xmlFree(xid); 75 77 } -
trunk/plugins/input/osm/render.cpp
r664 r665 16 16 17 17 18 int main( )18 int main(int argc,char *argv[]) 19 19 { 20 if(argc < 6) 21 { 22 std::cerr<<"Usage: render XMLfile w s e n OSMfile" << std::endl; 23 exit(0); 24 } 25 20 26 datasource_cache::instance()->register_datasources 21 27 ("/usr/local/lib/mapnik/input"); 22 28 freetype_engine::register_font 23 ("/usr/local/lib/mapnik/fonts/ Vera.ttf");29 ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); 24 30 25 31 Map m (800,800); 26 load_map(m,"test.xml"); 32 load_map(m,argv[1]); 33 34 parameters p; 35 p["type"] = "osm"; 36 p["file"] = argv[6]; 37 for(int count=0; count<m.layerCount(); count++) 38 { 39 parameters q = m.getLayer(count).datasource()->params(); 40 m.getLayer(count).set_datasource(datasource_cache::instance()-> 41 create(p)); 42 } 27 43 28 Envelope<double> bbox (-1.45,50.90,-1.35,51.00); 44 Envelope<double> bbox (atof(argv[2]),atof(argv[3]), 45 atof(argv[4]),atof(argv[5])); 29 46 30 47 m.zoomToBox(bbox);
