Re: [postgis-users] Shp2pgsql-gui, Save to schema other than public?

2012-04-17 Thread Francois Hugues

Yes you could use alter table but I meant you should click on public, which is 
the default value, into the gui and set it to whatever you want.

Hug

-Message d'origine-
De : postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] De la part de Ryan Dalton
Envoyé : mardi 17 avril 2012 17:30
À : postgis-users@postgis.refractions.net
Objet : [postgis-users] Shp2pgsql-gui, Save to schema other than public?

I see that I can run the command "ALTER TABLE [name] SET SCHEMA
[new_schema]" via SQL, is this what you are referring to?  Or are you
suggesting an alternate way to "manually edit the schema" within the
GUI that I must not be seeing...?

Ryan



Did you try to edit manually the name of the shema ? That should be ok
and you can do the same to set the table name, geometry column and
srid.

Hug




I just got PostGIS 2.0 installed and was using the Shp2pgsql-gui to
load some shapefiles into the database.  I have created a 'data'
schema where I was planning to store all of my imported data, but when
I use the shapefile import GUI, it does not appear as though there is
an option to specify which schema to load the data into, and it just
goes into 'public'.

Is it possible to load to an alternate schema, and am I just missing
something obvious?  Maybe a future feature enhancement if not?

Thanks,
Ryan
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Shp2pgsql-gui, Save to schema other than public?

2012-04-17 Thread Ryan Dalton
I see that I can run the command "ALTER TABLE [name] SET SCHEMA
[new_schema]" via SQL, is this what you are referring to?  Or are you
suggesting an alternate way to "manually edit the schema" within the
GUI that I must not be seeing...?

Ryan



Did you try to edit manually the name of the shema ? That should be ok
and you can do the same to set the table name, geometry column and
srid.

Hug




I just got PostGIS 2.0 installed and was using the Shp2pgsql-gui to
load some shapefiles into the database.  I have created a 'data'
schema where I was planning to store all of my imported data, but when
I use the shapefile import GUI, it does not appear as though there is
an option to specify which schema to load the data into, and it just
goes into 'public'.

Is it possible to load to an alternate schema, and am I just missing
something obvious?  Maybe a future feature enhancement if not?

Thanks,
Ryan
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Shp2pgsql-gui, Save to schema other than public?

2012-04-17 Thread Francois Hugues
Did you try to edit manually the name of the shema ? That should be ok and you 
can do the same to set the table name, geometry column and srid.
 
Hug



De : postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] De la part de Ryan Dalton
Envoyé : mardi 17 avril 2012 06:25
À : postgis-users@postgis.refractions.net
Objet : [postgis-users] Shp2pgsql-gui, Save to schema other than public?


I just got PostGIS 2.0 installed and was using the Shp2pgsql-gui to load some 
shapefiles into the database.  I have created a 'data' schema where I was 
planning to store all of my imported data, but when I use the shapefile import 
GUI, it does not appear as though there is an option to specify which schema to 
load the data into, and it just goes into 'public'.

Is it possible to load to an alternate schema, and am I just missing something 
obvious?  Maybe a future feature enhancement if not?

Thanks,
Ryan

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Shp2pgsql-gui, Save to schema other than public?

2012-04-16 Thread Ryan Dalton
I just got PostGIS 2.0 installed and was using the Shp2pgsql-gui to load
some shapefiles into the database.  I have created a 'data' schema where I
was planning to store all of my imported data, but when I use the shapefile
import GUI, it does not appear as though there is an option to specify
which schema to load the data into, and it just goes into 'public'.

Is it possible to load to an alternate schema, and am I just missing
something obvious?  Maybe a future feature enhancement if not?

Thanks,
Ryan
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui does not exist

2012-04-12 Thread Jose Carlos Martinez

Yes, it is working after that.
Thanks a lot,

On 12/04/2012 17:19, Salvatore Larosa wrote:

Il giorno gio, 12/04/2012 alle 16.24 +0200, Jose Carlos Martinez ha
scritto:

yes but Im checking the configure out and I see some problem with GTK:
checking for GTK+ - version>= 2.8.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log
for the
*** exact error that occured. This usually means GTK+ is incorrectly
installed.

Thanks for the information Sandro. I think its just my own installation
problem. Im going to check it.
Cheers,

Did you install the libgtk2.0-dev package?

Regards,

-SL


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui does not exist

2012-04-12 Thread Salvatore Larosa
Il giorno gio, 12/04/2012 alle 16.24 +0200, Jose Carlos Martinez ha
scritto:
> yes but Im checking the configure out and I see some problem with GTK:
> checking for GTK+ - version >= 2.8.0... no
> *** Could not run GTK+ test program, checking why...
> *** The test program failed to compile or link. See the file config.log 
> for the
> *** exact error that occured. This usually means GTK+ is incorrectly 
> installed.
> 
> Thanks for the information Sandro. I think its just my own installation 
> problem. Im going to check it.
> Cheers,

Did you install the libgtk2.0-dev package?

Regards,

-SL


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui does not exist

2012-04-12 Thread Jose Carlos Martinez

yes but Im checking the configure out and I see some problem with GTK:
checking for GTK+ - version >= 2.8.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log 
for the
*** exact error that occured. This usually means GTK+ is incorrectly 
installed.


Thanks for the information Sandro. I think its just my own installation 
problem. Im going to check it.

Cheers,


On Thu, Apr 12, 2012 at 03:56:19PM +0200, Jose Carlos Martinez wrote:

Dear List,
In previous versions of PostGIS (installed from linux repository or
from source) I could find the command shp2pgsql-gui.
Now in PostGIS 2 I cant find it even when I build it from svn.

This command does not exist anymore or Im doing something wrong?

Did you pass --with-gui to your ./configure line ?

--strk;

   ,--o-.
   |   __/  |Delivering high quality PostGIS 2.0 !
   |  / 2.0 |http://strk.keybit.net - http://vizzuality.com
   `-o--'

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui does not exist

2012-04-12 Thread Sandro Santilli
On Thu, Apr 12, 2012 at 03:56:19PM +0200, Jose Carlos Martinez wrote:
> Dear List,
> In previous versions of PostGIS (installed from linux repository or
> from source) I could find the command shp2pgsql-gui.
> Now in PostGIS 2 I cant find it even when I build it from svn.
> 
> This command does not exist anymore or Im doing something wrong?

Did you pass --with-gui to your ./configure line ?

--strk;

  ,--o-. 
  |   __/  |Delivering high quality PostGIS 2.0 !
  |  / 2.0 |http://strk.keybit.net - http://vizzuality.com
  `-o--'

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql-gui does not exist

2012-04-12 Thread Jose Carlos Martinez

Dear List,
In previous versions of PostGIS (installed from linux repository or from 
source) I could find the command shp2pgsql-gui.

Now in PostGIS 2 I cant find it even when I build it from svn.

This command does not exist anymore or Im doing something wrong?

Regards,
Jose

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui and option -S (Generate simple instead of MULTI geometries) / Ticket #660?

2012-02-03 Thread Mark Cave-Ayland

On 30/01/12 08:32, Sandro Santilli wrote:


On Mon, Jan 30, 2012 at 07:40:01AM +0100, Stefan Keller wrote:

2012/1/27 Sandro Santilli:

On Thu, Jan 26, 2012 at 09:50:25PM +0100, Stefan Keller wrote:

...

Am I missing something?


A ticket on the trac system, most likely :)


So you think it's not redundant to ticket #660?


Oops, It would. Sorry!


I've just committed this feature to SVN trunk as r9027. Unfortunately 
due to the difference in architecture, it's not going to be possible to 
backport to 1.5.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui and option -S (Generate simple instead of MULTI geometries) / Ticket #660?

2012-01-30 Thread Sandro Santilli
On Mon, Jan 30, 2012 at 07:40:01AM +0100, Stefan Keller wrote:
> 2012/1/27 Sandro Santilli :
> > On Thu, Jan 26, 2012 at 09:50:25PM +0100, Stefan Keller wrote:
...
> >> Am I missing something?
> >
> > A ticket on the trac system, most likely :)
>
> So you think it's not redundant to ticket #660?

Oops, It would. Sorry!

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui and option -S (Generate simple instead of MULTI geometries) / Ticket #660?

2012-01-29 Thread Stefan Keller
So you think it's not redundant to ticket #660?

Yours, Stefan

2012/1/27 Sandro Santilli :
> On Thu, Jan 26, 2012 at 09:50:25PM +0100, Stefan Keller wrote:
>> Hi
>>
>> Recent PostGIS versions come with a nifty plugin for pgAdmin3 called
>> "PostGIS Shapefile and DBF Loader" (shp2pgsql-gui). I see Revision
>> 7713 in my case.
>>
>> A common stumbling block of shp2pgsql is that Shapefile LineStrings
>> are imported as MulitLineStrings (I'd wish the default would be the
>> other way round :->)
>>
>> Fortunately there's the option -S "Generate simple geometries instead
>> of MULTI geometries".
>>
>> Now I realize that this option is not available in the "Options..."
>> dialog and that there is a ticket #660 since 4.4.11.
>>
>> Am I missing something?
>
> A ticket on the trac system, most likely :)
> http://trac.osgeo.org/postgis/newticket
>
> --strk;
>
>  ()   Free GIS & Flash consultant/developer
>  /\   http://strk.keybit.net/services.html
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql-gui and option -S (Generate simple instead of MULTI geometries) / Ticket #660?

2012-01-27 Thread Sandro Santilli
On Thu, Jan 26, 2012 at 09:50:25PM +0100, Stefan Keller wrote:
> Hi
> 
> Recent PostGIS versions come with a nifty plugin for pgAdmin3 called
> "PostGIS Shapefile and DBF Loader" (shp2pgsql-gui). I see Revision
> 7713 in my case.
> 
> A common stumbling block of shp2pgsql is that Shapefile LineStrings
> are imported as MulitLineStrings (I'd wish the default would be the
> other way round :->)
> 
> Fortunately there's the option -S "Generate simple geometries instead
> of MULTI geometries".
> 
> Now I realize that this option is not available in the "Options..."
> dialog and that there is a ticket #660 since 4.4.11.
> 
> Am I missing something?

A ticket on the trac system, most likely :)
http://trac.osgeo.org/postgis/newticket

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql segment fault (trunk -r 8924 ) without .shp file

2012-01-26 Thread Paul Ramsey
svn update, problem should be fixed now
P.

On Thu, Jan 26, 2012 at 12:52 PM, Min Wang  wrote:
> HI
>   I  built the trunk version 8924  on 64 bit machine.
>
>   The shp2pgsql seems gave me segment fault when there is no .shp file. but
> if pass -n, then it is ok.
>
>   Here is what I did:
>
>  gdb shp2pgsql
>
>  (gdb) set args s 4269 -g the_geom -W latin1 ./tl_2010_11001_featnames.dbf
> (gdb) run
>  Starting program: /usr/bin/shp2pgsql s 4269 -g the_geom -W latin1
> ./tl_2010_11001_featnames.dbf
> Unable to open s.shp or s.SHP.
> Unable to open s.shx or s.SHX.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x77867974 in fclose () from /lib/libc.so.6
> (gdb) bt
> #0  0x77867974 in fclose () from /lib/libc.so.6
> #1  0x00405998 in ?? ()
> #2  0x00405ecf in ?? ()
> #3  0x0040bde1 in ?? ()
> #4  0x0040c906 in ?? ()
> #5  0x7781ec4d in __libc_start_main () from /lib/libc.so.6
> #6  0x00402199 in ?? ()
> #7  0x7fffe698 in ?? ()
> #8  0x001c in ?? ()
> #9  0x0008 in ?? ()
> #10 0x7fffe8f2 in ?? ()
> #11 0x7fffe905 in ?? ()
> #12 0x7fffe907 in ?? ()
> #13 0x7fffe90c in ?? ()
> #14 0x7fffe90f in ?? ()
> #15 0x7fffe918 in ?? ()
> #16 0x7fffe91b in ?? ()
> #17 0x7fffe922 in ?? ()
> #18 0x in ?? ()
> (gdb)
>
>
>
>
>
>   any clue?
>
> thanks.
>
>
> Min Wang
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql segment fault (trunk -r 8924 ) without .shp file

2012-01-26 Thread Min Wang

HI
   I  built the trunk version 8924  on 64 bit machine.

   The shp2pgsql seems gave me segment fault when there is no .shp 
file. but if pass -n, then it is ok.


   Here is what I did:

  gdb shp2pgsql

  (gdb) set args s 4269 -g the_geom -W latin1 ./tl_2010_11001_featnames.dbf
(gdb) run
  Starting program: /usr/bin/shp2pgsql s 4269 -g the_geom -W latin1 
./tl_2010_11001_featnames.dbf

Unable to open s.shp or s.SHP.
Unable to open s.shx or s.SHX.

Program received signal SIGSEGV, Segmentation fault.
0x77867974 in fclose () from /lib/libc.so.6
(gdb) bt
#0  0x77867974 in fclose () from /lib/libc.so.6
#1  0x00405998 in ?? ()
#2  0x00405ecf in ?? ()
#3  0x0040bde1 in ?? ()
#4  0x0040c906 in ?? ()
#5  0x7781ec4d in __libc_start_main () from /lib/libc.so.6
#6  0x00402199 in ?? ()
#7  0x7fffe698 in ?? ()
#8  0x001c in ?? ()
#9  0x0008 in ?? ()
#10 0x7fffe8f2 in ?? ()
#11 0x7fffe905 in ?? ()
#12 0x7fffe907 in ?? ()
#13 0x7fffe90c in ?? ()
#14 0x7fffe90f in ?? ()
#15 0x7fffe918 in ?? ()
#16 0x7fffe91b in ?? ()
#17 0x7fffe922 in ?? ()
#18 0x in ?? ()
(gdb)





   any clue?

thanks.


Min Wang
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql-gui and option -S (Generate simple instead of MULTI geometries) / Ticket #660?

2012-01-26 Thread Stefan Keller
Hi

Recent PostGIS versions come with a nifty plugin for pgAdmin3 called
"PostGIS Shapefile and DBF Loader" (shp2pgsql-gui). I see Revision
7713 in my case.

