-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move external shapefiles to tables in the DB
This adds a script that loads files into the DB based on a YAML file listing the data sources. The script can be run while rendering is going on, as it swaps old tables with new ones in a transaction. Loading is done by using ogr2ogr to load into a temporary schema, clustering, then the swap in transaction. The status of the tables is tracked in the `external_data` table, which lists the last modified date of each table. This allows the loading script to use conditional GETs and only download and update for sources which have changed.
- Loading branch information
Showing
7 changed files
with
376 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
settings: | ||
temp_schema: loading | ||
schema: public | ||
data_dir: data | ||
database: gis | ||
metadata_table: external_data | ||
sources: | ||
simplified_water_polygons: | ||
# The type of file this source is | ||
type: shp | ||
# Where to get it | ||
url: https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip | ||
# The location within the archive | ||
file: simplified-water-polygons-split-3857/simplified_water_polygons.shp | ||
archive: | ||
format: zip | ||
# Files to extract from the archive | ||
files: | ||
- simplified-water-polygons-split-3857/simplified_water_polygons.cpg | ||
- simplified-water-polygons-split-3857/simplified_water_polygons.dbf | ||
- simplified-water-polygons-split-3857/simplified_water_polygons.prj | ||
- simplified-water-polygons-split-3857/simplified_water_polygons.shp | ||
- simplified-water-polygons-split-3857/simplified_water_polygons.shx | ||
water_polygons: | ||
type: shp | ||
url: https://osmdata.openstreetmap.de/download/water-polygons-split-3857.zip | ||
file: water-polygons-split-3857/water_polygons.shp | ||
archive: | ||
format: zip | ||
files: | ||
- water-polygons-split-3857/water_polygons.cpg | ||
- water-polygons-split-3857/water_polygons.dbf | ||
- water-polygons-split-3857/water_polygons.prj | ||
- water-polygons-split-3857/water_polygons.shp | ||
- water-polygons-split-3857/water_polygons.shx | ||
icesheet_polygons: | ||
type: shp | ||
url: https://osmdata.openstreetmap.de/download/antarctica-icesheet-polygons-3857.zip | ||
file: antarctica-icesheet-polygons-3857/icesheet_polygons.shp | ||
archive: | ||
format: zip | ||
files: | ||
- antarctica-icesheet-polygons-3857/icesheet_polygons.cpg | ||
- antarctica-icesheet-polygons-3857/icesheet_polygons.dbf | ||
- antarctica-icesheet-polygons-3857/icesheet_polygons.prj | ||
- antarctica-icesheet-polygons-3857/icesheet_polygons.shp | ||
- antarctica-icesheet-polygons-3857/icesheet_polygons.shx | ||
icesheet_outlines: | ||
type: shp | ||
url: https://osmdata.openstreetmap.de/download/antarctica-icesheet-outlines-3857.zip | ||
file: antarctica-icesheet-outlines-3857/icesheet_outlines.shp | ||
ogropts: | ||
- "-explodecollections" | ||
archive: | ||
format: zip | ||
files: | ||
- antarctica-icesheet-outlines-3857/icesheet_outlines.cpg | ||
- antarctica-icesheet-outlines-3857/icesheet_outlines.dbf | ||
- antarctica-icesheet-outlines-3857/icesheet_outlines.prj | ||
- antarctica-icesheet-outlines-3857/icesheet_outlines.shp | ||
- antarctica-icesheet-outlines-3857/icesheet_outlines.shx | ||
|
||
ne_110m_admin_0_boundary_lines_land: | ||
type: shp | ||
url: http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip | ||
file: ne_110m_admin_0_boundary_lines_land.shp | ||
ogropts: &ne_opts | ||
- "--config" | ||
- "SHAPE_ENCODING" | ||
- "WINDOWS-1252" | ||
- "-explodecollections" | ||
# needs reprojecting | ||
- '-t_srs' | ||
- 'EPSG:3857' | ||
archive: | ||
format: zip | ||
files: | ||
- ne_110m_admin_0_boundary_lines_land.dbf | ||
- ne_110m_admin_0_boundary_lines_land.prj | ||
- ne_110m_admin_0_boundary_lines_land.shp | ||
- ne_110m_admin_0_boundary_lines_land.shx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.