[DUG] Shell Execute
Conor Boyd
Conor_Boyd at trimble.com
Mon Feb 13 10:31:19 NZDT 2012
You can only ShellExecute one command at a time. You’ll have to have two separate calls to ShellExecute for your two invocations of ogr2ogr.
Only other way I can think might work would be to write a temporary batch file with both ogr2ogr invocations in it, and ShellExecute that, but I think two separate calls to ShellExecute would be clearer.
Cheers,
Conor
From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Bob Pawley
Sent: Monday, 13 February 2012 10:20 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Shell Execute
Thanks, I missed that. However I still get only the second table blocks. The first table entities is missed.
Bob
From: Conor Boyd <mailto:Conor_Boyd at trimble.com>
Sent: Sunday, February 12, 2012 12:01 PM
To: NZ Borland Developers Group - Delphi List <mailto:delphi at listserver.123.net.nz>
Subject: Re: [DUG] Shell Execute
Unless I’m reading it wrong, you’re missing a backslash in the path that you’re constructing to the ogr2ogr binary.
ProgramName :=
'"'+s+'\Quantum GIS Wroclaw\bin'+
'ogr2ogr"
I think there should be a slash after the “bin”?
From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Bob Pawley
Sent: Monday, 13 February 2012 6:54 a.m.
To: DUG
Subject: [DUG] Shell Execute
Hi
I’m having a further problem with shell execute. There seems to be a dearth of information on the web other than a simple “open” procedure.
The following two part code performs well when I copy and paste it into command prompt.
However when I use it in shell execute there is a problem getting both parts to run together.
In shell execute each part of the code does its thing when the other part is commented out.
I have tried joining the two parts with the ogr2ogr command &&, and as it appears below. I have also removed the second path to ogr2ogr with no joy.
I either get “unable to run” or the second part of the code is recognized with the first part being ignored.
The following is my command prompt code – which works as shown
set PGCLIENTENCODING=LATIN1&&set DXF_ENCODING=LATIN1&&set DXF_INLINE_BLOCKS=FALSE&&set DXF_MERGE_BLOCK_GEOMETRIES=FALSE&&ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres dbname=*** password=*****" Water2000.dxf -lco DIM=2 -nlt GEOMETRY -sql "select layer, linetype, subclasses, ogr_style, blockname, blockangle, blockscale, text from entities" -append -update -skipfailures
set PGCLIENTENCODING=LATIN1&&set DXF_ENCODING=LATIN1&&set DXF_INLINE_BLOCKS=FALSE&&set DXF_MERGE_BLOCK_GEOMETRIES=FALSE&&ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres dbname=*** password=****" Water2000.dxf -lco DIM=2 -nlt GEOMETRY -append -update -skipfailures -sql "select layer, linetype, subclasses, ogr_style, blockname, text from blocks"
Here is the shell execute code which is giving me a challenge -
ProgramName :=
'"'+s+'\Quantum GIS Wroclaw\bin'+
'ogr2ogr" "-f" '+
'"PostgreSQL";'+
' PG:"host='+DBHost+' user=postgres dbname='+DBName+' password='+Pass+'" "'+ DXFfile +'" '+
' --config DXF_INLINE_BLOCKS FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE --config DXF_ENCODING=UTF8 '+
' -lco DIM=2 -nlt GEOMETRY -overwrite -skipfailures'+
' -sql "select layer, linetype, subclasses, ogr_style, blockname, blockangle, blockscale, text from entities"'+
'"'+s+'\Quantum GIS Wroclaw\bin'+
'ogr2ogr""-f"'+
' "PostgreSQL";'+
'PG:"host='+DBHost+' user=postgres dbname='+DBName+' password='+Pass+'" "'+ DXFfile +'" '+
' --config DXF_INLINE_BLOCKS FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE --config DXF_ENCODING=UTF8 '+
' -lco DIM=2 -nlt GEOMETRY -overwrite -skipfailures'+
' -sql "select layer, linetype, subclasses, ogr_style, blockname, text from blocks"';
Thanks in advance for any suggestions.
Bob
________________________________
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20120213/26881c71/attachment-0001.html
More information about the Delphi
mailing list