A common stumbling block of shp2pgsql is that Shapefile LineStrings
are imported as MulitLineStrings (I'd wish the default would be the
other way round :->)

Fortunately there's the option -S "Generate simple geometries instead
of MULTI geometries".

Now I realize that this option is not available in the "Options..."
dialog and that there is a ticket #660 since 4.4.11.

Am I missing something?

Yours, Stefan
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql - how to continue when error occurs

2012-01-03 Thread Muhammad Imran

Hi Lauri,

This is becuase PG doesn't support INSERT IGNORE/REPLACE (as in MySQL or 
Oracle). 

-Imran


--- On Tue, 1/3/12, Lauri Kajan  wrote:

> From: Lauri Kajan 
> Subject: Re: [postgis-users] shp2pgsql - how to continue when error occurs
> To: "PostGIS Users Discussion" 
> Date: Tuesday, January 3, 2012, 4:16 PM
> Thanks Imran,
> 
> That was also in my mind, but thought I could have less
> steps to
> complete the import.
> 
> 
> -Lauri
> 
> 
> On Tue, Jan 3, 2012 at 11:50 AM, Nithya lakshmi
> 
> wrote:
> > how to use Rtree in postgis
> >
> > On 1/3/12, Muhammad Imran 
> wrote:
> >> Hi Lauri,
> >>
> >> 1- Disable or remove unique key (UK) on table.
> >> 2- Import data using shp2pgsql
> >> 3- remove duplicate rows using SQL
> >> DELETE
> >> FROM  sometable
> >> WHERE         someuniquekey NOT IN
> >>       (SELECT        
> MAX(dup.someuniquekey)
> >>         FROM                
>  sometable As dup
> >>         GROUP BY      dup.dupcolumn1,
> dup.dupcolumn2, dup.dupcolum3)
> >>
> >> (http://www.postgresonline.com/journal/archives/22-Deleting-Duplicate-Records-in-a-Table.html)
> >> 4- Enforce UK
> >>
> >>
> >> -Imran
> >>
> >>
> >> --- On Tue, 1/3/12, Lauri Kajan 
> wrote:
> >>
> >>> From: Lauri Kajan 
> >>> Subject: [postgis-users] shp2pgsql - how to
> continue when error occurs
> >>> To: postgis-users@postgis.refractions.net
> >>> Date: Tuesday, January 3, 2012, 1:18 PM
> >>> Hi all,
> >>>
> >>> I'm trying to merge multiple shapefiles to
> postgis table. I
> >>> know that
> >>> there is some duplicates in different files.
> >>>
> >>> I thought that I could just check
> duplicatiness when
> >>> loading shapes
> >>> with shp2pgsql.
> >>> So I first created an empty table and added a
> unique
> >>> constraint to the
> >>> field that I know to be unique with non
> duplicate records.
> >>>
> >>> But now when shp2pgsql tries to insert first
> duplicate
> >>> record and
> >>> error occurs it stops and won't load any
> records.
> >>>
> >>> Is there a way to continue when "key already
> exists" -error
> >>> occurs?
> >>>
> >>> I read that in shp2pgsql that comes with 2.0
> it has -e
> >>> parameter that
> >>> loads each record invidually. Is this the only
> way to go?
> >>> Don't like
> >>> that cause I have 13GB shape files. And I
> would like to use
> >>> Dump
> >>> dormat.
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>> -Lauri
> >>>
> ___
> >>> postgis-users mailing list
> >>> postgis-users@postgis.refractions.net
> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>
> >> ___
> >> postgis-users mailing list
> >> postgis-users@postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> > ___
> > postgis-users mailing list
> > postgis-users@postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql - how to continue when error occurs

2012-01-03 Thread Lauri Kajan
Thanks Imran,

That was also in my mind, but thought I could have less steps to
complete the import.


-Lauri


On Tue, Jan 3, 2012 at 11:50 AM, Nithya lakshmi
 wrote:
> how to use Rtree in postgis
>
> On 1/3/12, Muhammad Imran  wrote:
>> Hi Lauri,
>>
>> 1- Disable or remove unique key (UK) on table.
>> 2- Import data using shp2pgsql
>> 3- remove duplicate rows using SQL
>> DELETE
>> FROM  sometable
>> WHERE         someuniquekey NOT IN
>>       (SELECT         MAX(dup.someuniquekey)
>>         FROM                  sometable As dup
>>         GROUP BY      dup.dupcolumn1, dup.dupcolumn2, dup.dupcolum3)
>>
>> (http://www.postgresonline.com/journal/archives/22-Deleting-Duplicate-Records-in-a-Table.html)
>> 4- Enforce UK
>>
>>
>> -Imran
>>
>>
>> --- On Tue, 1/3/12, Lauri Kajan  wrote:
>>
>>> From: Lauri Kajan 
>>> Subject: [postgis-users] shp2pgsql - how to continue when error occurs
>>> To: postgis-users@postgis.refractions.net
>>> Date: Tuesday, January 3, 2012, 1:18 PM
>>> Hi all,
>>>
>>> I'm trying to merge multiple shapefiles to postgis table. I
>>> know that
>>> there is some duplicates in different files.
>>>
>>> I thought that I could just check duplicatiness when
>>> loading shapes
>>> with shp2pgsql.
>>> So I first created an empty table and added a unique
>>> constraint to the
>>> field that I know to be unique with non duplicate records.
>>>
>>> But now when shp2pgsql tries to insert first duplicate
>>> record and
>>> error occurs it stops and won't load any records.
>>>
>>> Is there a way to continue when "key already exists" -error
>>> occurs?
>>>
>>> I read that in shp2pgsql that comes with 2.0 it has -e
>>> parameter that
>>> loads each record invidually. Is this the only way to go?
>>> Don't like
>>> that cause I have 13GB shape files. And I would like to use
>>> Dump
>>> dormat.
>>>
>>>
>>>
>>> Thanks
>>>
>>> -Lauri
>>> ___
>>> postgis-users mailing list
>>> postgis-users@postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>> ___
>> postgis-users mailing list
>> postgis-users@postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql - how to continue when error occurs

2012-01-03 Thread Nithya lakshmi
how to use Rtree in postgis

On 1/3/12, Muhammad Imran  wrote:
> Hi Lauri,
>
> 1- Disable or remove unique key (UK) on table.
> 2- Import data using shp2pgsql
> 3- remove duplicate rows using SQL
> DELETE
> FROM  sometable
> WHERE someuniquekey NOT IN
>   (SELECT MAX(dup.someuniquekey)
> FROM  sometable As dup
> GROUP BY  dup.dupcolumn1, dup.dupcolumn2, dup.dupcolum3)
>
> (http://www.postgresonline.com/journal/archives/22-Deleting-Duplicate-Records-in-a-Table.html)
> 4- Enforce UK
>
>
> -Imran
>
>
> --- On Tue, 1/3/12, Lauri Kajan  wrote:
>
>> From: Lauri Kajan 
>> Subject: [postgis-users] shp2pgsql - how to continue when error occurs
>> To: postgis-users@postgis.refractions.net
>> Date: Tuesday, January 3, 2012, 1:18 PM
>> Hi all,
>>
>> I'm trying to merge multiple shapefiles to postgis table. I
>> know that
>> there is some duplicates in different files.
>>
>> I thought that I could just check duplicatiness when
>> loading shapes
>> with shp2pgsql.
>> So I first created an empty table and added a unique
>> constraint to the
>> field that I know to be unique with non duplicate records.
>>
>> But now when shp2pgsql tries to insert first duplicate
>> record and
>> error occurs it stops and won't load any records.
>>
>> Is there a way to continue when "key already exists" -error
>> occurs?
>>
>> I read that in shp2pgsql that comes with 2.0 it has -e
>> parameter that
>> loads each record invidually. Is this the only way to go?
>> Don't like
>> that cause I have 13GB shape files. And I would like to use
>> Dump
>> dormat.
>>
>>
>>
>> Thanks
>>
>> -Lauri
>> ___
>> postgis-users mailing list
>> postgis-users@postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql - how to continue when error occurs

2012-01-03 Thread Muhammad Imran
Hi Lauri,

1- Disable or remove unique key (UK) on table.
2- Import data using shp2pgsql
3- remove duplicate rows using SQL
DELETE
FROMsometable
WHERE   someuniquekey NOT IN
(SELECT MAX(dup.someuniquekey)
FROMsometable As dup
GROUP BYdup.dupcolumn1, dup.dupcolumn2, dup.dupcolum3)

(http://www.postgresonline.com/journal/archives/22-Deleting-Duplicate-Records-in-a-Table.html)
4- Enforce UK


-Imran


--- On Tue, 1/3/12, Lauri Kajan  wrote:

> From: Lauri Kajan 
> Subject: [postgis-users] shp2pgsql - how to continue when error occurs
> To: postgis-users@postgis.refractions.net
> Date: Tuesday, January 3, 2012, 1:18 PM
> Hi all,
> 
> I'm trying to merge multiple shapefiles to postgis table. I
> know that
> there is some duplicates in different files.
> 
> I thought that I could just check duplicatiness when
> loading shapes
> with shp2pgsql.
> So I first created an empty table and added a unique
> constraint to the
> field that I know to be unique with non duplicate records.
> 
> But now when shp2pgsql tries to insert first duplicate
> record and
> error occurs it stops and won't load any records.
> 
> Is there a way to continue when "key already exists" -error
> occurs?
> 
> I read that in shp2pgsql that comes with 2.0 it has -e
> parameter that
> loads each record invidually. Is this the only way to go?
> Don't like
> that cause I have 13GB shape files. And I would like to use
> Dump
> dormat.
> 
> 
> 
> Thanks
> 
> -Lauri
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql - how to continue when error occurs

2012-01-02 Thread Lauri Kajan
Hi all,

I'm trying to merge multiple shapefiles to postgis table. I know that
there is some duplicates in different files.

I thought that I could just check duplicatiness when loading shapes
with shp2pgsql.
So I first created an empty table and added a unique constraint to the
field that I know to be unique with non duplicate records.

But now when shp2pgsql tries to insert first duplicate record and
error occurs it stops and won't load any records.

Is there a way to continue when "key already exists" -error occurs?

I read that in shp2pgsql that comes with 2.0 it has -e parameter that
loads each record invidually. Is this the only way to go? Don't like
that cause I have 13GB shape files. And I would like to use Dump
dormat.



Thanks

-Lauri
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql error - current transaction is aborted...

2011-12-01 Thread jdmorgan

On 12/1/2011 9:56 AM, Andy Colson wrote:

On 12/1/2011 8:04 AM, jdmorgan wrote:

Hello,

I am attempting utilizing the shp2pgsql utility to import a
shapefile.The utility reports that the shapefile is of the type
MULTIPOLYGON[2] and then proceeds to through a bunch of errors for each
record that it can’t import “current transaction is aborted, commands
ignored until end of transaction block”.Any advice on how to get around
this would be greatly appreciated.

Sincerely,

-- JDM @ NEMAC


If you are using -S  (capital S) (Generate simple geometries instead 
of MULTI geometries) then that would be a problem.


Showing us your command might help.

-Andy



Here is the command I was using  shp2pgsql -s 4326 
FHM_ADS_2003_4326.shp  public.FHM_ADS_2003 | psql -d pgtest1 -U mbp
I have figured out the issue by looking at the SQL generated by 
shp2pgsql.  As it turns out there were null in a date field in the shape 
file, and postgresql didn't like that for the insert statement.


Thanks,

--
JDM Morgan @ NEMAC

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql error - current transaction is aborted...

2011-12-01 Thread Andy Colson

On 12/1/2011 8:04 AM, jdmorgan wrote:

Hello,

I am attempting utilizing the shp2pgsql utility to import a
shapefile.The utility reports that the shapefile is of the type
MULTIPOLYGON[2] and then proceeds to through a bunch of errors for each
record that it can’t import “current transaction is aborted, commands
ignored until end of transaction block”.Any advice on how to get around
this would be greatly appreciated.

Sincerely,

-- JDM @ NEMAC


If you are using -S  (capital S) (Generate simple geometries instead of 
MULTI geometries) then that would be a problem.


Showing us your command might help.

-Andy

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql error - current transaction is aborted...

2011-12-01 Thread jdmorgan

Hello,

I am attempting utilizing the shp2pgsql utility to import a 
shapefile.The utility reports that the shapefile is of the type 
MULTIPOLYGON[2] and then proceeds to through a bunch of errors for each 
record that it can't import "current transaction is aborted, commands 
ignored until end of transaction block".Any advice on how to get around 
this would be greatly appreciated.


Sincerely,

-- JDM @ NEMAC
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql nulls

2011-09-29 Thread Mark Cave-Ayland

On 29/09/11 16:38, Andy Colson wrote:


Oh, buggers. I had problems with this shapefile and tried several
different things, and I forgot to mention an important step. Which
probably takes the error out of postgis territory.

See, I want to change the projection. So I ran ogr2ogr from ParcelAnnoV2
to temp_shapefile first, then shp2pgsql on temp_shapefile would give me
invalid date errors. Sorry. I've got too many things going on and
messing things up.

The gdal people said the patch was applied to the shapefile driver:

http://lists.osgeo.org/pipermail/gdal-dev/2011-September/030276.html

So I'm wondering if with that fix, the shape->shape would produce a new
shapefile that shp2pgsql would import just fine.

I still have not had a chance to try out their fix, but at this point I
think all is well, and I've wasted enough of your time, we can call this
resolved.


Ah yes - that looks like an ogr2ogr bug. Never mind.


ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql nulls

2011-09-29 Thread Andy Colson

On 9/29/2011 10:05 AM, Mark Cave-Ayland wrote:

On 29/09/11 15:01, Andy Colson wrote:


Hey Mark, I may have guessed wrong. I got a response from the gdal folk,
who said "the null values for Date in this dbf file were indicated by a
string filled with spaces".

Would still be neet if something could be done so shp2pgsql could import
this. The shapefile is 16 Meg, and uncompresses to 157 Meg, you can get
it here:

http://squeakycode.net/parcelAnnoV2.zip

Version: is this what you are looking for?

RCSID: $Id: shp2pgsql-core.h 5983 2010-09-19 11:27:05Z mcayland $
RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

-Andy


Hi Andy,

Thanks for the example, but I don't appear to be able to recreate this
here:

pg90@zeno:~/datasets$ shp2pgsql ParcelAnnoV2 > test.sql
pg90@zeno:~/datasets$ psql -d postgis15 -f test.sql

postgis15=# \d parcelannov2
Table "public.parcelannov2"
Column | Type | Modifiers
++

gid | integer | not null default nextval('parcelannov2_gid_seq'::regclass)
textstring | character varying(254) |
fontname | character varying(254) |
fontsize | numeric |
bold | smallint |
italic | smallint |
underline | smallint |
verticalal | smallint |
horizontal | smallint |
xoffset | numeric |
yoffset | numeric |
angle | numeric |
fontleadin | numeric |
wordspacin | numeric |
characterw | numeric |
characters | numeric |
flipangle | numeric |
override | integer |
featype | smallint |
bptype | smallint |
book | integer |
page | integer |
recorded | date |
taskid | integer |
the_geom | geometry |
Indexes:
"parcelannov2_pkey" PRIMARY KEY, btree (gid)
Check constraints:
"enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 2)
"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL)
"enforce_srid_the_geom" CHECK (st_srid(the_geom) = (-1))

postgis15=# select * from parcelannov2 where gid = 1;
gid | textstring | fontname | fontsize | bold | italic | underline |
verticalal | horizontal | xoffset | yoffset | angle | fontleadin |
wordspacin | characterw |
characters | flipangle | override | featype | bptype | book | page |
recorded | taskid | the_geom
-++--+---+--++---+++---+---+---+---+---+---+

---+---+--+-++--+--+--++--

1 | | | 0.000 | 0 | 0 | 0 | 0 | 0 | 0.000 |
0.000 | 0.000 | 0.000 | 0.000 |
0.000 |
0.000 | 0.000 | 0 | 20 | 20 | 0 | 0 | | 0 |
(1 row)

postgis15=# select * from parcelannov2 where gid = 1 and recorded is null;
gid | textstring | fontname | fontsize | bold | italic | underline |
verticalal | horizontal | xoffset | yoffset | angle | fontleadin |
wordspacin | characterw |
characters | flipangle | override | featype | bptype | book | page |
recorded | taskid | the_geom
-++--+---+--++---+++---+---+---+---+---+---+

---+---+--+-++--+--+--++--

1 | | | 0.000 | 0 | 0 | 0 | 0 | 0 | 0.000 |
0.000 | 0.000 | 0.000 | 0.000 |
0.000 |
0.000 | 0.000 | 0 | 20 | 20 | 0 | 0 | | 0 |
(1 row)


That seems to indicate that the recorded date field is set to NULL as
intended? This is using the current 1.5 branch HEAD.


ATB,

Mark.



Oh, buggers.  I had problems with this shapefile and tried several 
different things, and I forgot to mention an important step.  Which 
probably takes the error out of postgis territory.


See, I want to change the projection.  So I ran ogr2ogr from 
ParcelAnnoV2 to temp_shapefile first, then shp2pgsql on temp_shapefile 
would give me invalid date errors.  Sorry.  I've got too many things 
going on and messing things up.


The gdal people said the patch was applied to the shapefile driver:

http://lists.osgeo.org/pipermail/gdal-dev/2011-September/030276.html

So I'm wondering if with that fix, the shape->shape would produce a new 
shapefile that shp2pgsql would import just fine.


I still have not had a chance to try out their fix, but at this point I 
think all is well, and I've wasted enough of your time, we can call this 
resolved.


Thanks again,

-Andy
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql nulls

2011-09-29 Thread Mark Cave-Ayland

On 29/09/11 15:01, Andy Colson wrote:


Hey Mark, I may have guessed wrong. I got a response from the gdal folk,
who said "the null values for Date in this dbf file were indicated by a
string filled with spaces".

Would still be neet if something could be done so shp2pgsql could import
this. The shapefile is 16 Meg, and uncompresses to 157 Meg, you can get
it here:

http://squeakycode.net/parcelAnnoV2.zip

Version: is this what you are looking for?

RCSID: $Id: shp2pgsql-core.h 5983 2010-09-19 11:27:05Z mcayland $
RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

-Andy


Hi Andy,

Thanks for the example, but I don't appear to be able to recreate this here:

pg90@zeno:~/datasets$ shp2pgsql ParcelAnnoV2 > test.sql
pg90@zeno:~/datasets$ psql -d postgis15 -f test.sql

postgis15=# \d parcelannov2
   Table "public.parcelannov2"
   Column   |  Type  | 
Modifiers

++
 gid| integer| not null default 
nextval('parcelannov2_gid_seq'::regclass)

 textstring | character varying(254) |
 fontname   | character varying(254) |
 fontsize   | numeric|
 bold   | smallint   |
 italic | smallint   |
 underline  | smallint   |
 verticalal | smallint   |
 horizontal | smallint   |
 xoffset| numeric|
 yoffset| numeric|
 angle  | numeric|
 fontleadin | numeric|
 wordspacin | numeric|
 characterw | numeric|
 characters | numeric|
 flipangle  | numeric|
 override   | integer|
 featype| smallint   |
 bptype | smallint   |
 book   | integer|
 page   | integer|
 recorded   | date   |
 taskid | integer|
 the_geom   | geometry   |
Indexes:
"parcelannov2_pkey" PRIMARY KEY, btree (gid)
Check constraints:
"enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 2)
"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 
'MULTIPOLYGON'::text OR the_geom IS NULL)

"enforce_srid_the_geom" CHECK (st_srid(the_geom) = (-1))

postgis15=# select * from parcelannov2 where gid = 1;
 gid | textstring | fontname |   fontsize| bold | italic | 
underline | verticalal | horizontal |xoffset|yoffset| 
  angle |  fontleadin   |  wordspacin   |  characterw   |
  characters   |   flipangle   | override | featype | bptype | book | 
page | recorded | taskid | the_geom

-++--+---+--++---+++---+---+---+---+---+---+
---+---+--+-++--+--+--++--
   1 ||  | 0.000 |0 |  0 | 
0 |  0 |  0 | 0.000 | 0.000 | 
0.000 | 0.000 | 0.000 | 0.000 |
 0.000 | 0.000 |0 |  20 | 20 |0 | 
  0 |  |  0 |

(1 row)

postgis15=# select * from parcelannov2 where gid = 1 and recorded is null;
 gid | textstring | fontname |   fontsize| bold | italic | 
underline | verticalal | horizontal |xoffset|yoffset| 
  angle |  fontleadin   |  wordspacin   |  characterw   |
  characters   |   flipangle   | override | featype | bptype | book | 
page | recorded | taskid | the_geom

-++--+---+--++---+++---+---+---+---+---+---+
---+---+--+-++--+--+--++--
   1 ||  | 0.000 |0 |  0 | 
0 |  0 |  0 | 0.000 | 0.000 | 
0.000 | 0.000 | 0.000 | 0.000 |
 0.000 | 0.000 |0 |  20 | 20 |0 | 
  0 |  |  0 |

(1 row)


That seems to indicate that the recorded date field is set to NULL as 
intended? This is using the current 1.5 branch HEAD.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql nulls

2011-09-29 Thread Andy Colson

On 9/29/2011 6:00 AM, Mark Cave-Ayland wrote:

On 28/09/11 17:11, Andy Colson wrote:


Hi List,

I have a shapefile and using ogr2ogr to reproject it, then shp2pgsql to
import it, but a date column has nulls in it and I'm getting invalid
date errors. If I dont use ogr2ogr the nulls import fine (the dest table
has nulls as well).

It looks like ogr2ogr is using a newer version of shapelib and is
writing null fields a little bit differently? (I'm guessing here.) Would
it be possible to update shp2pgsql to a newer version of shapelib?

-Andy


Hi Andy,

I think we'd need to have an example shapefile with a small sample of
geometries to understand what's going on here. Also you didn't mention
which version of shp2psql you are using, as there has been a lot of work
done there in recent times.


ATB,

Mark.



Hey Mark, I may have guessed wrong.  I got a response from the gdal 
folk, who said "the null values for Date in this dbf file were 
indicated by a string filled with spaces".


Would still be neet if something could be done so shp2pgsql could import 
this.  The shapefile is 16 Meg, and uncompresses to 157 Meg, you can get 
it here:


http://squeakycode.net/parcelAnnoV2.zip

Version: is this what you are looking for?

RCSID: $Id: shp2pgsql-core.h 5983 2010-09-19 11:27:05Z mcayland $ 
RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1


-Andy

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql nulls

2011-09-29 Thread Mark Cave-Ayland

On 28/09/11 17:11, Andy Colson wrote:


Hi List,

I have a shapefile and using ogr2ogr to reproject it, then shp2pgsql to
import it, but a date column has nulls in it and I'm getting invalid
date errors. If I dont use ogr2ogr the nulls import fine (the dest table
has nulls as well).

It looks like ogr2ogr is using a newer version of shapelib and is
writing null fields a little bit differently? (I'm guessing here.) Would
it be possible to update shp2pgsql to a newer version of shapelib?

-Andy


Hi Andy,

I think we'd need to have an example shapefile with a small sample of 
geometries to understand what's going on here. Also you didn't mention 
which version of shp2psql you are using, as there has been a lot of work 
done there in recent times.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql nulls

2011-09-28 Thread Andy Colson

Hi List,

I have a shapefile and using ogr2ogr to reproject it, then shp2pgsql to 
import it, but a date column has nulls in it and I'm getting invalid 
date errors.  If I dont use ogr2ogr the nulls import fine (the dest 
table has nulls as well).


It looks like ogr2ogr is using a newer version of shapelib and is 
writing null fields a little bit differently?  (I'm guessing here.) 
Would it be possible to update shp2pgsql to a newer version of shapelib?


-Andy
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql in a bash script question

2011-05-09 Thread Morin , Marc-André
The easiest way is to lauch pgAdmin and connect to the server.  At the first 
time, a little window will be prompted asking you password for the user 
postgres, and once you will have entered this password, just check the option 
"Store password"...  And you will never be asked to enter this password anymore 
when you will launch your batch file.
 
Hope this help,
 
Marc-André



De : postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] De la part de Carl 
Anderson
Envoyé : 7 mai 2011 17:43
À : PostGIS Users Discussion
Objet : Re: [postgis-users] shp2pgsql in a bash script question


You would only have to enter the password once if you changed your script like 
this. 

#!/bin/bash


(  
for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS 
RAILS ROADS STATE SUBMCD TABBLOCK
do
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log
shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir}


done  )  | psql -h localhost -d geotest -U uname -W  >> load.log 




C.


On Sat, May 7, 2011 at 4:12 PM, Dheeraj Chand  wrote:



:I have the world's dumbest question today. I am running a bash script 
that goes through several directories (and each of their several 
subdirectories) of shapefiles to run shp2pgsql and put them into the correct 
PSQL schema and table.  I'd like to be able to set it and forget it, so to 
speak, but each time, the shell is prompting me for the user's password. Is 
there a way to hardcode the password in?
[4:06pm] 

#!/bin/bash
for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS 
PRISECROADS RAILS ROADS STATE SUBMCD TABBLOCK
do
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log
shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql 
-h localhost -d geotest -U uname -W pass >> load.log


done
[4:07pm]
Here is the script: http://pastebin.com/prWLzEtk:

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users






-- 
Carl Anderson, GISP
 
cander...@spatialfocus.com
carl.ander...@vadose.org


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql in a bash script question

2011-05-07 Thread Carl Anderson
You would only have to enter the password once if you changed your script
like this.

*#!/bin/bash*
*
*
*(  *
*for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS
RAILS ROADS STATE SUBMCD TABBLOCK*
*do*
*ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log*
*shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir}*
*
*
*done  ) ** | psql -h localhost -d geotest -U uname -W  >> load.log *
*
*
*
*
C.


On Sat, May 7, 2011 at 4:12 PM, Dheeraj Chand wrote:

>
> :I have the world's dumbest question today. I am running a bash script
> that goes through several directories (and each of their several
> subdirectories) of shapefiles to run shp2pgsql and put them into the correct
> PSQL schema and table.  I'd like to be able to set it and forget it, so to
> speak, but each time, the shell is prompting me for the user's password. Is
> there a way to hardcode the password in?
> [4:06pm] *
> *
> *#!/bin/bash*
> *for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS
> PRISECROADS RAILS ROADS STATE SUBMCD TABBLOCK*
> *do*
> *ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log*
> *shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql -h
> localhost -d geotest -U uname -W pass >> load.log*
> *
> *
> *done*
> [4:07pm]
> Here is the script: http://pastebin.com/prWLzEtk:
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>


-- 
Carl Anderson, GISP

cander...@spatialfocus.com
carl.ander...@vadose.org
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql in a bash script question

2011-05-07 Thread Greg Williamson
Placing a password in a script is somewhat less secure than something like:
 <http://www.postgresql.org/docs/8.4/static/libpq-pgpass.html>

(depending on which version postgres you are using).

HTH,

Greg Williamson






From: Dheeraj Chand 
To: PostGIS Users Discussion 
Sent: Sat, May 7, 2011 1:12:34 PM
Subject: [postgis-users] shp2pgsql in a bash script question



:I have the world's dumbest question today. I am running a bash script that 
goes 
through several directories (and each of their several subdirectories) of 
shapefiles to run shp2pgsql and put them into the correct PSQL schema and 
table.  I'd like to be able to set it and forget it, so to speak, but each 
time, 
the shell is prompting me for the user's password. Is there a way to hardcode 
the password in?
[
4:06pm
] 

#!/bin/bash
for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS 
RAILS ROADS STATE SUBMCD TABBLOCK
do
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log
shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql -h 
localhost -d geotest -U uname -W pass >> load.log

done
[
4:07pm
]
Here is the script: http://pastebin.com/prWLzEtk:___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql in a bash script question

2011-05-07 Thread Dheeraj Chand

:I have the world's dumbest question today. I am running a bash script that 
goes through several directories (and each of their several subdirectories) of 
shapefiles to run shp2pgsql and put them into the correct PSQL schema and 
table.  I'd like to be able to set it and forget it, so to speak, but each 
time, the shell is prompting me for the user's password. Is there a way to 
hardcode the password in?
[4:06pm] 
#!/bin/bash
for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS 
RAILS ROADS STATE SUBMCD TABBLOCK
do
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log
shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql -h 
localhost -d geotest -U uname -W pass >> load.log

done
[4:07pm]
Here is the script: http://pastebin.com/prWLzEtk:___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql - bad date formats

2011-04-14 Thread Sandro Santilli
On Thu, Apr 14, 2011 at 12:56:33PM -0500, Jeff Dege wrote:

> ERROR:  date/time field value out of range: "0"
> HINT:  Perhaps you need a different "datestyle" setting.
> 
> What I need is for these features to be inserted with NULL date fields, 
> instead of '0'.

You may try to:
1) prepare the table using -p
2) alter the table to use varchar for the date field
3) fill the table using -a
4) fix the dates within the db

