<p></p>
<p><b>@lonvia</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1277#discussion_r499549053">flex-config/geometries.lua</a>:</p>
<pre style='color:#555'>>      { column = 'geom', type = 'point' },
 })
 
 tables.ways = osm2pgsql.define_way_table('ways', {
     { column = 'tags', type = 'hstore' },
-    { column = 'geom', type = 'linestring' },
+    -- Create a geometry column for linestring geometries. The geometry will
+    -- be in latlong (WGS84), EPSG 3857.
</pre>
<p>3857 -> 4326</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1277#discussion_r499576233">src/flex-table-column.hpp</a>:</p>
<pre style='color:#555'>>      std::string sql_modifiers() const;
-    std::string sql_create(int srid) const;
+    std::string sql_create() const;
+
+    int srid() const noexcept { return m_srid; }
+
+    std::shared_ptr<reprojection> projection() const
</pre>
<p>Function looks unused.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1277#discussion_r499579759">src/osmium-builder.hpp</a>:</p>
<pre style='color:#555'>> @@ -24,6 +24,8 @@ class osmium_builder_t
       m_writer(m_proj->target_srs())
     {}
 
+    int srid() const noexcept { return m_proj->target_srs(); }
</pre>
<p>Function unused?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1277#discussion_r499582332">src/output-flex.cpp</a>:</p>
<pre style='color:#555'>>                  double const area =
-                    get_options()->reproject_area
-                        ? ewkb::parser_t(geom).get_area<reprojection>(
-                              get_options()->projection.get())
-                        : ewkb::parser_t(geom)
-                              .get_area<osmium::geom::IdentityProjection>();
+                    column.srid() == srid
+                        ? ewkb::parser_t(geom)
+                              .get_area<osmium::geom::IdentityProjection>()
+                        : ewkb::parser_t(geom).get_area<reprojection>(
+                              reprojection::create_projection(srid).get());
</pre>
<p>This looks rather expensive. You create (as in allocate) a reprojection object every time a row is written.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1277#pullrequestreview-501987985">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353SK45OWO2LGGQCNS7TSJHAOVANCNFSM4SADFGBQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353SIX3KTWYNFZY2647LSJHAOVA5CNFSM4SADFGB2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODXV3VEI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1277#pullrequestreview-501987985",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1277#pullrequestreview-501987985",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>