2

I'm trying to import mastermap into QGIS (on Mac OS) using the OS Translator II plugin. I'm a newbie!

I'm running QGIS 2.18.15, with GDAL/OGR 2.1.3, and the OS Translator II plugin was downloaded through the plugin manager.

QGIS was installed from http://www.kyngchaos.com/software/qgis, and I installed the four additional packages that were included in the bundle, including "1 GDAL Complete.pkg" - which appears to be /Library/Frameworks/GDAL.framework/Versions/1.11

Firstly when I run the OS Translator import it complained that ogr2ogr wasn't found. I'm not sure why it was not using the version installed with QGIS. I temporarily fixed it by modifying the import_task.py script to give it the explicit path:

joe:OSTranslatorII root# pwd
/Users/joe/.qgis2/python/plugins/OSTranslatorII
joe:OSTranslatorII root# diff -u import_task.py.orig import_task.py
--- import_task.py.orig 2018-02-11 11:39:06.000000000 +0000
+++ import_task.py  2018-02-11 08:23:56.000000000 +0000
@@ -34,7 +34,7 @@
                 cmd += arg + ' '
             print 'Starting %s' % cmd

-        self.process.start('ogr2ogr', self.args)
+        self.process.start('/Library/Frameworks/GDAL.framework//Versions/2.1/Programs/ogr2ogr', self.args)
     if not self.process.waitForStarted():
         raise Exception('Failed to start process. Please ensure you have gdal/ogr2ogr installed')

Then it could find the tool, but it complained that the ogr2ogr line options were wrong:

Args: ['-overwrite', '-lyr_transaction', '-f', 'PostgreSQL', '--config', 'PG_USE_COPY', 'YES', '--config', 'GML_GFS_TEMPLATE', '/var/folders/p4/rjqvjlbx2rz1cs9x74f0tb6m0000gp/T/1518284450.86.gfs', "PG:dbname='test' host='' port='5432' active_schema=os_mm_tmp user='postgres' password='XXXX'", '/vsigzip//Users/joe/.qgis2/python/plugins/OSTranslatorII/gfs/OS Mastermap Topography (v9) Pioneer.gz', '-lco', 'OVERWRITE=YES', '-lco', 'SPATIAL_INDEX=OFF', '-lco', 'PRECISION=NO', '--config', 'GML_EXPOSE_FID', 'NO']
Stdout: Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
           [-select field_list] [-where restricted_where]
           [-progress] [-sql <sql statement>] [-dialect dialect]
           [-preserve_fid] [-fid FID]
           [-spat xmin ymin xmax ymax] [-geomfield field]
           [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
           [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
           dst_datasource_name src_datasource_name
           [-lco NAME=VALUE] [-nln name] [-nlt type] [-dim 2|3|layer_dim] [layer [layer ...]]

Note: ogr2ogr --long-usage for full help.

Stderr: 
    FAILURE: Unknown option name '-lyr_transaction'

  Args: ['-append', '-lyr_transaction', '-f', 'PostgreSQL', '--config', 'PG_USE_COPY', 'YES', '--config', 'GML_GFS_TEMPLATE', '/var/folders/p4/rjqvjlbx2rz1cs9x74f0tb6m0000gp/T/1518284450.86.gfs', "PG:dbname='test' host='' port='5432' active_schema=os_mm_tmp user='postgres' password='XXXX'", '/tmp/2998191/2998191-summary.gml', '--config', 'GML_EXPOSE_FID', 'NO']
  Stdout: Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
           [-select field_list] [-where restricted_where]
           [-progress] [-sql <sql statement>] [-dialect dialect]
           [-preserve_fid] [-fid FID]
           [-spat xmin ymin xmax ymax] [-geomfield field]
           [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
           [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
           dst_datasource_name src_datasource_name
           [-lco NAME=VALUE] [-nln name] [-nlt type] [-dim 2|3|layer_dim] [layer [layer ...]]

I'm guessing that OS Translator II is implemented against a different version of ogr2ogr.

If anyone else has experienced this problem, is there a workaround?

1

Ok, I've made some progress.

I installed the QGIS 2.14.21-1 version of QGIS from http://www.kyngchaos.com/software/qgis

This appears to come with a different version of GCAL (/Library/Frameworks/GDAL.framework//Versions/2.1). I'm not sure why the newer version of QGIS was packaged with an older version of GCAL. (Maybe it wasn't, maybe it was me?)

After hacking the import_task.py to point to the different version of ogr2ogr, the import now runs fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.