I have a simple tasks that regarding combining multiple Postgis tables. Let's say I have 4 tables called tx_shape
, ca_cd_1_shape
,wy_shape
, and ma_suffulk_co_shape
. Two of which are states, one is a congressional district, and another is a county.
I want to combine them into one giant shape table. I tried using referring to this post, and ran
CREATE TABLE merged AS (
SELECT gid, geom FROM tx_shape
UNION
SELECT gid, geom from wy_shape
UNION
SELECT gid, geom FROM ca_cd_1_shape
UNION
SELECT gid, geom FROM ma_suffolk_co_shape);
But all it returns is a blank. The gid are displaying correctly but when I export it using pgsql2shp with
pgsql2shp -f "test_output" -h localhost -u username -P password my_db "select * from merged"
All I get is a blank, am I missing something here? It should be relatively straightforward.
gid
column will likely not be unique.