| 1 |
# UK Ordnance Survey Mastermap GML to PostGIS |
| 2 |
|
| 3 |
This example is a proof of concept to load UK Ordnance Survey Mastermap GML into PostGIS using |
| 4 |
Astun Technology Loader config and GML manipulation unaltered. |
| 5 |
|
| 6 |
A small sample of UK Mastermap data has been extracted from |
| 7 |
a sample download provided by Ordnance Survey. The full file has also been |
| 8 |
sucessfully loaded and is called: `58116-SX9192-2c1.gml`. |
| 9 |
|
| 10 |
Files: |
| 11 |
|
| 12 |
- `input/osmm-topo-small.gml` the input file |
| 13 |
- stetl config: stetl.cfg |
| 14 |
- Stetl Filter: `python/osmmfilter.py`, calling the unaltered `prep_osmgml.py` from Astun Tech |
| 15 |
- command (Linux/Mac): etl.sh |
| 16 |
- output: to PostGIS and into the file `output/osmm_topo_prepared.gml` |
| 17 |
- gfs/ determines the mapping to PostGIS of the prepared data |
| 18 |
- postgres/*.sql - scripts to setup/init the PG DB (called by Stetl) |
| 19 |
|
| 20 |
How this works: |
| 21 |
On calling etl.sh Stetl will read the config file stetl.cfg, |
| 22 |
substituting any commandline parameters (-a option) passed to it. |
| 23 |
Stetl will then assemble and execute the specified Chains under the |
| 24 |
`[etl]` section: |
| 25 |
|
| 26 |
The Chain `input_sql_pre|schema_name_filter|output_postgres` will initialize the DB and setup |
| 27 |
all required tables/indexes from the files under postgres/*.sql. |
| 28 |
|
| 29 |
The Chain `input_big_gml_files|osmm_filter|xml_assembler|output_file` will read the input file(s) from |
| 30 |
the directory input/, stream the feature elements to its output. The "osmm_filter" will |
| 31 |
receive each feature element, calling the configured "preparer" in prep_osmgml.py. Finally |
| 32 |
the "output_file" component will write the result to the file under output/. |
| 33 |
|
| 34 |
The Chain `input_big_gml_files|osmm_filter|xml_assembler|output_ogr2ogr` does the samen, only it will |
| 35 |
write the results to PostGIS using the gfs/ mapping file. NB: in Stetl 1.0.4 still with a temp file |
| 36 |
but we will change this. |
| 37 |
|
| 38 |
## Links |
| 39 |
|
| 40 |
- Astuntech Loader - https://github.com/AstunTechnology/Loader |
| 41 |
- Ordnance Survey UK - http://www.ordnancesurvey.co.uk/ |