Skip to content

Commit c011859

Browse files
committed
Switch from using text ids to 64bit integer ids
Waaaay back GDAL didn't support 64 bit ids, so we used text fields instead. But that has been fixed long ago, so we should be able to use them now.
1 parent aecd3f1 commit c011859

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/output_database.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ OutputDatabase::OutputDatabase(const std::string& driver, const std::string& out
5050
m_layer_water_polygons(m_dataset, "water_polygons", wkbPolygon, layer_options()),
5151
m_layer_lines(m_dataset, "lines", wkbLineString, layer_options()) {
5252

53-
m_layer_error_points.add_field("osm_id", OFTString, 11);
53+
m_layer_error_points.add_field("osm_id", OFTInteger64, 1);
5454
m_layer_error_points.add_field("error", OFTString, 16);
5555

56-
m_layer_error_lines.add_field("osm_id", OFTString, 11);
56+
m_layer_error_lines.add_field("osm_id", OFTInteger64, 1);
5757
m_layer_error_lines.add_field("error", OFTString, 16);
5858

59-
m_layer_rings.add_field("osm_id", OFTString, 11);
59+
m_layer_rings.add_field("osm_id", OFTInteger64, 1);
6060
m_layer_rings.add_field("nways", OFTInteger, 6);
6161
m_layer_rings.add_field("npoints", OFTInteger, 8);
6262
m_layer_rings.add_field("fixed", OFTInteger, 1);
@@ -149,15 +149,15 @@ void OutputDatabase::commit() {
149149
void OutputDatabase::add_error_point(std::unique_ptr<OGRPoint>&& point, const char* error, osmium::object_id_type id) {
150150
m_srs.transform(point.get());
151151
gdalcpp::Feature feature{m_layer_error_points, std::move(point)};
152-
feature.set_field("osm_id", std::to_string(id).c_str());
152+
feature.set_field("osm_id", static_cast<GIntBig>(id));
153153
feature.set_field("error", error);
154154
feature.add_to_layer();
155155
}
156156

157157
void OutputDatabase::add_error_line(std::unique_ptr<OGRLineString>&& linestring, const char* error, osmium::object_id_type id) {
158158
m_srs.transform(linestring.get());
159159
gdalcpp::Feature feature{m_layer_error_lines, std::move(linestring)};
160-
feature.set_field("osm_id", std::to_string(id).c_str());
160+
feature.set_field("osm_id", static_cast<GIntBig>(id));
161161
feature.set_field("error", error);
162162
feature.add_to_layer();
163163
}
@@ -211,7 +211,7 @@ void OutputDatabase::add_ring(std::unique_ptr<OGRPolygon>&& polygon, osmium::obj
211211
}
212212

213213
gdalcpp::Feature feature{m_layer_rings, std::move(polygon)};
214-
feature.set_field("osm_id", static_cast<int>(osm_id));
214+
feature.set_field("osm_id", static_cast<GIntBig>(osm_id));
215215
feature.set_field("nways", static_cast<int>(nways));
216216
feature.set_field("npoints", static_cast<int>(npoints));
217217
feature.set_field("fixed", fixed);

0 commit comments

Comments
 (0)