Thread: Uploading data to postgresql database

Uploading data to postgresql database

From
Subha Ramakrishnan
Date:
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

Re: Uploading data to postgresql database

From
Tino Wildenhain
Date:
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

Attachment

Re: Uploading data to postgresql database

From
Stephen Frost
Date:
* 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

Attachment

Re: Uploading data to postgresql database

From
Subha Ramakrishnan
Date:
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
>


Re: Uploading data to postgresql database

From
Scott Marlowe
Date:
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?

Re: Uploading data to postgresql database

From
Subha Ramakrishnan
Date:
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:
> 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
>
>


Re: Uploading data to postgresql database

From
Scott Marlowe
Date:
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.

Re: Uploading data to postgresql database

From
"Brent Wood"
Date:
ogr2ogr can write most formats to most other formats. It can certainly write to a PostGIS database, & read KML., so if
itcan 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
youcan 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.

Re: Uploading data to postgresql database

From
Subha Ramakrishnan
Date:
That would be great.
I do have GDAL compiled with postgis.
I'll definitely try this option.

Thanks a lot.

Subha
Brent Wood wrote:
> ogr2ogr can write most formats to most other formats. It can certainly write to a PostGIS database, & read KML., so
ifit 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'tyou 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.
>
>