The basic process is the same, but some parts need to be noted after the version update:
Postgis 3.1 only supports PostgresQL 9-12, but does not support PostgresQL 13.
2. Osm2pgsql in the new version does not need to move the deFUalt file, nor does the X64 folder, can be directly called.
Osm2pgsql -u postgres -d postgres -p 5432 -c 12000 -s "default.style File path "China -latest.osm. PBFCopy the code
3. Load postGIS object and function definition postgis. SQL and load EPSG coordinate system definition spatial_ref_sys.sql
PSQL -u postgres -d osm -f "postgis. SQL file path "PSQL -u postgres -d osm -f "spatial_ref_sys. SQL file path"Copy the code
Both are located under the root directory \share\contrib\postgis-(version)
4. If any error is reported as follows:
ERROR: The postgis extension is not enabled on the database 'osm'. Are you using the correct database? Enable with 'CREATE EXTENSION postgis; 'Copy the code
Solutions:
Log in to pgAdmin4 to find the corresponding database ‘Postges’
Right click the CREATE the EXTENSION
You can select Postgis or run the CMD command line interface. The principles are the same.
The processing results are as follows: