Opened 12 months ago

Closed 6 months ago

Last modified 6 months ago

#3682 closed defect (fixed)

Strange fieldlength in result of pgsql2shp

Reported by: postgispaul Owned by: robe
Priority: medium Milestone: PostGIS 2.3.3
Component: loader/dumper Version: 2.0.x
Keywords: Cc:

Description

When I export a query to a shapefile, boolean columns are converted to logical fields with a length of 2.

Don't know if it is allowed by the shape/dbf specs, but arcgis isn't able to open them. Other tools (f.e. qgis) are opening them correctly though

it's this piece in http://svn.osgeo.org/postgis/trunk/loader/pgsql2shp-core.c if (pgfieldtype == 16) {

dbffieldtype = FTLogical; dbffieldsize = 2; dbffielddecs = 0;

}

Any particular reason for setting the length to 2? Svn history didn't show any changes there since the file was added.

Change History (12)

comment:1 Changed 11 months ago by robe

@pramsey, @strk

Any reason we set this to 2? Specs say Logical type should be 1

http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm


L Logical 1 byte - initialized to 0x20 (space) otherwise T or F.


comment:2 Changed 11 months ago by robe

Milestone: PostGIS 2.3.2PostGIS 2.4.0

comment:3 Changed 8 months ago by robe

Resolution: fixed
Status: newclosed

In 15381:

Boolean (FTLogical) should be 1 byte not 2 bytes
closes #3682 for PostGIS 2.4.0 (trunk)

comment:4 Changed 8 months ago by robe

postgispaul,

Can you try this out and see if it fixes your issue. I unfortunately don't have ArcGIS to test with. If it does and pramsey and strk have no issue with backporting, I can backport to 2.3 as well.

If you need windows binaries - you can get them from here in about an hour.

http://winnie.postgis.net/download/windows/pg96/buildbot/

I'm still troubleshooting the 32-bit runs, so the 32-bits are too old to test with. I assume you are runnning 64-bit so probably a non-issue.

comment:5 Changed 8 months ago by postgispaul

Ok, I'll try. A small first remark though: In the postgis-pg96-binaries-2.4.0devw64gcc48.zip there are 2 different libexpat-1.dll's

comment:6 Changed 8 months ago by robe

Are you referring to the one in the postgisgui folder vs. the one in bin?

The one in postgisgui is packaged with gtk. The one in bin is what I build GDAL against (so that ogrfdw has support for OSM files and other xmlish things).

Speaking of which I've got to update the gtk version.

comment:7 Changed 8 months ago by postgispaul

yes those are the 2 folders

comment:8 Changed 8 months ago by robe

If you look close enough you'll probably find a lot of redundant libraries. So I purposely stuffed all the shp2pgsql-gui (gtk stuff in a subfolder) so it wouldn't screw up the PostgreSQL bin folder. The versions of things are not guaranteed to be compatible between the two folders.

comment:9 Changed 8 months ago by postgispaul

There were indeed some duplicates, but the libexpat-1 was the only one with different sise/date.

The solution is indeed confirmed. ArcGis? opens the shapes correctly now

comment:10 Changed 7 months ago by robe

Milestone: PostGIS 2.4.0PostGIS 2.3.3
Resolution: fixed
Status: closedreopened

I'm reopening this cause strk is okay with backporting as long as I add a regression test.

I'll close after I have backported and added a regression test.

comment:11 Changed 6 months ago by robe

Resolution: fixed
Status: reopenedclosed

In 15442:

Backport fixes for pgsql2shp for Boolean field length and quote escaping
Includes tests for both
Closes #3682
Closes #3701

comment:12 Changed 6 months ago by robe

In 15443:

Backport test sql script missed in last commit
References #3682 for 2.3.3
References #3701 for 2.3.3

Note: See TracTickets for help on using tickets.