diff --git a/900913.sql b/900913.sql deleted file mode 100644 index 133099af4..000000000 --- a/900913.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)VALUES (900913,'EPSG',900913,'PROJCS["WGS84 / Simple Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS_1984", 6378137.0, 298.257223563]],PRIMEM["Greenwich", 0.0],UNIT["degree", 0.017453292519943295],AXIS["Longitude", EAST],AXIS["Latitude", NORTH]],PROJECTION["Mercator_1SP_Google"],PARAMETER["latitude_of_origin", 0.0],PARAMETER["central_meridian", 0.0],PARAMETER["scale_factor", 1.0],PARAMETER["false_easting", 0.0],PARAMETER["false_northing", 0.0],UNIT["m", 1.0],AXIS["x", EAST],AXIS["y", NORTH],AUTHORITY["EPSG","900913"]]','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs'); diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c8a113d3..ad66b8dd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,4 +258,4 @@ endif() install(TARGETS osm2pgsql DESTINATION bin) install(FILES docs/osm2pgsql.1 DESTINATION share/man/man1) -install(FILES default.style empty.style 900913.sql DESTINATION share/osm2pgsql) +install(FILES default.style empty.style DESTINATION share/osm2pgsql) diff --git a/docs/export.md b/docs/export.md index ae38dedbd..2fef1b88f 100644 --- a/docs/export.md +++ b/docs/export.md @@ -5,7 +5,7 @@ Osm2pgsql can be used in combination with [ogr2ogr](http://www.gdal.org/ogr2ogr. An example command to export to GeoJSON would be ogr2ogr -f "GeoJSON" roads.geojson -t_srs EPSG:4326 \ - PG:"dbname=gis" -s_srs EPSG:900913 \ + PG:"dbname=gis" -s_srs EPSG:3857 \ -sql "SELECT name,highway,oneway,toll,way FROM planet_osm_line WHERE highway IS NOT NULL" Care should be taken if exporting to shapefiles, as characters may be present diff --git a/docs/migrations.md b/docs/migrations.md index af1c70a30..0aa0fb6c9 100644 --- a/docs/migrations.md +++ b/docs/migrations.md @@ -4,6 +4,22 @@ Some osm2pgsql changes have slightly changed the database schema it expects. If updating an old database, a migration may be needed. The migrations here assume the default `planet_osm` prefix. +It is frequently better to reimport as this will also recluster the tables and +remove table or index bloat. + +## 0.91 default projection ## + +The default projection was moved from 900913 to 3857. This does not effect +users using `-l` or `-E`, but if using no projection options or `-m` a +migration is needed. + +```sql +ALTER TABLE planet_osm_roads ALTER COLUMN way TYPE geometry(LineString,3857) USING ST_SetSRID(way,3857); +ALTER TABLE planet_osm_point ALTER COLUMN way TYPE geometry(Point,3857) USING ST_SetSRID(way,3857); +ALTER TABLE planet_osm_line ALTER COLUMN way TYPE geometry(LineString,3857) USING ST_SetSRID(way,3857); +ALTER TABLE planet_osm_polygon ALTER COLUMN way TYPE geometry(Geometry,3857) USING ST_SetSRID(way,3857); +``` + ## 0.88.0 z_order changes ## 0.88.0 z_order logic was changed, requuiring an increase in z_order values. To diff --git a/docs/osm2pgsql.1 b/docs/osm2pgsql.1 index b2b5ea1cf..ed73eeb49 100644 --- a/docs/osm2pgsql.1 +++ b/docs/osm2pgsql.1 @@ -1,4 +1,4 @@ -.TH OSM2PGSQL 1 "April 06, 2013" +.TH OSM2PGSQL 1 "February 27, 2016" .\" Please adjust this date whenever revising the manpage. .SH NAME osm2pgsql \- Openstreetmap data to PostgreSQL converter. @@ -241,7 +241,7 @@ Verbose output. .SH SUPPORTED PROJECTIONS Latlong (\-l) SRS: 4326 (none) .br -Spherical Mercator (\-m) SRS:900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over +Spherical Mercator (\-m) SRS:3857 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over .br EPSG-defined (\-E) SRS: +init=epsg:(as given in parameter) .PP diff --git a/reprojection.cpp b/reprojection.cpp index 3dd7f489a..3ccd159dd 100644 --- a/reprojection.cpp +++ b/reprojection.cpp @@ -53,7 +53,7 @@ class merc_reprojection_t : public reprojection public: osmium::geom::Coordinates reproject(osmium::Location loc) const override { - /* The latitude co-ordinate is clipped at slightly larger than the 900913 'world' + /* The latitude co-ordinate is clipped at slightly larger than the 3857 'world' * extent of +-85.0511 degrees to ensure that the points appear just outside the * edge of the map. */ double lat = loc.lat_without_check(); diff --git a/reprojection.hpp b/reprojection.hpp index 8b59ff661..c0609dfd9 100644 --- a/reprojection.hpp +++ b/reprojection.hpp @@ -13,7 +13,7 @@ #include #include -enum Projection { PROJ_LATLONG = 4326, PROJ_SPHERE_MERC = 900913 }; +enum Projection { PROJ_LATLONG = 4326, PROJ_SPHERE_MERC = 3857 }; class reprojection : public boost::noncopyable { diff --git a/tests/test-output-pgsql.cpp b/tests/test-output-pgsql.cpp index 5f7ba757a..d324ea9ad 100644 --- a/tests/test-output-pgsql.cpp +++ b/tests/test-output-pgsql.cpp @@ -101,7 +101,7 @@ void test_regression_simple() { db->check_number(143.81, "SELECT ST_Area(ST_Transform(way,4326)::geography) FROM osm2pgsql_test_polygon WHERE osm_id = 157261342"); // Check a point's location - db->check_count(1, "SELECT count(*) FROM osm2pgsql_test_point WHERE ST_DWithin(way, 'SRID=900913;POINT(1062645.12 5972593.4)'::geometry, 0.1)"); + db->check_count(1, "SELECT count(*) FROM osm2pgsql_test_point WHERE ST_DWithin(way, 'SRID=3857;POINT(1062645.12 5972593.4)'::geometry, 0.1)"); } void test_latlong() {