[postgis-users] pgsql2shp using java ProcessBuilder

James David Smith james.david.smith at gmail.com
Fri Apr 5 02:24:33 PDT 2013


Sorry for the dumb suggestions, but have you tried putting '37995'
instead of 37995 ? Also you are absolutely sure that you have columns
called coordinates and date in your points table right? Note that they
might be case sensitive too, so check that.

On 4 April 2013 16:21, Lelo - Luiz Rogério De Pieri
<lelo.pieri at gmail.com> wrote:
> Hi all,
>
> I'm having a problem to execute a pgsql2shp command using java.
>
> My OS is Ubuntu and it's frequently I use to generate shp files using
> pgsql2shp, but now I want to do it through java.
>
> The follow command works fine on terminal
> pgsql2shp -f pontos_05600202_teste -h myhost -u myuser -P mypasswd -g
> coordinates my_database "SELECT * from points where id_uploaded_file =
> 37995";
>
> Now I'm trying to execute the follow code:
>
> ProcessBuilder pb = new ProcessBuilder("pgsql2shp", "-f
> pontos_05600202_teste", "-h myhost", "-u myuser", "-P mypasswd", "-g
> coordinates", "my_database", "SELECT coordinates, date from points where
> id_uploaded_file = 37995");
>
> Process proc;
> proc = pb.start();
> InputStream stdin = proc.getInputStream();
> InputStreamReader isr = new InputStreamReader(stdin);
> BufferedReader br = new BufferedReader(isr);
>
> String line = null;
> System.out.println("<OUTPUT>");
>
> while ((line = br.readLine()) != null)
>     System.out.println(line);
>
> System.out.println("</OUTPUT>");
> int exitVal = proc.waitFor();
> System.out.println("Process exitValue: " + exitVal);
>
>
> And the result is:
>
> <OUTPUT>
> Preparing table for user query... Done.
> Initializing...  coordinates: no such attribute in table
> __pgsql2shp14493_tmp_table
> </OUTPUT>
>
> Does anybody as any idea about it?
>
> Thank you for all
>
> Best regards
> --
> Rogério De Pieri  (Lelo)
> SCJP 5
> Buscando melhorar a cada dia
> Áudio, Hardware & Software
> www.twitter.com/lelopieri
> blogdolelo.wordpress.com
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>


More information about the postgis-users mailing list