Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

simplified water polygons and ST_GeoHash() #22

Open
imagico opened this issue May 1, 2018 · 2 comments
Open

simplified water polygons and ST_GeoHash() #22

imagico opened this issue May 1, 2018 · 2 comments
Labels
vector Issues relating to the vector tile generation

Comments

@imagico
Copy link

imagico commented May 1, 2018

running get-external-data.py i get:

Traceback (most recent call last):
  File "./get-external-data.py", line 225, in <module>
    main()
  File "./get-external-data.py", line 219, in main
    this_table.index()
  File "./get-external-data.py", line 81, in index
    '''.format(name=self._name, temp_schema=self._temp_schema))
psycopg2.InternalError: Geohash requires inputs in decimal degrees, got (-180 -85.0511, -180 -85).

This is due to the code using ST_GeoHash() for indexing and clustering which requires transforming coordinates back into geographic which the simplified water polygons are not suited for - see gravitystorm/openstreetmap-carto#2101 which is essentially due to the same problem.

You can work around this by clipping the data before or after the import into PostGIS but generally using ST_GeoHash() in this context for proximity ordering of geometries is a bad idea - because map rendering should not depend on transforming coordinates into geographic, in particular transforming a bounding box in projected coordinates into geographic cannot generally be expected to produce a meaningful geometry. And even if that is not a problem (unmodified OSM data, rendering in Mercator) ST_GeoHash() is not a good solution for this problem - see:

https://en.wikipedia.org/wiki/Geohash#Limitations_when_used_for_deciding_proximity

Using what ST_GeoHash() does but in projected coordinates (which PostGIS does not allow at the moment) would probably be a suitable generic method.

Yes, this is probably outside the scope here but wanted to mention it none the less.

@pnorman
Copy link
Owner

pnorman commented May 5, 2018

I wonder why you're hitting that error but I'm not.

I'm using GeoHash for ordering, not modifying a geometry and saving the modified geometry. A GeoHash ordering does significantly better than a way ordering, or clustering on a gist index on geom.

@pnorman pnorman added the vector Issues relating to the vector tile generation label Feb 25, 2019
@pnorman
Copy link
Owner

pnorman commented Mar 1, 2019

What does SELECT postgis_full_version(); report, and can you still reproduce this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
vector Issues relating to the vector tile generation
Projects
None yet
Development

No branches or pull requests

2 participants