void add_metadata_fields(gdalcpp::Layer& layer) {
     layer.add_field("version", OFTInteger, 7);
     layer.add_field("changeset", OFTInteger, 7);
     layer.add_field("timestamp", OFTString, 20);
     layer.add_field("uid", OFTInteger, 7);
     layer.add_field("user", OFTString, 256);
 }
Пример #2
0
    explicit CoastlineWaysHandler(const std::string& db_filename) :
        m_length(0.0),
        m_dataset("SQLite", db_filename, gdalcpp::SRS{}, {"SPATIALITE=TRUE", "INIT_WITH_EPSG=no" }),
        m_layer_ways(m_dataset, "ways", wkbLineString) {

        m_layer_ways.add_field("way_id", OFTString, 10);
        m_layer_ways.add_field("name",   OFTString, 100);
        m_layer_ways.add_field("source", OFTString, 255);
        m_layer_ways.add_field("bogus",  OFTString, 1);
        m_layer_ways.start_transaction();
    }
Пример #3
0
            explicit ProblemReporterOGR(gdalcpp::Dataset& dataset) :
                m_layer_perror(dataset, "perrors", wkbPoint),
                m_layer_lerror(dataset, "lerrors", wkbLineString) {

                m_layer_perror.add_field("id1", OFTReal, 10);
                m_layer_perror.add_field("id2", OFTReal, 10);
                m_layer_perror.add_field("problem_type", OFTString, 30);

                m_layer_lerror.add_field("id1", OFTReal, 10);
                m_layer_lerror.add_field("id2", OFTReal, 10);
                m_layer_lerror.add_field("problem_type", OFTString, 30);
            }
    MyOGRHandler(gdalcpp::Dataset& dataset, osmium::geom::OGRFactory<TProjection>& factory, const config& cfg) :
        m_cfg(cfg),
        m_dataset(dataset),
        m_layer_point(dataset, "points", wkbPoint, {"SPATIAL_INDEX=NO"}),
        m_layer_linestring(dataset, "lines", wkbLineString, {"SPATIAL_INDEX=NO"}),
        m_layer_multipolygon(dataset, "areas", wkbMultiPolygon, {"SPATIAL_INDEX=NO"}),
        m_factory(factory) {

        m_layer_point.add_field("id", OFTReal, 10);
        m_layer_linestring.add_field("id", OFTInteger, 7);
        m_layer_multipolygon.add_field("id", OFTInteger, 7);

        m_layer_point.add_field("tags", OFTString, max_length_tags);
        m_layer_linestring.add_field("tags", OFTString, max_length_tags);
        m_layer_multipolygon.add_field("tags", OFTString, max_length_tags);

        if (m_cfg.add_metadata) {
            add_metadata_fields(m_layer_point);
            add_metadata_fields(m_layer_linestring);
            add_metadata_fields(m_layer_multipolygon);
        }
    }
Пример #5
0
 ~CoastlineWaysHandler() {
     m_layer_ways.commit_transaction();
 }