lutraconsulting / ostranslator-ii

A graphical QGIS plugin for loading Ordnance Survey MasterMap into PostGIS.
16 stars 8 forks source link

Failed to find ogr2ogr on Mac #13

Closed saberraz closed 8 months ago

saberraz commented 9 years ago

Failed to start the import process - please ensure you have ogr2ogr installed. Mac system. GDAL / ogr2ogr is installed via KyngChaos binaries.

ramotswa commented 9 years ago

+1 for this. Same problem as reported before.

songololo commented 8 years ago

+1

songololo commented 8 years ago

I made further progress switching to the MacPorts build of QGIS (instead of KyngChaos) however then I encountered a new error: Stderr: Unable to find driver `PostgreSQL'. (Though this only pops up after the processor works quite hard... so it does seem to get a lot farther...

saberraz commented 8 years ago

Unfortunately we don't have OSx environment to test the plugin. Seems either Postgresql is not installed or your system or GDAL doesn't have support for postgresql driver.

Someone on here: http://gis.stackexchange.com/questions/33346/how-can-i-update-ogr2ogr-to-include-the-postgresql-driver with port: sudo port install gdal +postgresql

Hope it helps

songololo commented 8 years ago

@saberraz I used macports (a mac package manager) to install gdal with postgresql94 support, and this definitely seems to get me another step farther. The process now runs to the "post processing" stage but after a while it throws a new error:

Args: ['-append', '-f', 'PostgreSQL', '--config', 'PG_USE_COPY', 'YES', '--config', 'GML_GFS_TEMPLATE', '/var/folders/96/k1v5zc4s0rd0wcpzyxyg87ph0000gq/T/1444983311.88.gfs', "PG:dbname='postgres' host='' port='5432' active_schema=public_tmp user='my_user_name' password=''", '/vsigzip//path/to/data/Topography/data/tq/6471861-TQ1659-10i19.gz'] Stdout: Stderr: ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: Unable to write feature 1000001896165964 from layer CartographicText.

ERROR 1: Terminating translation prematurely after failed translation of layer CartographicText (use -skipfailures to skip errors)

saberraz commented 8 years ago

First create another schema and call it: osm2 Could you try this from terminal (change parameters e.g. host, password, username, path to gz file):

ogr2ogr -append -f 'Postgresql' --config PG_USE_COPY YES --config GML_GFS_TEMPLATE /var/folders/96/k1v5zc4s0rd0wcpzyxyg87ph0000gq/T/1444983311.88.gfs PG:"dbname=postgres host='' port=5432 active_schema=osm2 user=my_user_name password=''" /vsigzip//path/to/data/Topography/data/tq/6471861-TQ1659-10i19.gz

(ogr2ogr should be under /opt/local/bin installed with port if it is not already in your path)

songololo commented 8 years ago

@saberraz -> please ignore this post and see updated post below.

Here is the output, the error occurs relatively soon after starting: shongololo$ ogr2ogr -append -f 'Postgresql' --config PG_USE_COPY YES --config GML_GFS_TEMPLATE /private/var/folders/0r/l9p6w_m13sg6g4qjlm51c6c80000gn/T/1444994007.02.gfs PG:"dbname=db_name host='' port=5432 active_schema=osm2 user=user_name password=pw" /vsigzip///path/to/data/tq/6471861-TQ1659-10i19.gz

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: Unable to write feature 1000001932020687 from layer BoundaryLine.

ERROR 1: Terminating translation prematurely after failed translation of layer BoundaryLine (use -skipfailures to skip errors)

songololo commented 8 years ago

@saberraz UPDATE: I've subsequently managed to get the command line version working when applied to a single file import into a clean schema. Though it will output several of these types of warning logs: Warning 1: Value 'true' of field TopographicLine.nonBoundingLine parsed incompletely to integer 0. All of the layers seem to import fine.

However, when I try to rerun the command to import a different file, or the same file again, then it throws errors. I therefore wonder if it is something to do with trying to rewrite or append a feature that already exists in the database?

It throws this type of error if using the -update -append flags: 0...10...20..ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: Unable to write feature 1000001896165964 from layer CartographicText.

ERROR 1: Terminating translation prematurely after failed translation of layer CartographicText (use -skipfailures to skip errors)

And it throws this error if using the -overwrite flag: 0...10...20..ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: no COPY in progress

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: CREATE TABLE "osm2"."cartographictext" ( ogc_fid SERIAL, PRIMARY KEY (ogc_fid), "fid" VARCHAR NOT NULL, "featurecode" INTEGER, "version" INTEGER, "versiondate" VARCHAR, "theme" varchar[], "changedate" varchar[], "reasonforchange" varchar[], "descriptivegroup" varchar[], "descriptiveterm" varchar[], "make" VARCHAR, "physicallevel" INTEGER, "physicalpresence" VARCHAR, "anchorposition" INTEGER, "font" INTEGER, "height" FLOAT8, "orientation" INTEGER, "textstring" VARCHAR, "wkb_geometry" geometry(POINT,1) ) ERROR: current transaction is aborted, commands ignored until end of transaction block

ERROR 1: Unable to write feature 1000001896165964 from layer CartographicText.

ERROR 1: Terminating translation prematurely after failed translation of layer CartographicText (use -skipfailures to skip errors)

saberraz commented 8 years ago

Mine had problem with the plugin but worked fine from terminal as you mentioned (OS X 10.10). I haven't tried the rewrite.

I have set up the environment and we will look into the problem in due course. The problem with the plugin seems to be related to psycopg2: http://initd.org/psycopg/docs/faq.html

Is your dbase local (as in localhost) or on a different server?

songololo commented 8 years ago

The db is running locally.

When trying to import an additional file, and if using the -skipfailures flag, then it reports a large number of these types of errors. ERROR 1: COPY statement failed. ERROR: null value in column "fid" violates not-null constraint DETAIL: Failing row contains (48408, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0101000020346C0000666666667FC21E415C8FC2F57E2E0741). CONTEXT: COPY cartographictext, line 1: "0101000020346C0000666666667FC21E415C8FC2F57E2E0741" When looking at the result in QGIS, it seems to have gotten past importing the topographic area features, but starts failing when importing the other layers.

saberraz commented 8 years ago

Here is my postgres log: 2015-10-16 15:08:31 BST ERROR COPY from stdin failed: COPY terminated by new PQexec

songololo commented 8 years ago

Interestingly, removing PG_USE_COPY YES from the options seems to resolve the error for me. (Thus using INSERT instead of COPY). Still experimenting. The documentation says that this option significantly improves speed, but I don't notice a huge difference in initial experiments...

saberraz commented 8 years ago

It is a bug with ogr2ogr driver which was supposedly resolved: https://trac.osgeo.org/gdal/ticket/6018

Another option is -lyr_transaction.

GeospatialMax commented 8 years ago

Hi, I am still having this issue. I have the newest GDAL binary from KyngChaos installed and the tools are working fine in the terminal. But when I try to run OS translator II, I get "Failed to start the import process - please ensure you have ogr2ogr installed.". Is there any update on this issue?

saberraz commented 8 years ago

Could you see if you can run ogr2ogr from terminal? Seems to me, the installer doesn't set the environment variable properly.

GeospatialMax commented 8 years ago

@saberraz: The directory with the executables for GDAL is referenced in my bash profile and the ogr2ogr command is recognized in the commandline. That was my first suspicion as well, but unfortunately it didn't make a difference.

saberraz commented 8 years ago

Could you try to run QGIS from terminal:

cd /Applications/QGIS.app/Contents/MacOS
./QGIS

Then run the plugin. You might now face the problem described above by @shongololo!

mostlyAtNight commented 8 years ago

Hi all,

The issue seen above giving messages including "ERROR 1: no COPY in progress" should have been fixed a month or so ago in a release.

Could you please confirm if this particular issue is still occuring?

If so, can you confirm which version of QGIS and OSTii you're using?

Kind regards,

Pete

saberraz commented 8 months ago

This is a mac issue and should have been addressed by now.