Uploading data to postgresql database

Started by Subha Ramakrishnanabout 17 years ago9 messagesgeneral
Jump to latest
#1Subha Ramakrishnan
subha@gslab.com

Hi All,

I wanted to know if there is a way to upload kml/gpx data directly to
the DB.
So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

If someone knows of a way to upload without converting to shape file,
please let me know.

I use postgresql 8.3.1 with postgis 1.3.3.

Thanks for the help.

Subha

#2Tino Wildenhain
tino@wildenhain.de
In reply to: Subha Ramakrishnan (#1)
Re: Uploading data to postgresql database

Subha Ramakrishnan wrote:

Hi All,

I wanted to know if there is a way to upload kml/gpx data directly to
the DB.

By upload you mean...? You can always just insert the date opaque as
raw field or text or use large object (lo).

So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

If someone knows of a way to upload without converting to shape file,
please let me know.

If you plan to do anything with the data inside the database
(and your reference to PostGIS indicates that) you need to insert
it in a structured way as opposed to just "upload the data".

What is wrong with the conversion step you mention?

Regards
Tino

#3Stephen Frost
sfrost@snowman.net
In reply to: Subha Ramakrishnan (#1)
Re: Uploading data to postgresql database

* Subha Ramakrishnan (subha@gslab.com) wrote:

So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

Have you looked at ogr2ogr? It looks to support KML as a format, and
has PostGIS support, though I'm not sure if it can handle the direction
you're asking for.

Stephen

#4Subha Ramakrishnan
subha@gslab.com
In reply to: Stephen Frost (#3)
Re: Uploading data to postgresql database

Hi,

Thanks for the reply.
I did take a look at ogr2ogr which can convert kml to shape. But i was
wondering if there's some direct way..:)
And by upload I meant adding geometry data to the DB.

Thanks & regards,
Subha

Stephen Frost wrote:

Show quoted text

* Subha Ramakrishnan (subha@gslab.com) wrote:

So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

Have you looked at ogr2ogr? It looks to support KML as a format, and
has PostGIS support, though I'm not sure if it can handle the direction
you're asking for.

Stephen

#5Scott Marlowe
scott.marlowe@gmail.com
In reply to: Subha Ramakrishnan (#1)
Re: Uploading data to postgresql database

On Tue, Mar 17, 2009 at 6:31 AM, Subha Ramakrishnan <subha@gslab.com> wrote:

I use postgresql 8.3.1 with postgis 1.3.3.

Don't know about the other stuff, but is there a good reason you're
running such an old release of 8.3?

#6Subha Ramakrishnan
subha@gslab.com
In reply to: Scott Marlowe (#5)
Re: Uploading data to postgresql database

No specific reason for using the old version.
Still in the process of upgrading the softwares that we are using in the
project.
Soon, we'll be using the latest version.

Does using an old version stop me from using a particular functionality?

Subha
Scott Marlowe wrote:

Show quoted text

On Tue, Mar 17, 2009 at 6:31 AM, Subha Ramakrishnan <subha@gslab.com> wrote:

I use postgresql 8.3.1 with postgis 1.3.3.

Don't know about the other stuff, but is there a good reason you're
running such an old release of 8.3?

-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Scott Marlowe
scott.marlowe@gmail.com
In reply to: Subha Ramakrishnan (#6)
Re: Uploading data to postgresql database

On Wed, Mar 18, 2009 at 1:31 AM, Subha Ramakrishnan <subha@gslab.com> wrote:

No specific reason for using the old version.
Still in the process of upgrading the softwares that we are using in the
project.
Soon, we'll be using the latest version.

Does using an old version stop me from using a particular functionality?

Nah, it's just more likely to do something you might not want. Can't
remember if there are any data eating type bugs in 8.3.1 or not.
We're still running 8.3.3 in production because nothing's been fixed
that really makes a big difference for what we do. That said, I'm
scheduled to update during the next routine maintenance down period.

#8Brent Wood
b.wood@niwa.co.nz
In reply to: Scott Marlowe (#7)
Re: Uploading data to postgresql database

ogr2ogr can write most formats to most other formats. It can certainly write to a PostGIS database, & read KML., so if it can write it to shape, it can write direct to Postgis

You just need to set your output format to postgis.

Note: depending on where you got GDAL (ogr2ogr) from, it may or may not have PostGIS drivers compiled in, if it doesn't you can compile it yourself against Postgres/PostGIS to enable this on your platform.

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand

Subha Ramakrishnan <subha@gslab.com> 03/18/09 7:04 PM >>>

Hi,

Thanks for the reply.
I did take a look at ogr2ogr which can convert kml to shape. But i was
wondering if there's some direct way..:)
And by upload I meant adding geometry data to the DB.

Thanks & regards,
Subha

Stephen Frost wrote:

* Subha Ramakrishnan (subha@gslab.com) wrote:

So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

Have you looked at ogr2ogr? It looks to support KML as a format, and
has PostGIS support, though I'm not sure if it can handle the direction
you're asking for.

Stephen

-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

#9Subha Ramakrishnan
subha@gslab.com
In reply to: Brent Wood (#8)
Re: Uploading data to postgresql database

That would be great.
I do have GDAL compiled with postgis.
I'll definitely try this option.

Thanks a lot.

Subha
Brent Wood wrote:

Show quoted text

ogr2ogr can write most formats to most other formats. It can certainly write to a PostGIS database, & read KML., so if it can write it to shape, it can write direct to Postgis

You just need to set your output format to postgis.

Note: depending on where you got GDAL (ogr2ogr) from, it may or may not have PostGIS drivers compiled in, if it doesn't you can compile it yourself against Postgres/PostGIS to enable this on your platform.

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand

Subha Ramakrishnan <subha@gslab.com> 03/18/09 7:04 PM >>>

Hi,

Thanks for the reply.
I did take a look at ogr2ogr which can convert kml to shape. But i was
wondering if there's some direct way..:)
And by upload I meant adding geometry data to the DB.

Thanks & regards,
Subha

Stephen Frost wrote:

* Subha Ramakrishnan (subha@gslab.com) wrote:

So far, I have been using shp2pgsql to upload data from shape files.
I don't want to convert it to shape and then upload it.

Have you looked at ogr2ogr? It looks to support KML as a format, and
has PostGIS support, though I'm not sure if it can handle the direction
you're asking for.

Stephen

-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.