Or, which could be a good investiment of your time, look
at "datestyle" setting as hinted... there might be a style
in which '0' is accepted.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql - bad date formats

2011-04-14 Thread Jeff Dege
I'm trying to load a shapefile into a PostGIS database, using shp2pgsql and 
psql.

It's failing because a couple of the sql insert statements have date fields 
containing '0'.

ERROR:  date/time field value out of range: "0"
HINT:  Perhaps you need a different "datestyle" setting.

What I need is for these features to be inserted with NULL date fields, instead 
of '0'.

Currently, I'm running psql on the generated .sql file, capturing the output.  
I then search the output to identify the problem statement, delete it from the 
generated file, and then run psql on it again, until there are no errors.  I 
save the lines I deleted in another file, and then hand-edit them, and insert 
them separately.

This is tiresome, tedious, and slow.

Anyone have any better ideas?

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql import error: invalid byte sequence forencoding "UTF8": 0x96

2011-04-01 Thread Burgholzer, Robert (DEQ)
Ahhh, it was my "0x96" that defeated le Google.  The fix, for those of
you awaiting the outcome with bated  breath:

 

Shp2psql -W latin1 ...

 

Encoding is all good from there on out.  Thanks to Leo who posted a
solution in April of 2009!!!

 

r.b.

 

