Skip to content
Snippets Groups Projects

Update README.md - adding some more information to the steps based on the testing of the software.

1 file
+ 19
16
Compare changes
  • Side-by-side
  • Inline
+ 19
16
# Geospatial data file converter for PostgreSQL PostGIS
## How to
## How to use the Geospatial data file converter for PostgreSQL PostGIS
### Install libraries and packages
There is a Python setup required to run this software on your own computer. The best approach is to use a virtual environment. If you have a current version of Python installed you should be able to run the following commands. All of the required libraries are listed in the requirement.txt document. Please do not edit this.
> pip install virtualenv
> python<version> -m venv <virtual-environment-name>
@@ -15,26 +18,26 @@
> pip install -r requirement.txt
### Geospatial file to PostgreSQL
1. Insert a geospatial file (.geojson, .shp or .gpkg) into the directory \GeospatialFileToSQL-Input.
2. Open config.json and make any changes needed.
3. Run GeospatialFileToSQK.py.
4. SQL output file in \GeospatialFileToSQL-Output.
### How to convert a Geospatial file to a PostgreSQL PostGIS SQL dump file
1. Move or copy a geospatial file (.geojson, .shp or .gpkg) into the directory \GeospatialFileToSQL-Input. You can include multiple files if required.
2. Open config.json and make any changes needed. These are mostly around your PostgreSQL setup
3. Run GeospatialFileToSQK.py using Python
4. The generated SQL output dump file will be available in \GeospatialFileToSQL-Output. Warning - for large input files, the SQL output dump file will be large. You should use a good text editor or database client tool to open this file.
### SQL file to Geospatial file
1. Insert a SQL file into the directory \SQLToGeospatialFile-Input.
2. Input database credentials and Geospatial file type in the config.json file.
3. Run SQLToGeospatialFile.py.
4. Geospatial file output in \SQLToGeospatialFile-Output.
### How to convert a PostgreSQL PostGIS dump file to a Geospatial file
1. Move or copy a PostgreSQL PostGIS SQL dump file into the directory \SQLToGeospatialFile-Input.
2. Input database credentials and the target Geospatial file type (.geojson, .shp or .gpkg) in the config.json file.
3. Run SQLToGeospatialFile.py using Python
4. The generated Geospatial file will be available in \SQLToGeospatialFile-Output.
### Config file
1. First option is to take the first n lines from the geospatial file
2. Second option is to take a random amount of line from the geospatial file
3. JPEG output of the geospatial file.
1. `TakeFirst`: This option is to take the first n lines from the geospatial file
2. `TakeRandom`: Second option is to take a random amount of line from the geospatial file
3. `ToJPEG`: This will automatically produce a simple map as a JPEG output of the geospatial file.
4. Database connection also the SQL to run automatically on a postgres server.
5. Database credentials for the database
6. Chose file type for the SQL to Geospatial file
7. Clear output file allows for removal of all output files.
6. Choose file type for the SQL to Geospatial file (one of `shp`, `geojson`, `gpkg`)
7. `ClearOutputFile`: Clear output file allows for removal of all output files in the target directory.
Loading