[Tile-serving] [openstreetmap/osm2pgsql] Set projection in flex output in column config (#1277)

Sarah Hoffmann notifications at github.com
Mon Oct 5 13:08:58 UTC 2020


@lonvia commented on this pull request.



>      { 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.

3857 -> 4326

>      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

Function looks unused.

> @@ -24,6 +24,8 @@ class osmium_builder_t
       m_writer(m_proj->target_srs())
     {}
 
+    int srid() const noexcept { return m_proj->target_srs(); }

Function unused?

>                  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());

This looks rather expensive. You create (as in allocate) a reprojection object every time a row is written.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1277#pullrequestreview-501987985
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201005/e00b7a36/attachment.htm>


More information about the Tile-serving mailing list