From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of
Burgholzer, Robert (DEQ)
Sent: Friday, April 01, 2011 4:31 PM
To: postgis-us...@refractions.net
Subject: [postgis-users] shp2pgsql import error: invalid byte sequence
forencoding "UTF8": 0x96

 

I am importing a file from some colleagues that is throwing an error
that I have never encountered before (nor it seems, has Google).What
is interesting is that this file was an update sent to me whose only
supposed difference is that it is a POINT shapefile instead of a
MULTIPOLYGON.   The MULTIPOLYGON version worked fine, of course I have
no way of knowing what else has REALLY changed with this dataset.  Any
help would be appreciated.  The error occurs with only a subset of the
records, and occurs upon cat'ing the file to psql like so:

 

cat sql/observed_vdgif_xy.sql | psql aquatic_bio -U robertwb

 

ERROR: byte sequence for encoding "UTF8": 0x96 

HINT:  This error can also happen if the byte sequence does not match
the encoding expected by the server, which is controlled by
"client_encoding".

 

Regards,

r.b.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql import error: invalid byte sequence for encoding "UTF8": 0x96

2011-04-01 Thread Burgholzer, Robert (DEQ)
I am importing a file from some colleagues that is throwing an error
that I have never encountered before (nor it seems, has Google).What
is interesting is that this file was an update sent to me whose only
supposed difference is that it is a POINT shapefile instead of a
MULTIPOLYGON.   The MULTIPOLYGON version worked fine, of course I have
no way of knowing what else has REALLY changed with this dataset.  Any
help would be appreciated.  The error occurs with only a subset of the
records, and occurs upon cat'ing the file to psql like so:

 

cat sql/observed_vdgif_xy.sql | psql aquatic_bio -U robertwb

 

ERROR: byte sequence for encoding "UTF8": 0x96 

HINT:  This error can also happen if the byte sequence does not match
the encoding expected by the server, which is controlled by
"client_encoding".

 

Regards,

r.b.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql character set conversions

2011-03-12 Thread Stephen Woodbridge

On 3/12/2011 3:21 AM, Sandro Santilli wrote:

On Sat, Mar 12, 2011 at 12:57:50AM -0500, Stephen Woodbridge wrote:

Hi All,

I am trying to load a shpfile that is in UTF8, but there is some random
character that is not. This is causing a load error and rollback on the
transaction.

I notice looking at:

man 2 iconv_open

that it is possible to add //IGNORE and/or //TRANSLIT to the tocode string.


Someone submitted a patch some time ago supporting this.
Generally, I think it'd be good to have a switch to set a policy
on encoding errors, like we have on NULL geometries handling (-N).


Hi strk,

Thanks. I agree that this should be added to the code.

To work around my problem, I applied this hack:

 diff -urNad postgis-1.5.1/loader/shp2pgsql-core.c 
postgis-1.5.1a/loader/shp2pgsql-core.c
--- postgis-1.5.1/loader/shp2pgsql-core.c   2010-02-03 
17:42:13.0 -0500
+++ postgis-1.5.1a/loader/shp2pgsql-core.c  2011-03-12 
00:55:13.0 -0500

@@ -87,7 +87,7 @@

inbytesleft = strlen(inputbuf);

-   cd = iconv_open("UTF-8", fromcode);
+   cd = iconv_open("UTF-8//IGNORE", fromcode);
if ( cd == ((iconv_t)(-1)) )
return NULL;

Data is loading now, so I'll see if that resolves my problem.

-Steve
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql character set conversions

2011-03-12 Thread Sandro Santilli
On Sat, Mar 12, 2011 at 12:57:50AM -0500, Stephen Woodbridge wrote:
> Hi All,
> 
> I am trying to load a shpfile that is in UTF8, but there is some random 
> character that is not. This is causing a load error and rollback on the 
> transaction.
> 
> I notice looking at:
> 
> man 2 iconv_open
> 
> that it is possible to add //IGNORE and/or //TRANSLIT to the tocode string.

Someone submitted a patch some time ago supporting this.
Generally, I think it'd be good to have a switch to set a policy
on encoding errors, like we have on NULL geometries handling (-N).

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql character set conversions

2011-03-11 Thread Stephen Woodbridge

Hi All,

I am trying to load a shpfile that is in UTF8, but there is some random 
character that is not. This is causing a load error and rollback on the 
transaction.


I notice looking at:

man 2 iconv_open

that it is possible to add //IGNORE and/or //TRANSLIT to the tocode string.

I haven't tried this yet, (I will), but was wondering if there is any 
reason this would not work - like maybe it does not use iconv but 
another library like libicu.


Also if this works, we should add this information to the shp2pgsql 
documentation and only help.


Actually, now that I think about this, this will not work because -E 
UTF8 would go in the fromcode and the database encoding would go into 
the tocode. So we would need a commandline argument that would support 
adding the //IGNORE


Thoughts?

-Steve
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql encoding question

2011-02-22 Thread Paul Ramsey
Dheeraj,
Your database encoding is UTF-8. Your shape file appears to have a
LATIN1 character in it. In order for the insert to work, you will need
to transcode the shape file. Fortunate, shp2pgsql has a commandline
option, -w.

shp2pgsql -w LATIN1 -s 4326 tl_2009_us_county public.counties

Happy transcoding,
P

On Tue, Feb 22, 2011 at 6:56 PM, Dheeraj Chand  wrote:
> Hi, everyone,
> I think that I can describe this as a very, very stupid encoding question.
> I'm getting an error in shp2pgsql about changing the encoding of the
> database, and when I try changing via the \encoding function, I find that
> the changes are not sticking.  Is there a better way to do this?
> tardis-2:County Shapefile dheerajchand$ shp2pgsql -s 4326 tl_2009_us_county
> public.counties | psql -U dheerajchand -h localhost -p 5432 -d jamaa
> Shapefile type: Polygon
> Postgis type: MULTIPOLYGON[2]
> SET
> SET
> BEGIN
> NOTICE:  CREATE TABLE will create implicit sequence "counties_gid_seq" for
> serial column "counties.gid"
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> "counties_pkey" for table "counties"
> CREATE TABLE
>                       addgeometrycolumn
> --
>  public.counties.the_geom SRID:4326 TYPE:MULTIPOLYGON DIMS:2
> (1 row)
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> Unable to convert data value to UTF-8 (iconv reports "Illegal byte
> sequence"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or
> one of the values described at
> http://www.postgresql.org/docs/current/static/multibyte.html.
> INSERT 0 1
> tardis-2:County Shapefile dheerajchand$
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql encoding question

2011-02-22 Thread Dheeraj Chand
Hi, everyone,

I think that I can describe this as a very, very stupid encoding question. I'm 
getting an error in shp2pgsql about changing the encoding of the database, and 
when I try changing via the \encoding function, I find that the changes are not 
sticking.  Is there a better way to do this?

tardis-2:County Shapefile dheerajchand$ shp2pgsql -s 4326 tl_2009_us_county 
public.counties | psql -U dheerajchand -h localhost -p 5432 -d jamaa
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
SET
SET
BEGIN
NOTICE:  CREATE TABLE will create implicit sequence "counties_gid_seq" for 
serial column "counties.gid"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "counties_pkey" 
for table "counties"
CREATE TABLE
  addgeometrycolumn   
--
 public.counties.the_geom SRID:4326 TYPE:MULTIPOLYGON DIMS:2 
(1 row)

INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
Unable to convert data value to UTF-8 (iconv reports "Illegal byte sequence"). 
Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the 
values described at 
http://www.postgresql.org/docs/current/static/multibyte.html.
INSERT 0 1
tardis-2:County Shapefile dheerajchand$ 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2011-02-20 Thread Mehmet Erkek
Thanks Mark. I think you are right. Shp2pgsql did not change anything.
Please ignore my comment about it. We have found the problem. It looks
to be the simplification algorithm we use to display shapes in Google
maps. Sorry for keeping the list busy. 

Regards
 

Mehmet Erkek

-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Mark
Cave-Ayland
Sent: Wednesday, February 16, 2011 7:08 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] shp2pgsql

On 16/02/11 14:29, Mehmet Erkek wrote:

> Hi everyone,
>
> Wishing you all a fruitful day, here is a problem we have and we are
> hoping to get some help:
>
> We are converting a shapefile to postgis with shp2pgsql. Conversion is
> done without problem. However, it produces boundaries with fewer
points
> than we expect, thus it produces sharper boundaries and sometimes
> overlaps with neighboring boundaries.
>
> Is there way to make it produce outputs with more points and much
closer
> to original shapefile?
>
> I appreciate any comment on this.
>
> Thanks.

I think you need to clarify this with an example, since shp2pgsql 
doesn't alter the input geometries, it merely converts them to binary 
for storage within the database.


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2011-02-16 Thread Mark Cave-Ayland

On 16/02/11 14:29, Mehmet Erkek wrote:


Hi everyone,

Wishing you all a fruitful day, here is a problem we have and we are
hoping to get some help:

We are converting a shapefile to postgis with shp2pgsql. Conversion is
done without problem. However, it produces boundaries with fewer points
than we expect, thus it produces sharper boundaries and sometimes
overlaps with neighboring boundaries.

Is there way to make it produce outputs with more points and much closer
to original shapefile?

I appreciate any comment on this.

Thanks.


I think you need to clarify this with an example, since shp2pgsql 
doesn't alter the input geometries, it merely converts them to binary 
for storage within the database.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2011-02-16 Thread ibrahim saricicek
Hi;

I prefer try also on ogr2ogr.
You can find it in FwTools, you have to download it from;
http://fwtools.maptools.org/
And can get help from;
http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet

On Wed, Feb 16, 2011 at 4:29 PM, Mehmet Erkek  wrote:

> Hi everyone,
>
>
>
> Wishing you all a fruitful day,  here is a problem we have and we are
> hoping to get some help:
>
>
>
>
>
> We are converting a shapefile to postgis with shp2pgsql. Conversion is done
> without problem. However, it produces boundaries with fewer points than we
> expect, thus it produces sharper boundaries and sometimes overlaps with
> neighboring boundaries.
>
>
>
> Is there way to make  it produce outputs with more points and much closer
> to original shapefile?
>
>
>
>
>
> I appreciate any comment on this.
>
>
>
> Thanks.
>
>
>
>
>
> *Mehmet Erkek*
>
> www.REIDIN.com 
>
>
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited. Please Consider
> the Environment Before Printing This Email
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql

2011-02-16 Thread Mehmet Erkek
Hi everyone,

 

Wishing you all a fruitful day,  here is a problem we have and we are
hoping to get some help:

 

 

We are converting a shapefile to postgis with shp2pgsql. Conversion is
done without problem. However, it produces boundaries with fewer points
than we expect, thus it produces sharper boundaries and sometimes
overlaps with neighboring boundaries.

  

Is there way to make  it produce outputs with more points and much
closer to original shapefile?

 

 

I appreciate any comment on this.  

 

Thanks.

 

 

Mehmet Erkek

www.REIDIN.com   

 

 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-03 Thread Mark Cave-Ayland

On 01/01/11 17:16, Paul Ramsey wrote:


On 64bit machines it works.

P.


Does changing int to unsigned int work too? That would seem to be a more 
sensible change.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-01 Thread Aren Cambre
Does it cause a regression for 32-bit users?

Aren

On Sat, Jan 1, 2011 at 11:16 AM, Paul Ramsey wrote:

