[Tile-serving] [osm2pgsql] check for empty geometries before using geohash (#291)
Sarah Hoffmann
notifications at github.com
Wed Feb 18 07:08:38 UTC 2015
> @@ -221,7 +221,9 @@ void table_t::stop()
> pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("ANALYZE %1%") % name).str());
> fprintf(stderr, "Analyzing %s finished\n", name.c_str());
>
> - pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("CREATE TABLE %1%_tmp %2% AS SELECT * FROM %3% ORDER BY ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10)") % name % (table_space ? "TABLESPACE " + table_space.get() : "") % name).str());
> + // Special handling for empty geometries because geohash chokes on
> + // empty geometries on postgis 1.5.
> + pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("CREATE TABLE %1%_tmp %2% AS SELECT * FROM %3% ORDER BY CASE WHEN ST_IsEmpty(way) THEN NULL ELSE ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10) END") % name % (table_space ? "TABLESPACE " + table_space.get() : "") % name).str());
`'empty'::geometry` results in a parse error. According to the examples in the postgis docs is has to be `'geometrycollection empty'::geometry` or `'polygon empty'::geometry`, which would be too specific.
---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/291/files#r24882423
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20150217/3245a73a/attachment.html>
More information about the Tile-serving
mailing list