[Tile-serving] [openstreetmap/osm2pgsql] Use PostGIS to make sure geometries are valid (#790)

Paul Norman notifications at github.com
Sat Sep 30 04:36:39 UTC 2017


pnorman commented on this pull request.



> +                sql_conn, PGRES_COMMAND_OK,
+                (fmt("CREATE TABLE %1%_tmp %2% AS\n"
+                     "  SELECT * FROM %1%\n"
+                     "    ORDER BY ST_GeoHash(way,10)\n"
+                     "    COLLATE \"C\"") %
+                 name % (table_space ? "TABLESPACE " + table_space.get() : ""))
+                    .str());
+        } else {
+            /* osm2pgsql's transformation from 4326 to another projection could make a geometry invalid,
+               and these need to be filtered. Also, a transformation is needed for geohashing. */
+            pgsql_exec_simple(
+                sql_conn, PGRES_COMMAND_OK,
+                (fmt("CREATE TABLE %1%_tmp %2% AS\n"
+                     "  SELECT * FROM %1%\n"
+                     "    WHERE ST_IsValid(way)\n"
+                     // clang-format off

clang-format makes questionable suggestions for long strings that contain SQL. 

-- 
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/790#pullrequestreview-66304528
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20170929/475b3db9/attachment-0001.html>


More information about the Tile-serving mailing list