[Tile-serving] [osm2pgsql] check for empty geometries before using geohash (#291)
Paul Norman
notifications at github.com
Wed Feb 18 06:56:43 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());
Might st_geohash(st...(nullif(way, 'empty'::geometry)...)) work? I'm on my phone so I can't test right now.
---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/291/files#r24882106
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20150217/7bac49bd/attachment.html>
More information about the Tile-serving
mailing list