> On 64bit machines it works.
>
> P.
>
> On 2011-01-01, at 5:33 AM, Aren Cambre  wrote:
>
> It was raised there 4.5 years ago: 
> 
> http://bugzilla.maptools.org/show_bug.cgi?id=1463.
>
> Might be nice if PostGIS maintainers could "bug" that developer about
> resolution?
>
> The proposed local patch is changing int to long on three variables. While
> that may not be graceful, could it work as a temporary workaround?
>
> Aren
>
> On Sat, Jan 1, 2011 at 7:05 AM, Mark Cave-Ayland 
> <
> mark.cave-ayl...@siriusit.co.uk> wrote:
>
>> On 01/01/11 06:46, Paul Ramsey wrote:
>>
>>  No workarounds. I thought there was a braindead patch on that ticket
>>> already, but it's not a patch I feel good enough to apply as a
>>> permanent fix.
>>>
>>> P.
>>>
>>
>> Yeah. Also since we've recently resynced with upstream shapelib, I'd much
>> rather the issue is raised/fixed there and then we can just resync once
>> again.
>>
>>
>> ATB,
>>
>> Mark.
>>
>> --
>> Mark Cave-Ayland - Senior Technical Architect
>> PostgreSQL - PostGIS
>> Sirius Corporation plc - control through freedom
>>  http://www.siriusit.co.uk
>> t: +44 870 608 0063
>>
>> Sirius Labs: 
>> http://www.siriusit.co.uk/labs
>>
>> ___
>> postgis-users mailing list
>>  
>> postgis-users@postgis.refractions.net
>>  
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-01 Thread Paul Ramsey
On 64bit machines it works. 

P.

On 2011-01-01, at 5:33 AM, Aren Cambre  wrote:

> It was raised there 4.5 years ago: 
> http://bugzilla.maptools.org/show_bug.cgi?id=1463.
> 
> Might be nice if PostGIS maintainers could "bug" that developer about 
> resolution?
> 
> The proposed local patch is changing int to long on three variables. While 
> that may not be graceful, could it work as a temporary workaround?
> 
> Aren
> 
> On Sat, Jan 1, 2011 at 7:05 AM, Mark Cave-Ayland 
>  wrote:
> On 01/01/11 06:46, Paul Ramsey wrote:
> 
> No workarounds. I thought there was a braindead patch on that ticket
> already, but it's not a patch I feel good enough to apply as a
> permanent fix.
> 
> P.
> 
> Yeah. Also since we've recently resynced with upstream shapelib, I'd much 
> rather the issue is raised/fixed there and then we can just resync once again.
> 
> 
> ATB,
> 
> Mark.
> 
> -- 
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
> 
> Sirius Labs: http://www.siriusit.co.uk/labs
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-01 Thread Mark Cave-Ayland

On 01/01/11 13:33, Aren Cambre wrote:


It was raised there 4.5 years ago:
http://bugzilla.maptools.org/show_bug.cgi?id=1463.

Might be nice if PostGIS maintainers could "bug" that developer about
resolution?

The proposed local patch is changing int to long on three variables.
While that may not be graceful, could it work as a temporary workaround?

Aren


Right. Have you actually tried the patch to see if it works? If it does, 
I'd attach it to the shapelib bug report and then ask on the relevant 
mailing list to get one of the developers to test and commit.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-01 Thread Aren Cambre
It was raised there 4.5 years ago:
http://bugzilla.maptools.org/show_bug.cgi?id=1463.

Might be nice if PostGIS maintainers could "bug" that developer about
resolution?

The proposed local patch is changing int to long on three variables. While
that may not be graceful, could it work as a temporary workaround?

Aren

On Sat, Jan 1, 2011 at 7:05 AM, Mark Cave-Ayland <
mark.cave-ayl...@siriusit.co.uk> wrote:

> On 01/01/11 06:46, Paul Ramsey wrote:
>
>  No workarounds. I thought there was a braindead patch on that ticket
>> already, but it's not a patch I feel good enough to apply as a
>> permanent fix.
>>
>> P.
>>
>
> Yeah. Also since we've recently resynced with upstream shapelib, I'd much
> rather the issue is raised/fixed there and then we can just resync once
> again.
>
>
> ATB,
>
> Mark.
>
> --
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
>
> Sirius Labs: http://www.siriusit.co.uk/labs
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2011-01-01 Thread Mark Cave-Ayland

On 01/01/11 06:46, Paul Ramsey wrote:


No workarounds. I thought there was a braindead patch on that ticket
already, but it's not a patch I feel good enough to apply as a
permanent fix.

P.


Yeah. Also since we've recently resynced with upstream shapelib, I'd 
much rather the issue is raised/fixed there and then we can just resync 
once again.



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql with DBF >= 2 GB?

2010-12-31 Thread Paul Ramsey
No workarounds. I thought there was a braindead patch on that ticket
already, but it's not a patch I feel good enough to apply as a
permanent fix.

P.

On Fri, Dec 31, 2010 at 9:49 PM, Aren Cambre  wrote:
> I have a DBF that's almost exactly 2 GB. I get the fseek errors as
> per http://trac.osgeo.org/postgis/ticket/393 when I run shp2pgsql on the SHP
> that includes this DBF.
> Are there any workarounds?
> This 2 GB DBF is the result of opening StratMap Trans
> FGDB from http://www.tnris.org/datadownload/download.jsp, opening in ArcGIS,
> then exporting to a SHP.
> Aren
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql with DBF >= 2 GB?

2010-12-31 Thread Aren Cambre
I have a DBF that's almost exactly 2 GB. I get the fseek errors as per
http://trac.osgeo.org/postgis/ticket/393 when I run *shp2pgsql* on the SHP
that includes this DBF.

Are there any workarounds?

This 2 GB DBF is the result of opening *StratMap Trans FGDB* from
http://www.tnris.org/datadownload/download.jsp, opening in ArcGIS, then
exporting to a SHP.

Aren
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql standalone?

2010-11-29 Thread Paolo Cavallini
Il 29/11/2010 09:33, Benedetto Porfidia ha scritto:

> It needs only few dll to work. They should stay in the same dir.
> libiconv-2.dll - ssleay32.dll - libintl-2.dll - libpq.dll - krb5_32.dll
> - comerr32.dll  and psql.exe pgsql2shp.exe shp.pgsql.exe
> Don't know which is strictly needed, but this worked for me

Thanks Benedetto. So just copying these to some dir, and adding it to the path 
which
PostGIS Manager can find (which?) should do?
So my question is: can we make a package, for easy install by regular users?
It seems a trivial task.
All the best.

-- 
Paolo Cavallini: http://www.faunalia.it/pc
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql standalone?

2010-11-29 Thread Benedetto Porfidia

Il 29/11/2010 9.09, Paolo Cavallini ha scritto:

Hi all.
Could (or has it been) shp2pgsql be packaged in the standalone installer?
Using the PostGIS Manager QGIS plugin is a very convenient way of loading 
layers. To
be fully usable, however, users would need also the utility shp2pgsql. AFAIK, 
this
cannot be installed alone on windows, but apparently require
the installation of PostgreSQL and PostGIS (I may be wrong - I do not know 
Windows).
Any easy solution?
Thanking you in advance.




It needs only few dll to work. They should stay in the same dir.
libiconv-2.dll - ssleay32.dll - libintl-2.dll - libpq.dll - krb5_32.dll 
- comerr32.dll  and psql.exe pgsql2shp.exe shp.pgsql.exe

Don't know which is strictly needed, but this worked for me

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql standalone?

2010-11-29 Thread Paolo Cavallini
Hi all.
Could (or has it been) shp2pgsql be packaged in the standalone installer?
Using the PostGIS Manager QGIS plugin is a very convenient way of loading 
layers. To
be fully usable, however, users would need also the utility shp2pgsql. AFAIK, 
this
cannot be installed alone on windows, but apparently require
the installation of PostgreSQL and PostGIS (I may be wrong - I do not know 
Windows).
Any easy solution?
Thanking you in advance.
-- 
Paolo Cavallini: http://www.faunalia.it/pc
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql 1.5 is crashing

2010-10-18 Thread Stephen Woodbridge

On 10/18/2010 5:07 AM, Sebastian E. Ovide wrote:

Is there any reason why not to use gdal ogr2ogr ?


Much of the time I do not need to transform the geometry so I have not 
loaded gdal/ogr on the system. The other reason is that I have loads of 
scripts that use shp2pgsql because that is all I need in most cases.


So with that I have never actually had to use ogr2ogr to load the data 
into postgis, but there is no technical reason not to.


-Steve


On Thu, Oct 14, 2010 at 7:03 PM, Stephen Woodbridge
mailto:wood...@swoodbridge.com>> wrote:

On 10/14/2010 12:02 PM, Mark Cave-Ayland wrote:

Stephen Woodbridge wrote:

Hi all,

I'm running into a crashing problem with shp2pgsql on 1.5
release on a
CentOS 5

This crashes:
shp2pgsql -s 4326 -c -D Hydrants_4326.shp data.hydrants

This works ok:
shp2pgsql -s 4326 -c -D -N skip Hydrants_4326.shp data.hydrants

File loads ok in OpenEV and runs through ogr2ogr without a
problem.

-Steve W


Hi Steve,

If you're not already running 1.5.2, I'd try that as I seem to
remember
there were a couple of bugfixes that might be relevant here.


Hi Mark,

I sort of thought there might have been some fixes, but could not
verify that and did not realize I was back a version.

Thanks,
  -Steve

___
postgis-users mailing list
postgis-users@postgis.refractions.net

http://postgis.refractions.net/mailman/listinfo/postgis-users




--
Sebastian E. Ovide






___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql 1.5 is crashing

2010-10-18 Thread Sebastian E. Ovide
Is there any reason why not to use gdal ogr2ogr ?

On Thu, Oct 14, 2010 at 7:03 PM, Stephen Woodbridge  wrote:

> On 10/14/2010 12:02 PM, Mark Cave-Ayland wrote:
>
>> Stephen Woodbridge wrote:
>>
>>  Hi all,
>>>
>>> I'm running into a crashing problem with shp2pgsql on 1.5 release on a
>>> CentOS 5
>>>
>>> This crashes:
>>> shp2pgsql -s 4326 -c -D Hydrants_4326.shp data.hydrants
>>>
>>> This works ok:
>>> shp2pgsql -s 4326 -c -D -N skip Hydrants_4326.shp data.hydrants
>>>
>>> File loads ok in OpenEV and runs through ogr2ogr without a problem.
>>>
>>> -Steve W
>>>
>>
>> Hi Steve,
>>
>> If you're not already running 1.5.2, I'd try that as I seem to remember
>> there were a couple of bugfixes that might be relevant here.
>>
>
> Hi Mark,
>
> I sort of thought there might have been some fixes, but could not verify
> that and did not realize I was back a version.
>
> Thanks,
>  -Steve
>
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
Sebastian E. Ovide
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql 1.5 is crashing

2010-10-14 Thread Stephen Woodbridge

On 10/14/2010 12:02 PM, Mark Cave-Ayland wrote:

Stephen Woodbridge wrote:


Hi all,

I'm running into a crashing problem with shp2pgsql on 1.5 release on a
CentOS 5

This crashes:
shp2pgsql -s 4326 -c -D Hydrants_4326.shp data.hydrants

This works ok:
shp2pgsql -s 4326 -c -D -N skip Hydrants_4326.shp data.hydrants

File loads ok in OpenEV and runs through ogr2ogr without a problem.

-Steve W


Hi Steve,

If you're not already running 1.5.2, I'd try that as I seem to remember
there were a couple of bugfixes that might be relevant here.


Hi Mark,

I sort of thought there might have been some fixes, but could not verify 
that and did not realize I was back a version.


Thanks,
  -Steve
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql 1.5 is crashing

2010-10-14 Thread Mark Cave-Ayland

Stephen Woodbridge wrote:


Hi all,

I'm running into a crashing problem with shp2pgsql on 1.5 release on a 
CentOS 5


This crashes:
shp2pgsql -s 4326 -c -D  Hydrants_4326.shp data.hydrants

This works ok:
shp2pgsql -s 4326 -c -D -N skip Hydrants_4326.shp data.hydrants

File loads ok in OpenEV and runs through ogr2ogr without a problem.

-Steve W


Hi Steve,

If you're not already running 1.5.2, I'd try that as I seem to remember 
there were a couple of bugfixes that might be relevant here.



HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql 1.5 is crashing

2010-10-12 Thread Stephen Woodbridge

Hi all,

I'm running into a crashing problem with shp2pgsql on 1.5 release on a 
CentOS 5


This crashes:
shp2pgsql -s 4326 -c -D  Hydrants_4326.shp data.hydrants

This works ok:
shp2pgsql -s 4326 -c -D -N skip Hydrants_4326.shp data.hydrants

File loads ok in OpenEV and runs through ogr2ogr without a problem.

-Steve W

Linux mapserver 2.6.18-194.11.1.el5xen #1 SMP Tue Aug 10 20:27:58 EDT 
2010 i686 i686 i386 GNU/Linux


[wood...@mapserver hydrants]$ shp2pgsql
RCSID: $Id: shp2pgsql-core.h 5098 2010-01-04 05:47:04Z pramsey $ 
RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1


[wood...@mapserver hydrants]$ shp2pgsql -s 4326 -c -D  Hydrants_4326.shp 
data.hydrants > a

Shapefile type: PointZ
Postgis type: POINT[4]
*** glibc detected *** shp2pgsql: free(): invalid pointer: 0x08051c3b ***
=== Backtrace: =
/lib/i686/nosegneg/libc.so.6[0x8ce1e5]
/lib/i686/nosegneg/libc.so.6(cfree+0x59)[0x8ce629]
shp2pgsql[0x805223b]
shp2pgsql[0x8052f4f]
/lib/i686/nosegneg/libc.so.6(__libc_start_main+0xdc)[0x879e9c]
shp2pgsql[0x80499f1]
=== Memory map: 
0011-00112000 r-xp  fd:00 111345672  /usr/lib/gconv/CP1252.so
00112000-00114000 rw-p 1000 fd:00 111345672  /usr/lib/gconv/CP1252.so
007a9000-007b4000 r-xp  fd:00 14188620 
/lib/libgcc_s-4.1.2-20080825.so.1
007b4000-007b5000 rw-p a000 fd:00 14188620 
/lib/libgcc_s-4.1.2-20080825.so.1

00845000-0086 r-xp  fd:00 14188551   /lib/ld-2.5.so
0086-00861000 r--p 0001a000 fd:00 14188551   /lib/ld-2.5.so
00861000-00862000 rw-p 0001b000 fd:00 14188551   /lib/ld-2.5.so
00864000-009ba000 r-xp  fd:00 14188553 
/lib/i686/nosegneg/libc-2.5.so
009ba000-009bc000 r--p 00155000 fd:00 14188553 
/lib/i686/nosegneg/libc-2.5.so
009bc000-009bd000 rw-p 00157000 fd:00 14188553 
/lib/i686/nosegneg/libc-2.5.so

