Changeset 665

Show
Ignore:
Timestamp:
03/06/08 16:04:47 (9 months ago)
Author:
nickw
Message:

Fixed for unicode change post 0.5

Location:
trunk/plugins/input/osm
Files:
3 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/input/osm/osm_datasource.cpp

    r664 r665  
    2828#include "osm_datasource.hpp" 
    2929#include "osm_featureset.hpp" 
     30#include "osmtagtypes.h" 
    3031#include <set> 
    3132 
     
    5354        if (osm_data_->load(osm_filename.c_str(),parser)==false) 
    5455        { 
    55                 throw datasource_exception("Error loading OSM data"); 
     56                //throw datasource_exception("Error loading OSM data"); 
     57                return ; 
    5658        }        
     59 
     60        osm_tag_types tagtypes; 
     61        tagtypes.add_type("maxspeed",mapnik::Integer); 
     62        tagtypes.add_type("z_order",mapnik::Integer); 
    5763 
    5864        osm_data_->rewind(); 
     
    6369        // all of type String 
    6470        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))); 
    6672 
    6773        // Get the bounds of the data and set extent_ accordingly 
  • trunk/plugins/input/osm/osm_featureset.cpp

    r664 r665  
    119119                                //only add if in the specified set of attribute names 
    120120                                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()); 
    122122                                i++; 
    123123                        } 
  • trunk/plugins/input/osm/osmparser.cpp

    r664 r665  
    7272                        way->id = atol((char*)xid);  
    7373                        cur_item  =  way;  
     74                        // Prevent ways with no name being assigned a name of "0" 
     75                        cur_item->keyvals["name"] = "";  
    7476                        xmlFree(xid); 
    7577                } 
  • trunk/plugins/input/osm/render.cpp

    r664 r665  
    1616 
    1717 
    18 int main() 
     18int main(int argc,char *argv[]) 
    1919{ 
     20        if(argc < 6) 
     21        { 
     22                std::cerr<<"Usage: render XMLfile w s e n OSMfile" << std::endl; 
     23                exit(0); 
     24        } 
     25 
    2026        datasource_cache::instance()->register_datasources 
    2127                ("/usr/local/lib/mapnik/input"); 
    2228        freetype_engine::register_font 
    23                 ("/usr/local/lib/mapnik/fonts/Vera.ttf"); 
     29                ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); 
    2430 
    2531        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        } 
    2743 
    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])); 
    2946                                                                                 
    3047        m.zoomToBox(bbox);