[Tile-serving] [openstreetmap/osm2pgsql] WIP: Add code to generalize polygons using two different strategies (PR #1830)

Paul Norman notifications at github.com
Tue Dec 13 06:48:04 UTC 2022


@pnorman requested changes on this pull request.

A few things I noticed while getting it running. Not a complete review.

- There's a bunch of hard-coded 3857 assumptions. If we're okay with these, we need to document them.

> +     {"dest-table", required_argument, nullptr, 'T'},
+     {"width", required_argument, nullptr, 'w'},
+     {"zoom", required_argument, nullptr, 'z'},
+     {"img-path", required_argument, nullptr, 200},
+     {"img-table", required_argument, nullptr, 201},
+     {"log-sql", no_argument, nullptr, 202},
+     {nullptr, 0, nullptr, 0}}};
+
+static std::array<uint32_t, 4> get_extent_from_db(pg_conn_t *connection,
+                                                  std::string const &table,
+                                                  uint32_t zoom)
+{
+    connection->query(
+        PGRES_COMMAND_OK,
+        "PREPARE get_extent AS WITH ex AS "
+        "(SELECT ST_EstimatedExtent('{}', 'geom') AS e) "

This hard-codes the geometry column to `geom`

> +        }
+
+        util::timer_t timer_overall;
+
+        log_info("osm2pgsql-gen version {}", get_osm2pgsql_version());
+        pg_conn_t conn{""};
+
+        if (params.count("expire_list")) {
+            log_info("Get tiles to reprocess from table '{}'",
+                     params["expire_list"]);
+            x = 0;
+            y = 0;
+            xmax = 0;
+            ymax = 0;
+        } else {
+            if (x == 0 && y == 0 && xmax == 0 && ymax == 0) {

Zero shouldn't be treated as a special value, because you might just want to generate the 0/0 tile.

> +
+For a full list of parameters see `osm2pgsql-gen -h`.
+
+* `-s, --strategy=STRATEGY`: Set the strategy used for generalization. Currently
+  supported are `raster-union` and `vector-union`.
+* `-m, --margin=MARGIN`: This sets the margin around the tile as a fraction of
+  the tile size. So a value of 0.1 sets a 10% boundary on each side of the tile,
+  so as a result the tiles will overlap by 20% of their size. When using the
+  `raster-union` strategy the margin will be rounded up to the nearest multiple
+  of 64 pixels.
+* `-w, --width=WIDTH`: Size of the imaged rendered when using the `raster-union`
+  strategy, not used in the `vector-union` strategy.
+* `-b, --buffer=BUFFER`: The amount by which the polygons will be buffered. For
+  the `raster-union` strategy this is in pixels, for the `vector-union` strategy
+  this is in Mercator map units.
+* `-g, --group-by-column=COL`: Set this to the column describing the type of

How are multiple columns indicated?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1830#pullrequestreview-1214784523
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/pull/1830/review/1214784523 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20221212/b670fc5c/attachment.htm>


More information about the Tile-serving mailing list