Getting scripts together to be able to translate bounding boxes from online GeoCore metadata into geoJSON files. In this script the GeoJSON available online through the catalogue (GeoCore format) translates into a Look- Up-Table to be used to guide the next scripts through translating the new table into GeoJSON with new spatial coordinates representing the bounding boxes of the layers with better representation than 4 points.
- Use your AWS credentials to log in to AWS.
- Paginate by 1000 through chosen directory (s3 bucket) and extract filenames as a list
- create a pythin list/dictionary to load filenames
- GeoJSON / Geocore: Download first (or next) URL found in metadata (GeoCore).
- DBF - LUT: Create a Look-Up-Table (LUT) with Options attributes as columns.
- Transfer Attributes: Moving attributes from GeoCore metadata to LUT.
- Complete - Transfer of metadata element complete, if yes and with no errors, repeat 1-3
- Log Errors - Transfer not complete, aborted due to errors. Log errors, then repeat 1-3
- open a S3 file returning the body of the file
- List the amount of files/rows
- Transform the Pandas Data Frame into a CSV file
- Open a S3 parquet file from bucket and filename and return the aprquet as pandas dataframe
- Output csv with changes, to be further cleaned
- clean all extraneous fields
- leave in csv format
- Clean all rows that will not be used in this process and are extraneous
- Output as excel file or DBF, DBF prefered for interoperability
- Clean table to by exported to DynamoDB for next steps
- Set current working directory
- Create a list for file names to be appended to
- use os.walk to step through directories using topdown approach.
- while stepping through directories get files to list all files that end with .shp (shapefiles)
- append to list all shapefiles including path (so path + // + shp name)
- Print the list