009bd000-009c rw-p 009bd000 00:00 0
009c9000-009f r-xp  fd:00 14189781 
/lib/i686/nosegneg/libm-2.5.so
009f-009f1000 r--p 00026000 fd:00 14189781 
/lib/i686/nosegneg/libm-2.5.so
009f1000-009f2000 rw-p 00027000 fd:00 14189781 
/lib/i686/nosegneg/libm-2.5.so

00caa000-00cab000 r-xp 00caa000 00:00 0  [vdso]
08048000-08079000 r-xp  fd:00 82688766   /usr/bin/shp2pgsql
08079000-0807a000 rw-p 00031000 fd:00 82688766   /usr/bin/shp2pgsql
08b8c000-08bad000 rw-p 08b8c000 00:00 0
b7f73000-b7fbe000 rw-p b7f73000 00:00 0
b7fc1000-b7fc2000 rw-p b7fc1000 00:00 0
b7fc2000-b7fc9000 r--s  fd:00 82739843 
/usr/lib/gconv/gconv-modules.cache

b7fc9000-b7fcd000 rw-p b7fc9000 00:00 0
bfa09000-bfa1e000 rw-p bffea000 00:00 0  [stack]
Aborted
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql control over Z and M loading

2010-09-04 Thread Stephen Woodbridge

Hi All's,

I wondering if anyone has thought about adding more control over the 
loading of shapes with regard to Z and M values. I thinking about 
something like adding options to the cli:


-z 0|1
-m 0|1

The behavior of these would be if they are not used then the same 
behavior as now.


0 - would force that dimension off regardless of the shape data
1 - would force adding that dimension regardless of the shape data and
if the shape does not include that dimension it would default to 0.0

In addition, the_geom column would be created with the exact dimensions 
used:


2 - x,y
3 - x,y,z
3 - x,y,m
4 - x,y,z,m

I assume this is possible.

Currently shp2pgsql always creates dims=4 for an ArcZ shapefile and it 
seems like it should be create dims=3 since it is not using the M.


The motivation behind this is saving space on large data sets. I have a 
33 GB shapefile data set in Arc, which grows to 36 GB for ArcZ. I 
assume, maybe wrongly, that loading this will add the equivalent to 3 GB 
more for the M dimension in the database. While this 10% waste is not 
horrid, it will impact performance and data transfer time and this is 
getting used in a web application.


Any thoughts on this would be appreciated.
Anyone interested in tackling this?

-Steve W
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql fails on malformed integer attribute

2010-08-15 Thread Andrea Peri
>I don't quite understand your example :
>
>"if the field numeric in the shapefile instead of be fill with numbers was 
>filled with '1', '2', '3', etc...
>where the number are however not really numbers but text based, an action of 
>importing always 0.

>Will be more confusing. The user don't understand why a number (or 
>simil-number) became a '0'."
>
>In the DBF file itself, there is no difference between a 'text-based number' 
>and normal numbers. Whether I declare the column as numeric or text, the data 
>for the number one (1) will look the same. That will never be an issue.


Hi,

Unfortunately some difference in the declaration there are.

the dbf specific are bit old-style and so are no fully coherent.

See-ing the specific for the DBF III version (
http://www.wotsit.org/download.asp?f=dbase&sc=335163169 )


The char fields must contains always a set of chars filled with
spaces. Not \0 termined.

Unfortunately a quite famous tools of that time (clipper) redefine the
db3 format (called xbase format) with a their version using the \0 to
terminate the

strings. (I think - to avoid the copyright put on the db3 format from
original owner ashton-tate)

So now there are tools that use the \0 terminate strings and tools
that use the space-fill for the text fields.


Instead for a numeric field nothing is say about how it must be filled
because it is assume is always filled with digits.

But if you put a text based value "27.57" in a numeric field of 18 digit.

You can have many ambiguos situations


For a 10.5 numeric field , I think the right version will be this
"0027.57000"

or

"27" (i think but I'm not sure) for a numeric 6.0 field

so no space based and no \0 terminated because nothing is say about
this in db3 format.


instead if it is text based it can be for example:

"27.57\0" and the remainis are spurious digits -> "27.57\0123"
or
"27.57" + "some spurious values" -> "27.57436x6"


or for the 6.0 numeric field

"27" or "27\0**"

Another situation where the interpretation is really impossibile is
the Logical Field.

In the db3 format It is define exactly with 1 chars using one of this:
(YyNnTtFf space)

But if I find a 'S' char value in a logical field of a db3.

I cannot decide if it is a true of false value.
So use a default to a False or True value is always an opinion.

Andrea.

-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql fails on malformed integer attribute

2010-08-14 Thread Aman Verma
Hi,

I understand why would you be reluctant to do automatic correction. However, 
the shapelib library, which shp2pgsql directly uses, does do automatic 
correction.

I agree: any mistake in the dbf should be reported. However, I believe that, at 
the very least, a switch should be supported that allows automatic conversion.

I don't quite understand your example :

"if the field numeric in the shapefile instead of be fill with numbers was 
filled with '1', '2', '3', etc...
where the number are however not really numbers but text based, an action of 
importing always 0.
Will be more confusing. The user don't understand why a number (or 
simil-number) became a '0'."

In the DBF file itself, there is no difference between a 'text-based number' 
and normal numbers. Whether I declare the column as numeric or text, the data 
for the number one (1) will look the same. That will never be an issue.

It is interesting that you bring up other examples of corrupt DBFs: I believe 
that shapelib actually handles some of those examples.

I agree with you that nothing should be 'hidden'. I think the behaviour should 
conform to shapelib, which it already mostly does. At the very least, the DBF 
should be checked for this kind of corruption, and reported.

aman

From: postgis-users-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Andrea Peri
Sent: August 14, 2010 3:18 AM
To: PostGIS Users Discussion
Subject: [postgis-users] shp2pgsql fails on malformed integer attribute

>  aman.verma at mcgill.ca<http://mcgill.ca>  wrote..
>If you use shp2pgsql to upload a shapefile with an attribute table that has a 
>malformed integer
>(like a letter), shp2pgsql will not correct it, and the upload will fail.
>Normally, I would view this as 'expected behaviour' (garbage in, garbage out). 
>However, I have two
>reasons to believe that shp2pgsql should do the correction:
>1) ArcGIS, and other software that read the xBase format (DBF), interpret such 
>malformed integers as 0.
>There seem to be a lot of shape files floating around that have malformed 
>integers in them, precisely
>because they appear to be working. Users may have a difficult time 
>understanding why shp2pgsql keeps
>trying to upload 'g' when all they can see is '0'.

I think this is not a good strategy.

If there a mistake in the dbf the mistake must be reported, not hide resolving 
automatically it.
Otherwise the shapefile version became not-interoperability.
Just now often the gis user was speaken about "shapefile read from arcgis" or 
some other tools, as they was difference from other kind of shapefile.

I experience many situation where a shapefile send me from other users are 
wrong, and the user report me "but my tool read it so for me it is  ok."

This may be born many kinds of formats shapefiles difference each other.
So the shapefile format "became an opinion", and every tool apply they specific 
changing to the format.
For example

what if a filed name was more then 10 character ?
what if a text field was more character of how much declared in the header ?
what if a date field was filled with a number ?
and so on .

Even in your case:

if the field numeric in the shapefile instead of be fill with numbers was 
filled with '1', '2', '3', etc...
where the number are however not really numbers but text based, an action of 
importing always 0.
Will be more confusing. The user don't understand why a number (or 
simil-number) became a '0'.

Andrea.

--
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql fails on malformed integer attribute

2010-08-14 Thread Andrea Peri
>  aman.verma at mcgill.ca  wrote..
>If you use shp2pgsql to upload a shapefile with an attribute table that has
a malformed integer
>(like a letter), shp2pgsql will not correct it, and the upload will fail.
>Normally, I would view this as 'expected behaviour' (garbage in, garbage
out). However, I have two
>reasons to believe that shp2pgsql should do the correction:
>1) ArcGIS, and other software that read the xBase format (DBF), interpret
such malformed integers as 0.
>There seem to be a lot of shape files floating around that have malformed
integers in them, precisely
>because they appear to be working. Users may have a difficult time
understanding why shp2pgsql keeps
>trying to upload 'g' when all they can see is '0'.

I think this is not a good strategy.

If there a mistake in the dbf the mistake must be reported, not hide
resolving automatically it.
Otherwise the shapefile version became not-interoperability.
Just now often the gis user was speaken about "shapefile read from arcgis"
or some other tools, as they was difference from other kind of shapefile.

I experience many situation where a shapefile send me from other users are
wrong, and the user report me "but my tool read it so for me it is  ok."

This may be born many kinds of formats shapefiles difference each other.
So the shapefile format "became an opinion", and every tool apply they
specific changing to the format.
For example

what if a filed name was more then 10 character ?
what if a text field was more character of how much declared in the header ?
what if a date field was filled with a number ?
and so on .

Even in your case:

if the field numeric in the shapefile instead of be fill with numbers was
filled with '1', '2', '3', etc...
where the number are however not really numbers but text based, an action of
importing always 0.
Will be more confusing. The user don't understand why a number (or
simil-number) became a '0'.

Andrea.

-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql fails on malformed integer attribute

2010-08-13 Thread Paul Ramsey
Aman,
Thanks for the informative post. Could you put the relevant parts and
your example file into the issue tracker at

http://trac.osgeo.org/postgis

so we have a record of it? I can see the benefit in handling data in
the "way others do" for maximum ease of use.
Yours,
Paul

On Fri, Aug 13, 2010 at 6:13 PM, Aman Verma  wrote:
> Hi everybody,
>
> This is my first post to the list. Please let me know (flame) if this is not 
> a suitable place to post.
>
> If you use shp2pgsql to upload a shapefile with an attribute table that has a 
> malformed integer (like a letter), shp2pgsql will not correct it, and the 
> upload will fail.
>
> Normally, I would view this as 'expected behaviour' (garbage in, garbage 
> out). However, I have two reasons to believe that shp2pgsql should do the 
> correction:
>
> 1) ArcGIS, and other software that read the xBase format (DBF), interpret 
> such malformed integers as 0. There seem to be a lot of shape files floating 
> around that have malformed integers in them, precisely because they appear to 
> be working. Users may have a difficult time understanding why shp2pgsql keeps 
> trying to upload 'g' when all they can see is '0'.
>
> 2) shapelib, the library that shp2pgsql uses to read the shapefiles, will 
> also interpret malformed integers as zeroes, provided the appropriate 
> function is used. (http://shapelib.maptools.org/dbf_api.html - see 
> DBFReadIntegerAttribute). I assume this decision was made to conform to how 
> Arc handles them.
>
> Although shp2pgsql uses the shapelib library to read shape files, it opts to 
> use the DBFReadStringAttribute function to read integers and doubles (see the 
> ShpLoaderGenerateSQLRowStatement function about line 1537 in the current 
> source shp2pgsql-core.c). I can't really understand why, when there is a 
> perfectly good integer reading function available.
>
> I suggest that the code for shp2pgsql be changed to use the 
> DBFReadIntegerAttribute function for integers, and the DBFReadDoubleAttribute 
> function for doubles. If that is unappealing for other reasons, perhaps the 
> current code could be modified to detect when the attribute is not a number, 
> and convert it to a zero. Alternatively, if this is not desired as default 
> behaviour an optional switch on the command line would be helpful to convert 
> malformed integers.
>
> You can find an example of a shapefile with a malformed integer here:
>
> http://aman.koumbit.org/arret2.zip
>
> This file contains a shapefile that has a single point. The point has two 
> attributes, ID and VANDAL. Both are integers. The VANDAL attribute is set to 
> the letter 'g'. ArcGIS, and other DBF viewing software, interpret this as 0.
>
> I am using the 1.5 (RCSID: $Id: shp2pgsql-core.h 5098 2010-01-04 05:47:04Z 
> pramsey) release of shp2pgsql, on the Windows platform.
>
> Thanks everybody,
> aman
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql fails on malformed integer attribute

2010-08-13 Thread Aman Verma
Hi everybody,

This is my first post to the list. Please let me know (flame) if this is not a 
suitable place to post.

If you use shp2pgsql to upload a shapefile with an attribute table that has a 
malformed integer (like a letter), shp2pgsql will not correct it, and the 
upload will fail.

Normally, I would view this as 'expected behaviour' (garbage in, garbage out). 
However, I have two reasons to believe that shp2pgsql should do the correction:

1) ArcGIS, and other software that read the xBase format (DBF), interpret such 
malformed integers as 0. There seem to be a lot of shape files floating around 
that have malformed integers in them, precisely because they appear to be 
working. Users may have a difficult time understanding why shp2pgsql keeps 
trying to upload 'g' when all they can see is '0'.

2) shapelib, the library that shp2pgsql uses to read the shapefiles, will also 
interpret malformed integers as zeroes, provided the appropriate function is 
used. (http://shapelib.maptools.org/dbf_api.html - see 
DBFReadIntegerAttribute). I assume this decision was made to conform to how Arc 
handles them.

Although shp2pgsql uses the shapelib library to read shape files, it opts to 
use the DBFReadStringAttribute function to read integers and doubles (see the 
ShpLoaderGenerateSQLRowStatement function about line 1537 in the current source 
shp2pgsql-core.c). I can't really understand why, when there is a perfectly 
good integer reading function available.

I suggest that the code for shp2pgsql be changed to use the 
DBFReadIntegerAttribute function for integers, and the DBFReadDoubleAttribute 
function for doubles. If that is unappealing for other reasons, perhaps the 
current code could be modified to detect when the attribute is not a number, 
and convert it to a zero. Alternatively, if this is not desired as default 
behaviour an optional switch on the command line would be helpful to convert 
malformed integers.

You can find an example of a shapefile with a malformed integer here:

http://aman.koumbit.org/arret2.zip

This file contains a shapefile that has a single point. The point has two 
attributes, ID and VANDAL. Both are integers. The VANDAL attribute is set to 
the letter 'g'. ArcGIS, and other DBF viewing software, interpret this as 0.

