[Tile-serving] [openstreetmap/osm2pgsql] ERROR: Geometry SRID (3857) does not match column SRID (900913) (#869)

Frederik Ramm notifications at github.com
Mon Sep 24 10:02:26 UTC 2018


Not necessarily, but osm2pgsql does *sometimes* change in ways that are incompatible with old setups. Hence why I was asking whether you had updated (and ideally, from what version to what version). 

It is likely cleanest to do a full reload. (If your data is older than a month or so, you won't be able to efficiently update it anyway.) However, you can change the projection of your existing database by executing these steps:

     ALTER TABLE planet_osm_polygon ALTER COLUMN way TYPE geometry(Geometry);
     ALTER TABLE planet_osm_roads ALTER COLUMN way TYPE geometry(LineString);
     ALTER TABLE planet_osm_line ALTER COLUMN way TYPE geometry(LineString);
     ALTER TABLE planet_osm_roads ALTER COLUMN way TYPE geometry(Point);

     UPDATE planet_osm_polygon SET way = ST_SETSRID(way, 3857);
     UPDATE planet_osm_roads SET way = ST_SETSRID(way, 3857);
     UPDATE planet_osm_line SET way = ST_SETSRID(way, 3857);
     UPDATE planet_osm_point SET way = ST_SETSRID(way, 3857);

     ALTER TABLE planet_osm_polygon ALTER COLUMN way TYPE geometry(Geometry, 3857);
     ALTER TABLE planet_osm_roads ALTER COLUMN way TYPE geometry(LineString, 3857);
     ALTER TABLE planet_osm_line ALTER COLUMN way TYPE geometry(LineString, 3857);
     ALTER TABLE planet_osm_roads ALTER COLUMN way TYPE geometry(Point, 3857);

The first block removes the 900913 type specification from the column, the second updates the geometries, the third adds a specification for 3857. Projections 900913 and 3857 are identical, they just have different names.

-- 
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/issues/869#issuecomment-423927009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20180924/1c907cb6/attachment-0001.html>


More information about the Tile-serving mailing list