Обсуждение: shp2pgsql in java

Поиск
Список
Период
Сортировка

shp2pgsql in java

От
Melanie Hofmann
Дата:
Hello,

I am new in this list.
Sorry for my worse english.

I have a problem, and I didn't find a answer in the Internet.

I will use the command shp2pgsql from a java programm to import shapefiles in a postgresql DB, but I can't find some examples.

Can anybody help me, or have anybody an example how this work? or a documentation?

Thank you for your answer.

Regards,

Melanie


Re: shp2pgsql in java

От
Michael Wood
Дата:
2009/9/18 Melanie Hofmann <melanie.hofmann20@googlemail.com>:
> Hello,
>
> I am new in this list.
> Sorry for my worse english.
>
> I have a problem, and I didn't find a answer in the Internet.
>
> I will use the command shp2pgsql from a java programm to import shapefiles
> in a postgresql DB, but I can't find some examples.
>
> Can anybody help me, or have anybody an example how this work? or a
> documentation?
>
> Thank you for your answer.

I think you basically want to set up a shell pipeline from Java.

You could either execute shp2pgsql from Java and arrange for its
stdout file descriptor to be pointing at a file and then execute psql
to read from that same file, or you could do it in one step by
connecting the stdout of shp2pgsql to the stdin of psql.

From Python, this is one way to do it.  (It should work from Jython
too, I think):
http://docs.python.org/library/subprocess.html#replacing-shell-pipeline

From Java you might find something useful here:
http://www.google.co.za/search?q=java+execute+shell+command

--
Michael Wood <esiotrot@gmail.com>