I am using the 1.5 (RCSID: $Id: shp2pgsql-core.h 5098 2010-01-04 05:47:04Z 
pramsey) release of shp2pgsql, on the Windows platform.

Thanks everybody,
aman
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-17 Thread Bob Pawley

Hi Regina

shp2pgsql.c 4867? 2009-1-20 ncayland $ Release: 1.4

It came with my brand new 8.4 download with which I have had more install 
and "getting going" problems than any other Postgresql download.


Not being anywhere near a Postgresql expert these problems take me a lot of 
time to overcome.


I applaud those who are working on them.

Bob



--
From: "Paragon Corporation" 
Sent: Friday, July 16, 2010 10:19 PM
To: "'PostGIS Users Discussion'" 
Subject: Re: [postgis-users] shp2pgsql


Bob,

Copy is better.  So copy the file as William said, and rename the new copy
libiconv2.dll.

Some programs refer to it by libiconv-2.dll and some as libiconv2.dll. 
It's

a complicated story, but they  are generally interchangeable.

However if you simply rename the existing, you'll break some other
application.

Its sounds like you are running an older shp2pgsql though because I think 
in
later versions we changed to libiconv-2.dll to be consistent with 
PostgreSQL

windows build

Can you when you have your system working, at dos prompt do a

shp2pgsql

And let us know the version number it returns at top.

It's the part that reads like

RCSID: $Id: shp2pgsql-core.h 5098 2010-01-04 05:47:04Z pramsey $ RELEASE:
1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1


Thanks,
Leo and Regina
http://www.postgis.us




-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Bob
Pawley
Sent: Friday, July 16, 2010 12:46 PM
To: w...@thearete.co.uk; PostGIS Users Discussion
Subject: Re: [postgis-users] shp2pgsql

I'm not sure what you mean by - "copy libiconv-2.dll to

libiconv2.dll."


Do you mean rename??

Bob



--
From: "William Furnass" 
Sent: Friday, July 16, 2010 9:00 AM
To: "PostGIS Users Discussion" 
Subject: Re: [postgis-users] shp2pgsql


Hi Bob,

On 16 July 2010 16:46, Bob Pawley  wrote:


I just attempted to use shp2pgsql and received an error message about
libiconv2.dll  not being installed on my computer.


If you've got PostgreSQL installed then you should already have a copy
of the library.  Find the 'bin' directory within your PostgreSQL
installation e.g. C:\PostgreSQL\8.4\bin and copy libiconv-2.dll to
libiconv2.dll.  Also, make sure that your PATH variable includes that
'bin' directory (check with 'echo %PATH%' from a DOS prompt).

HTH,

Will
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-16 Thread Paragon Corporation
 Bob,

Copy is better.  So copy the file as William said, and rename the new copy
libiconv2.dll.

Some programs refer to it by libiconv-2.dll and some as libiconv2.dll.  It's
a complicated story, but they  are generally interchangeable.

However if you simply rename the existing, you'll break some other
application.

Its sounds like you are running an older shp2pgsql though because I think in
later versions we changed to libiconv-2.dll to be consistent with PostgreSQL
windows build

Can you when you have your system working, at dos prompt do a 

shp2pgsql 

And let us know the version number it returns at top.

It's the part that reads like

RCSID: $Id: shp2pgsql-core.h 5098 2010-01-04 05:47:04Z pramsey $ RELEASE:
1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1


Thanks,
Leo and Regina
http://www.postgis.us




-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Bob
Pawley
Sent: Friday, July 16, 2010 12:46 PM
To: w...@thearete.co.uk; PostGIS Users Discussion
Subject: Re: [postgis-users] shp2pgsql

I'm not sure what you mean by - "copy libiconv-2.dll to
> libiconv2.dll."

Do you mean rename??

Bob



--
From: "William Furnass" 
Sent: Friday, July 16, 2010 9:00 AM
To: "PostGIS Users Discussion" 
Subject: Re: [postgis-users] shp2pgsql

> Hi Bob,
> 
> On 16 July 2010 16:46, Bob Pawley  wrote:
>>
>> I just attempted to use shp2pgsql and received an error message about 
>> libiconv2.dll  not being installed on my computer.
> 
> If you've got PostgreSQL installed then you should already have a copy 
> of the library.  Find the 'bin' directory within your PostgreSQL 
> installation e.g. C:\PostgreSQL\8.4\bin and copy libiconv-2.dll to 
> libiconv2.dll.  Also, make sure that your PATH variable includes that 
> 'bin' directory (check with 'echo %PATH%' from a DOS prompt).
> 
> HTH,
> 
> Will
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-16 Thread Bob Pawley

I'm not sure what you mean by - "copy libiconv-2.dll to

libiconv2.dll."


Do you mean rename??

Bob



--
From: "William Furnass" 
Sent: Friday, July 16, 2010 9:00 AM
To: "PostGIS Users Discussion" 
Subject: Re: [postgis-users] shp2pgsql


Hi Bob,

On 16 July 2010 16:46, Bob Pawley  wrote:


I just attempted to use shp2pgsql and received an error message about
libiconv2.dll  not being installed on my computer.


If you've got PostgreSQL installed then you should already have a copy
of the library.  Find the 'bin' directory within your PostgreSQL
installation e.g. C:\PostgreSQL\8.4\bin and copy libiconv-2.dll to
libiconv2.dll.  Also, make sure that your PATH variable includes that
'bin' directory (check with 'echo %PATH%' from a DOS prompt).

HTH,

Will
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-16 Thread Bob Pawley
I did find in the bin file but it is named libiconv-2 and the error was 
looking for libiconv2.


Is there a way around this??

Bob

--
From: "Mark Cave-Ayland" 
Sent: Friday, July 16, 2010 8:57 AM
To: "PostGIS Users Discussion" 
Subject: Re: [postgis-users] shp2pgsql


Bob Pawley wrote:


Hi
 I just attempted to use shp2pgsql and received an error message about 
libiconv2.dll  not being installed on my computer.
 Can anyone suggest where a clean copy can be found and instructions on 
how to install it??

 Bob


Hi Bob,

It's included with the PostGIS windows installer, and can normally be 
found in the PostgreSQL bin directory once the installer has been run.



HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users 


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-16 Thread William Furnass
Hi Bob,

On 16 July 2010 16:46, Bob Pawley  wrote:
>
> I just attempted to use shp2pgsql and received an error message about
> libiconv2.dll  not being installed on my computer.

If you've got PostgreSQL installed then you should already have a copy
of the library.  Find the 'bin' directory within your PostgreSQL
installation e.g. C:\PostgreSQL\8.4\bin and copy libiconv-2.dll to
libiconv2.dll.  Also, make sure that your PATH variable includes that
'bin' directory (check with 'echo %PATH%' from a DOS prompt).

HTH,

Will
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2010-07-16 Thread Mark Cave-Ayland

Bob Pawley wrote:


Hi
 
I just attempted to use shp2pgsql and received an error message about 
libiconv2.dll  not being installed on my computer.
 
Can anyone suggest where a clean copy can be found and instructions on 
how to install it??
 
Bob


Hi Bob,

It's included with the PostGIS windows installer, and can normally be 
found in the PostgreSQL bin directory once the installer has been run.



HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql

2010-07-16 Thread Bob Pawley
Hi 

I just attempted to use shp2pgsql and received an error message about 
libiconv2.dll  not being installed on my computer.

Can anyone suggest where a clean copy can be found and instructions on how to 
install it??

Bob___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql date quirk

2010-07-09 Thread Mark Cave-Ayland

Brian Hamlin wrote:


 I am importing several large shape files, into pg 8.4 postgis 1.5+
most went in fine, but the last one failed with an error regarding date 
fields.

At least one date field entry in the shape file apparently is "0"
pg complains, the conversion fails..
"Maybe you need different date settings" is suggested..

the database I am importing into already has 60+ tables..
I dont want to change settings on that database to accommodate..

suggestions on an efficient work-around?
thanks
  -Brian


Hi Brian,

Could you provide us with a shapefile/dbf file containing a few of the 
entries in question?



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql date quirk

2010-07-09 Thread Brian Hamlin

 I am importing several large shape files, into pg 8.4 postgis 1.5+
most went in fine, but the last one failed with an error regarding date 
fields.

At least one date field entry in the shape file apparently is "0"
pg complains, the conversion fails..
"Maybe you need different date settings" is suggested..

the database I am importing into already has 60+ tables..
I dont want to change settings on that database to accommodate..

suggestions on an efficient work-around?
thanks
  -Brian


==
Brian Hamlin
planetwork.net
OSGeo California Chapter
(415) 717-4462 cell

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql in quite mode????...(shp2pgsql -q)???

2010-03-29 Thread Nicolas Gillet - MARKET-IP
Hello,

 

Indeed there is no “-q”.

But are you sure that it actually is shp2pgsql that you want to quiet down
? (there are at most 15 lines)

I think that what can annoy you is the output from the psql that usually is
piped behind shp2pgsql.

Psql do have a “-q” parameter.

e.g. : 

shp2pgsql -W utf-8 -s 4326 -d -I /path/to/some/shp my_table | psql -q -d
my_database -h host -U user

 

That’s the command I used most of the time.

 

If you really want to remove shp2pgsql output I think that your only option
is using something like “command > null” to redirect the ouput nowhere.

 

Hope this helps.

 

Nicolas

 

De : postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] De la part de
Shreerang Patwardhan
Envoyé : lundi 29 mars 2010 12:44
À : Pune GNU/Linux Users Group Mailing List; PostGIS Users Discussion
Objet : [postgis-users] shp2pgsql in quite mode...(shp2pgsql -q)???

 

Hey all,
 I do not wish to display the output of the command shp2pgsql at the
terminal. I want the command to run in quite mode. But there is no -q option
for shp2pgsql. How do I get around this issue?


Thanx,
Shreerang Patwardhan.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql in quite mode????...(shp2pgsql -q)???

2010-03-29 Thread Mark Cave-Ayland

Shreerang Patwardhan wrote:


Hey all,
 I do not wish to display the output of the command shp2pgsql at the 
terminal. I want the command to run in quite mode. But there is no -q 
option for shp2pgsql. How do I get around this issue?


Perhaps something like:

shp2pgsql ... > /dev/null  or
shp2pgsql ... 2>&1 > /dev/null


HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql in quite mode????...(shp2pgsql -q)???

2010-03-29 Thread Shreerang Patwardhan
Hey all,
 I do not wish to display the output of the command shp2pgsql at the
terminal. I want the command to run in quite mode. But there is no -q option
for shp2pgsql. How do I get around this issue?


Thanx,
Shreerang Patwardhan.
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2009-12-10 Thread pcreso

On a linux platform you can use:

shp2pgsql -a [...] | sed 's/text/klassen/g' | psql -d 

under Windows you can run shp2pgsql -a [...] > file.sql

then edit file.sql & do a search/replace on "text" to "klassen"

then run psql -d  -f file.sql



Always assuming the word "text" is only ever used as the column name.
If this is not the case, then you will need to edit the file & check each 
search/replace occurrence.

Or you can use a temporary table (tab2) to insert the data into using 
shp2pgsql, then in your database run:

insert into tab1 select * from tab2;
drop table tab2; 


HTH,

  Brent Wood

--- On Thu, 12/10/09, MisterX  wrote:

> From: MisterX 
> Subject: [postgis-users] shp2pgsql
> To: postgis-users@postgis.refractions.net
> Date: Thursday, December 10, 2009, 10:23 PM
> Hi,
> 
> my problem is, that i have a database table with two
> columns with the name klassen ant the_geom. In my shapefile
> the columns called text and the_geom. Now I want to append
> the shapefile on the database table, but how can I tell the
> shapeloader that the column text affiliate to the colum
> klassen?
> 
> shapefile database
> Table    
> --> text    --> klassen  
> --> the_geom                --> the_geom
>  
> Can anybody help me with this problem?
> 
> 
> Thank you very much.
> 
> MisterX
> 
> 
> -Inline Attachment Follows-
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2009-12-10 Thread Nicolas Gillet - MARKET-IP
Hello,

 

You could temporary rename your database column to match the shape’s column
name.

 

Then if your column need to be called “Klassen” for other use, you can
rename it back to “Klassen” or whatever name you need.

 

Hope it helps

 

Nicolas.

 

De : postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] De la part de MisterX
Envoyé : jeudi 10 décembre 2009 10:23
À : postgis-users@postgis.refractions.net
Objet : [postgis-users] shp2pgsql

 

Hi,

my problem is, that i have a database table with two columns with the name
klassen ant the_geom. In my shapefile the columns called text and the_geom.
Now I want to append the shapefile on the database table, but how can I tell
the shapeloader that the column text affiliate to the colum klassen?
shapefile database Table
--> text --> klassen  
--> the_geom--> the_geom  
Can anybody help me with this problem?

Thank you very much.

MisterX

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql

2009-12-10 Thread MisterX
Hi,

my problem is, that i have a database table with two columns with the name
klassen ant the_geom. In my shapefile the columns called text and the_geom.
Now I want to append the shapefile on the database table, but how can I tell
the shapeloader that the column text affiliate to the colum klassen?
shapefile database Table
--> text --> klassen
--> the_geom--> the_geom
Can anybody help me with this problem?

Thank you very much.

MisterX
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql option -k

2009-12-09 Thread Kevin Neufeld

You should be able to specify it like any of the other options.

http://postgis.refractions.net/documentation/manual-1.5SVN/ch04.html#shp2pgsql_usage

-- Kevin

MisterX wrote:

Hi everybody,

I'm a question for use the shp2pgsql loader.
Have anybody an example for the option -k.
How can I use this option?

Thank you very much for your answer.

Greating MisterX




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql option -k

2009-12-09 Thread MisterX
Hi everybody,

I'm a question for use the shp2pgsql loader.
Have anybody an example for the option -k.
How can I use this option?

Thank you very much for your answer.

Greating MisterX
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql encoding problem - Thai Language

2009-09-16 Thread Ben Madin

Thanks Mark,

On 16/09/2009, at 16:30 , Mark Cave-Ayland wrote:

AFAICT shp2pgsql always outputs UTF-8 encoded text whenever the  
input encoding is specified via the -W option.


OK - I completely misunderstood that bit.

