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

Stephen Woodbridge woodbri at swoodbridge.com
Sat Sep 4 11:00:11 PDT 2010


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



More information about the postgis-users mailing list