AstunTechnology / Loader

GML & KML loader written in Python using OGR
MIT License
57 stars 35 forks source link

OSMM Sites into Shape #42

Closed imjones77 closed 9 years ago

imjones77 commented 9 years ago

Hi guys,

I want to have a look at some OS MM Sites data I downloaded (gz files) but it looks like I can only use the osmm_sites_postgres.gfs file as being specific to translating Sites data but I would prefer to translate into Shape files. Is that possible with Loader as things stand? Some screen-shot info:

AttributeError: 'module' object has no attribute 'osmm_sites_postgres' Processing: X:\Tools\Mapdata\OSDATA\MasterMap Sites\SU9590.gz Traceback (most recent call last): File "prepgml4ogr.py", line 160, in main() File "prepgml4ogr.py", line 122, in main prep_class = get_preparer(prep_class) File "prepgml4ogr.py", line 154, in get_preparer prep_class = getattr(prep_module, parts[1])

walkermatt commented 9 years ago

@imjones77 Hi, can you post the contents of your config file (make sure you redact any passwords if it contains any).

imjones77 commented 9 years ago

Hi Matt,

The 'prep.vml' ending on: prep_cmd=C:\Loader-master\python\python prepgml4ogr.py $file_path prep_osgml.prep_vml

seems a bit misleading and I had replaced it but since reinstating it, I have got some meaningful output in 3 Shape files!

Just to check everything, here is the full config file:

# Note: Environment variables can be used with any of 
#       the options by using a token of the form:
#       $HOME, ${HOME} or %TEMP% (Windows only)

# The directory containing your source files.
# All supported files in the specified directory and
# it's descendants will be loaded.
#src_dir=/path/to/source/data/folder
src_dir=X:\Tools\Mapdata\OSDATA\MasterMap Sites

# The directory used to store the translated data
# if writing to a file based format such as ESRI
# Shape, MapInfo TAB etc.
#out_dir=/path/to/output/data/folder
out_dir=C:\Translations\Interpose\Sites

# The directory used to store temporary working files
# during loading.
#tmp_dir=/path/to/temp/folder
tmp_dir=C:\Temp\Loader

# The ogr2ogr command that will be used to load the data.
# Here you can specify the destination format and any
# associated settings (for example database connection
# details if you are writing to PostGIS).
# As well as environment variables the following tokens can
# be used which will be substituted at runtime:
#   $output_dir - the directory specified by the out_dir setting
#   $base_file_name - the file name of the file to be loaded
#   $file_path - the full path of the file to be loaded
#ogr_cmd=ogr2ogr -append -skipfailures -f PostgreSQL PG:'dbname=postgis active_schema=public host=localhost user=postgres password=postgres' $file_path
ogr_cmd=ogr2ogr -append -skipfailures  -f "ESRI Shapefile" $output_dir $file_path
#ogr_cmd=ogr2ogr -append -skipfailures -f "MapInfo File" $output_dir/$base_file_name $file_path

# The command used to prepare the source
# data so it is suitable for loading with OGR. Choose a prep
# class appropriate for your data, for Ordnance Survey
# products take a look at prep_osgml.py for the available classes.
#prep_cmd=python prepgml4ogr.py $file_path prep_osgml.prep_osmm_topo
#prep_cmd=C:\\Program Files\\Python27\\python prepgml4ogr.py $file_path prep_osgml.prep_vml
#prep_cmd=C:\Loader-master\python\python prepgml4ogr.py $file_path prep_osgml.prep_vml
prep_cmd=python prepgml4ogr.py $file_path prep_osgml.prep_vml

# An optional command to be run once OGR has created it's output.
# Called once per file, useful for loading SQL dump files etc.
# All of the tokens available to the ogr_cmd can be used here.
#post_cmd=

# Optional OGR .gfs file used to define the
# feature attributes and geometry type of
# the features read from the GML.
#gfs_file=../gfs/osmm_topo_postgres.gfs
gfs_file=C:\Loader-master\gfs\osmm_sites_postgres.gfs

# Whether to output debug messages and keep
# temporary files (True or False).
debug=False
walkermatt commented 9 years ago

Can you try updating your config in line with: https://github.com/AstunTechnology/Loader/wiki/Configuration-examples#os-mastermap-sites-layer-to-postgresqlpostgis.

imjones77 commented 9 years ago

Thanks Matt, the attributes are a bit better now - more populated. It's been about a while since I visited the Loader site and it has come on a lot with the different types of data that can be translated now. I may well come back for other new OS datasets!