Note that shp2pgsql uses its own iconv conversion routines, and not  
the PostgreSQL conversion routines. Hence if you take a look at the  
iconv documentation here: http://www.gnu.org/software/libiconv/ you  
can see that ISO-8859-11 is actually supported as a -W parameter.


Fantastic - I had just (for no reason) assumed it to be the same as  
PostgreSQL.


Once your output file has been produced, you should be able to run  
it directly into a UTF-8 encoded database without any problems. I do  
agree that the documentation on this is a little vague though (I had  
to refer to the source to see what was happening...)


Yes - after a quick seg fault trying to import a dbf file I had tried  
to convert to utf-8 using openoffice, it worked perfectly on the  
original file. Brilliant, thank you again.


I'm off to try it with the Chinese ones as well!

cheers

Ben


--

Ben Madin
REMOTE INFORMATION

t : +61 8 9192 5455
f : +61 8 9192 5535
m : 0448 887 220
Broome   WA   6725

b...@remoteinformation.com.au



Out here, it pays to 
know...


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql encoding problem - Thai Language

2009-09-16 Thread Mark Cave-Ayland

Ben Madin wrote:


G'day all,

I have a set of boundaries, with the locations in Thai. As best as I can 
tell, the encoding is ISO-8559-11 (not an official encoding, but similar 
to other latin/non-latin encodings)


does that mean I'm stumped when it comes to importing it using 
shp2pgsql. I normally set -W UTF-8, but in this case I get utf8: Illegal 
byte sequence. (the db is utf-8)


If I try using -W WIN874 (the only option in the postgres manual that 
mentions Thai) I get utf8: iconv_open: Invalid argument


Is this a hopeless case - do I need to (can I?) edit the .dbf file to 
remove the columns with the Thai encoding and then type them all back 
in!? Is there another way?


cheers

Ben


Hi Ben,

AFAICT shp2pgsql always outputs UTF-8 encoded text whenever the input 
encoding is specified via the -W option.


Note that shp2pgsql uses its own iconv conversion routines, and not the 
PostgreSQL conversion routines. Hence if you take a look at the iconv 
documentation here: http://www.gnu.org/software/libiconv/ you can see 
that ISO-8859-11 is actually supported as a -W parameter.


Once your output file has been produced, you should be able to run it 
directly into a UTF-8 encoded database without any problems. I do agree 
that the documentation on this is a little vague though (I had to refer 
to the source to see what was happening...)



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql encoding problem - Thai Language

2009-09-15 Thread Paul Hastings

Ben Madin wrote:
can tell, the encoding is ISO-8559-11 (not an official encoding, but  
similar to other latin/non-latin encodings)


iso-8859-11 *is* an "official" encoding but depending on where you got the data, 
it's more likely to be windows-874 or TIS-620 codepages. or could even be mac 
thai (though not likely, nobody i know *here* uses a mac for any GIS work but 
you never know). i can't actually recall there being any difference between 
these codepages but MS sure likes to do supersets, so better double check.


Is this a hopeless case - do I need to (can I?) edit the .dbf file to  
remove the columns with the Thai encoding and then type them all back  
in!? Is there another way?


i normally pull out non-unicode text into a file, convert that to utf-8, import 
& update the real data. i also recall qgis being able to handle this too.


just for thai:
http://www.lyndonhill.com/Projects/thaiconv.html

or better yet:
http://www.melody-soft.com/html/unifier.html
best $20 you'll ever spend...
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql encoding problem - Thai Language

2009-09-15 Thread Ben Madin

G'day all,

I have a set of boundaries, with the locations in Thai. As best as I  
can tell, the encoding is ISO-8559-11 (not an official encoding, but  
similar to other latin/non-latin encodings)


does that mean I'm stumped when it comes to importing it using  
shp2pgsql. I normally set -W UTF-8, but in this case I get utf8:  
Illegal byte sequence. (the db is utf-8)


If I try using -W WIN874 (the only option in the postgres manual that  
mentions Thai) I get utf8: iconv_open: Invalid argument


Is this a hopeless case - do I need to (can I?) edit the .dbf file to  
remove the columns with the Thai encoding and then type them all back  
in!? Is there another way?


cheers

Ben


--

Ben Madin
REMOTE INFORMATION

t : +61 8 9192 5455
f : +61 8 9192 5535
m : 0448 887 220
Broome   WA   6725

b...@remoteinformation.com.au



Out here, it pays to 
know...


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql not working

2009-08-04 Thread Mark Cave-Ayland

Ravi wrote:


Hi,
shp2pgsql is again not working. Just a couple of days ago I thought not using
-i in the options makes it work. But in vain.
shp2pgsql –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
gives 'Access Denied'.

Ravi


Sorry, but if you see this with different option combinations then it's 
just a standard file permissions issue. Check your file permissions 
carefully.



HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql not working

2009-08-02 Thread Ravi

Hi,
shp2pgsql is again not working. Just a couple of days ago I thought not using
-i in the options makes it work. But in vain.
shp2pgsql –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
gives 'Access Denied'.

Ravi


  Yahoo! recommends that you upgrade to the new and safer Internet Explorer 
8. http://downloads.yahoo.com/in/internetexplorer/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql Solved

2009-07-29 Thread Mark Cave-Ayland

Paragon Corporation wrote:


Ravi,

Shouldn't be.  The -i in shp2pgsql is  to use int4 (not the version of psql
or anything of that sort).  I don't believe that has changed in a while.
  Not quite sure how that would play a role, though could I guess if int
behavior has changed between 8.2/8.4

Leo


Hmmm this looks like the issue we had a while back, whereby the 
pgis_getopt()/getopt() function struggles on some platforms - although I 
thought Paul's last set of fixes had resolved this :(



ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql Solved

2009-07-28 Thread Ravi

Hi Leo,
but it is a fact would like to probe why..
Data file available at
http://2007.foss4g.org/workshops/W-04/data.zip
bc_roads.shp

Ravi

--- On Wed, 29/7/09, Paragon Corporation  wrote:

> From: Paragon Corporation 
> Subject: Re: [postgis-users] shp2pgsql Solved
> To: "'PostGIS Users Discussion'" 
> Date: Wednesday, 29 July, 2009, 3:18 AM
> Ravi,
> 
> Shouldn't be.  The -i in shp2pgsql is  to use
> int4 (not the version of psql
> or anything of that sort).  I don't believe that has
> changed in a while.
>   Not quite sure how that would play a role, though
> could I guess if int
> behavior has changed between 8.2/8.4
> 
> Leo
> 
> -Original Message-
> From: postgis-users-boun...@postgis.refractions.net
> [mailto:postgis-users-boun...@postgis.refractions.net]
> On Behalf Of Ravi
> Sent: Tuesday, July 28, 2009 5:38 PM
> To: postgis
> Subject: Re: [postgis-users] shp2pgsql Solved
> 
> 
> Hi,
> shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs >
> bc_pubs.sql this issues an
> error from command prompt > Error: 'Access Denied'
> 
> Removing -i makes it work..
> shp2pgsql  –D -s 3005 bc_pubs.shp bcpubs >
> bc_pubs.sql
> 
> Is this because I use a much advanced Pgsql 8.3
> 
> and the exercise attempted includes postgresql-8.2.msi only
> ?
> 
> Ravi
> 
> 
> 
> --- On Mon, 27/7/09, Ravi 
> wrote:
> 
> > From: Ravi 
> > Subject: shp2pgsql
> > To: "postgis" 
> > Date: Monday, 27 July, 2009, 4:22 AM
> > Hi,
> > trying to create an SQL for a shape file.
> > shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs >
> bc_pubs.sql this issues 
> > an error from command prompt
> > Error: 'Access Denied'
> > 
> > My Vista user = Ravi
> > PostGIS user = postgres
> > 
> > any suggestions pl
> > Ravi
> > 
> > 
> >       See the Web's breaking stories,
> > chosen by people like you. Check out Yahoo! Buzz. 
> > http://in.buzz.yahoo.com/
> > 
> 
> 
>       See the Web's breaking stories,
> chosen by people like you. Check
> out Yahoo! Buzz. http://in.buzz.yahoo.com/
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 


  Yahoo! recommends that you upgrade to the new and safer Internet Explorer 
8. http://downloads.yahoo.com/in/internetexplorer/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql Solved

2009-07-28 Thread Paragon Corporation
Ravi,

Shouldn't be.  The -i in shp2pgsql is  to use int4 (not the version of psql
or anything of that sort).  I don't believe that has changed in a while.
  Not quite sure how that would play a role, though could I guess if int
behavior has changed between 8.2/8.4

Leo

-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Ravi
Sent: Tuesday, July 28, 2009 5:38 PM
To: postgis
Subject: Re: [postgis-users] shp2pgsql Solved


Hi,
shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql this issues an
error from command prompt > Error: 'Access Denied'

Removing -i makes it work..
shp2pgsql  –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql

Is this because I use a much advanced Pgsql 8.3

and the exercise attempted includes postgresql-8.2.msi only ?

Ravi



--- On Mon, 27/7/09, Ravi  wrote:

> From: Ravi 
> Subject: shp2pgsql
> To: "postgis" 
> Date: Monday, 27 July, 2009, 4:22 AM
> Hi,
> trying to create an SQL for a shape file.
> shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql this issues 
> an error from command prompt
> Error: 'Access Denied'
> 
> My Vista user = Ravi
> PostGIS user = postgres
> 
> any suggestions pl
> Ravi
> 
> 
>       See the Web's breaking stories,
> chosen by people like you. Check out Yahoo! Buzz. 
> http://in.buzz.yahoo.com/
> 


  See the Web's breaking stories, chosen by people like you. Check
out Yahoo! Buzz. http://in.buzz.yahoo.com/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql Solved

2009-07-28 Thread Ravi

Hi,
shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
this issues an error from command prompt > Error: 'Access Denied'

Removing -i makes it work..
shp2pgsql  –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql

Is this because I use a much advanced Pgsql 8.3

and the exercise attempted includes postgresql-8.2.msi only ?

Ravi



--- On Mon, 27/7/09, Ravi  wrote:

> From: Ravi 
> Subject: shp2pgsql
> To: "postgis" 
> Date: Monday, 27 July, 2009, 4:22 AM
> Hi,
> trying to create an SQL for a shape file.
> shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs >
> bc_pubs.sql
> this issues an error from command prompt
> Error: 'Access Denied'
> 
> My Vista user = Ravi
> PostGIS user = postgres
> 
> any suggestions pl
> Ravi
> 
> 
>       See the Web's breaking stories,
> chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/
> 


  See the Web's breaking stories, chosen by people like you. Check out 
Yahoo! Buzz. http://in.buzz.yahoo.com/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2009-07-27 Thread Kevin Neufeld
It does sound like your OS username does not have write access to the 
current folder.


Try this:
echo "do I have write access?" > foo.sql

If you can write to the current directory, do you have execute 
permissions on the shape loader?:

shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs | more

-- Kevin

Ravi wrote:

Hi,
trying to create an SQL for a shape file.
shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
this issues an error from command prompt
Error: 'Access Denied'

My Vista user = Ravi
PostGIS user = postgres

any suggestions pl
Ravi


  See the Web's breaking stories, chosen by people like you. Check out 
Yahoo! Buzz. http://in.buzz.yahoo.com/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
  

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2009-07-27 Thread Ravi

Hi Leo,
giving a proper path to the sql file has suggested gave the help screen
for shp2pgsql.
I sue VISTA O/S, and the Pgadmin and postgis are working fine. It is only this 
usage through command prompt doesnt work.
Ravi


--- On Mon, 27/7/09, Paragon Corporation  wrote:

> From: Paragon Corporation 
> Subject: Re: [postgis-users] shp2pgsql
> To: "'PostGIS Users Discussion'" 
> Date: Monday, 27 July, 2009, 6:06 AM
> Ravi,
> 
> Try specifying the full path to the .sql file.  It
> sounds like its
> defaulting to a location e.g the pg data folder where your
> account doesn't
> have rights to write to.
> 
> So for example try "C:/bc_pubs.sql" 
> 
> Leo
> 
> -Original Message-
> From: postgis-users-boun...@postgis.refractions.net
> [mailto:postgis-users-boun...@postgis.refractions.net]
> On Behalf Of Ravi
> Sent: Sunday, July 26, 2009 6:53 PM
> To: postgis
> Subject: [postgis-users] shp2pgsql
> 
> 
> Hi,
> trying to create an SQL for a shape file.
> shp2pgsql -i -D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
> this issues an
> error from command prompt
> Error: 'Access Denied'
> 
> My Vista user = Ravi
> PostGIS user = postgres
> 
> any suggestions pl
> Ravi
> 
> 
>       See the Web's breaking stories,
> chosen by people like you. Check
> out Yahoo! Buzz. http://in.buzz.yahoo.com/
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 


  Yahoo! recommends that you upgrade to the new and safer Internet Explorer 
8. http://downloads.yahoo.com/in/internetexplorer/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] shp2pgsql

2009-07-26 Thread Paragon Corporation
Ravi,

Try specifying the full path to the .sql file.  It sounds like its
defaulting to a location e.g the pg data folder where your account doesn't
have rights to write to.

So for example try "C:/bc_pubs.sql" 

Leo

-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Ravi
Sent: Sunday, July 26, 2009 6:53 PM
To: postgis
Subject: [postgis-users] shp2pgsql


Hi,
trying to create an SQL for a shape file.
shp2pgsql -i -D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql this issues an
error from command prompt
Error: 'Access Denied'

My Vista user = Ravi
PostGIS user = postgres

any suggestions pl
Ravi


  See the Web's breaking stories, chosen by people like you. Check
out Yahoo! Buzz. http://in.buzz.yahoo.com/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] shp2pgsql

2009-07-26 Thread Ravi

Hi,
trying to create an SQL for a shape file.
shp2pgsql –i –D -s 3005 bc_pubs.shp bcpubs > bc_pubs.sql
this issues an error from command prompt
Error: 'Access Denied'

My Vista user = Ravi
PostGIS user = postgres

any suggestions pl
Ravi


  See the Web's breaking stories, chosen by people like you. Check out 
Yahoo! Buzz. http://in.buzz.yahoo.com/
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


  1   2   3   >