Exemple #1
0
 OGRFeature* create_line_feature(const Osmium::OSM::Way* way, OGRLayer* layer) {
     OGRFeature* feature = OGRFeature::CreateFeature(layer->GetLayerDefn());
     Osmium::Geometry::LineString linestring(*way);
     OGRLineString* ogrgeom = Osmium::Geometry::create_ogr_geometry(linestring);
     ogrgeom->transform(m_transformation);
     feature->SetGeometryDirectly(ogrgeom);
     sprintf(longint, "%ld", way->id());
     feature->SetField("osm_id", longint);
     feature->SetField("z_order", calculate_z_order(way));
     feature->SetField("way_area", 0);
     return feature;
 }
	std::unique_ptr<OGRLineString> uncompress() {
		std::unique_ptr<OGRLineString> linestring(new OGRLineString);
		linestring.get()->addPoint(first.x, first.y);
		big_coord_pair prev;
		prev.x = first.x;
		prev.y = first.y;
		for (int i=0; i<=num_points-3; i++) {
			linestring.get()->addPoint(prev.x + deltas[i].x, prev.y + deltas[i].y);
			prev.x += deltas[i].x;
			prev.y += deltas[i].y;
		}
		linestring.get()->addPoint(last.x, last.y);

		return linestring;
	}