James,

You can use shp2pgsql command line packaged with PostGIS.  It automatically
renames columns for you by adding digits to the end of duplicated 10char
names

So something like

pgsql2shp -f myshapefile -h myserver -u apguser -P apgpassword mygisdb
"SELECT * FROM incidents WHERE urgency = 'Immediate' AND
date_time_of_arrival - date_time_unit_assigned > '00:12:00' "

http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide_20.bqg

Leo
http://www.postgis.us 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of James
David Smith
Sent: Wednesday, June 15, 2011 1:58 PM
To: PostGIS Users Discussion
Subject: [postgis-users] QGIS - PostGIS - ArcGIS Interaction

Dear all,

I appreciate that this is more of a QGIS query, but I think that the route
of the problem might be in PostGIS, so... I have opened QGIS and ran the
query on my PostGIS table as below:

SELECT * FROM incidents
WHERE urgency = 'Immediate'
AND date_time_of_arrival - date_time_unit_assigned > '00:12:00'

This gives me 33 points in QGIS. Great. I would now however like to save
this as a ShapeFile for use in ArcGIS with which I am more familiar, but
when I try to SAVE AS from QGIS I am given the following error....

Export to vector file failed.
Error: trimming attribute name 'date_time_of_arrival' to ten significant
characters produces duplicate column name.

I am guessing that the problem here is that ESRI shapefiles can only deal
with column names that are ten characters long...? And that as I also have a
column called 'date_time_of_departure', when QGIS trims this column it ends
up with two columns called the same thing?  Is there a way around this? I
realise I could rename the column in QGIS, but I actually have around 45
columns in the table and this problem will occur with about 15 pairs of them
I think. I guess there is no simple answer... but thought I'd ask.

Cheers

James
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to