添加空间字段的另一种方法

添加空间字段的另一种方法
zydb=# select addGeometryColumn('public','pbeijing','the_geom_900913',900913,'POINT',2);
                       addgeometrycolumn                      
---------------------------------------------------------------
 public.pbeijing.the_geom_900913 SRID:900913 TYPE:POINT DIMS:2
 
(1 row)

zydb=# \d pbeijing
                                      Table "public.pbeijing"
     Column      |          Type          |                       Modifiers                       
-----------------+------------------------+--------------------------------------------------------
 gid             | integer                | not null default nextval('pbeijing_gid_seq'::regclass)
 mapid           | character varying(8)   |
 kind            | character varying(4)   |
 name            | character varying(100) |
 py              | character varying(250) |
 exonym          | character varying(250) |
 adminname       | character varying(50)  |
 dzname          | character varying(50)  |
 zipcode         | character varying(6)   |
 address         | character varying(100) |
 telephone       | character varying(15)  |
 admincode       | character varying(6)   |
 dzcode          | character varying(6)   |
 isindex         | boolean                |
 isother         | boolean                |
 the_geom        | geometry               |
 x               | double precision       |
 y               | double precision       |
 the_geom_900913 | geometry               |
Indexes:
    "pbeijing_pkey" PRIMARY KEY, btree (gid)
    "pbeijing_the_geom_gist" gist (the_geom)
Check constraints:
    "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
    "enforce_dims_the_geom_900913" CHECK (ndims(the_geom_900913) = 2)
    "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL)
    "enforce_geotype_the_geom_900913" CHECK (geometrytype(the_geom_900913) = 'POINT'::text OR the_geom_900913 IS NULL)
    "enforce_srid_the_geom" CHECK (srid(the_geom) = 4326)
    "enforce_srid_the_geom_900913" CHECK (srid(the_geom_900913) = 900913)

zydb=# update  pbeijing set the_geom_900913=transform(the_geom,900913);
UPDATE 34159

zydb=# select the_geom ,the_geom_900913 from pbeijing limit 10;
                      the_geom                      |                  the_geom_900913                  
----------------------------------------------------+----------------------------------------------------
 0101000020E6100000927A4FE5B41F5D408D2782380FCF4340 | 010100002031BF0D00B4A0714C22BC684182BB38C5C9595241
 0101000020E610000098A59D9ACB125D409949D40B3EED4340 | 010100002031BF0D00FBE9FE1C2BB16841EF87D46C1F7B5241
 0101000020E6100000B857E6ADBA085D404AF086342ADE4340 | 010100002031BF0D009FC3C3879EA868417558A1E4746A5241
 0101000020E6100000041DAD6A49135D404A09C1AA7AF94340 | 010100002031BF0D0075C44FF795B16841D7D4B67FAB885241
 0101000020E610000017838769DF175D4083BF5FCC962E4440 | 010100002031BF0D00E581730A7BB5684137D06310B0C35241
 0101000020E6100000ABAE4335251C5D401E705D3123F24340 | 010100002031BF0D004A7A81001CB96841E7D1D22E8A805241
 0101000020E6100000E083D72E6D135D409CDB847B650A4440 | 010100002031BF0D00575CA557B4B168419AA92F116E9B5241
 0101000020E610000064B2B8FFC8165D40C7D8092FC1F14340 | 010100002031BF0D004B7295958EB46841215637B21D805241
 0101000020E6100000F60A0BEE071B5D40F7729F1C05EE4340 | 010100002031BF0D009F0D11B729B86841BFAFDEA9FB7B5241
 0101000020E6100000BD8DCD8E54155D40A6EECA2E18F44340 | 010100002031BF0D0029501D4552B36841F88C1DCEB4825241
(10 rows)

zydb=#








|----------------------------------------------------------------------------------------|
                           版权声明  版权所有 @zhyiwww
            引用请注明来源 http://www.blogjava.net/zhyiwww   
|----------------------------------------------------------------------------------------|

你可能感兴趣的:(添加空间字段的另一种方法)