zhyiwww
用平实的笔,记录编程路上的点点滴滴………
posts - 536,comments - 394,trackbacks - 0
#create table gtest(id serial);
#select AddGeometryColumn('','gtest','geom',4326,'LINESTRING',2);


# INSERT INTO gtest (ID, NAME, GEOM)
VALUES (
   1,
   ’First Geometry’,
   GeomFromText(’LINESTRING(2 3,4 5,6 5,7 8)’, -1)
);


# select astext(geom) as geom from gtest;
              geom              
---------------------------------
 LINESTRING(2 3,4 5)
 LINESTRING(2 3,4 5,5 6)
 LINESTRING(2 3,4 5,5 6,3 5)
 LINESTRING(2 3,4 5,5 6,3 5,1 6)
(4 rows)

# create index idx_geom on gtest using GIST(geom);
CREATE INDEX

# select asbinary(geom) as geom from gtest;
                                                                                                                                                                  geom                                                                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 \001\002\000\000\000\002\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@
 \001\002\000\000\000\003\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@
 \001\002\000\000\000\004\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@\000\000\000\000\000\000\010@\000\000\000\000\000\000\024@
 \001\002\000\000\000\005\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@\000\000\000\000\000\000\010@\000\000\000\000\000\000\024@\000\000\000\000\000\000\360?\000\000\000\000\000\000\030@
(4 rows)

# select GeomFromText('POINT(116.8839 36.88299)',900913);
                    geomfromtext                   
----------------------------------------------------
 010100002031BF0D00CD3B4ED191385D40F758FAD005714240
(1 row)


# select asEWKB(geom) as geom from gtest;
                                                                                                                                                                        geom                                                                                                                                                                        
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 \001\002\000\000 \346\020\000\000\002\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@
 \001\002\000\000 \346\020\000\000\003\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@
 \001\002\000\000 \346\020\000\000\004\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@\000\000\000\000\000\000\010@\000\000\000\000\000\000\024@
 \001\002\000\000 \346\020\000\000\005\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\000\000\000\000\000\000\020@\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@\000\000\000\000\000\000\030@\000\000\000\000\000\000\010@\000\000\000\000\000\000\024@\000\000\000\000\000\000\360?\000\000\000\000\000\000\030@
(4 rows)

# select asEWKT(geom) as geom from gtest;
                   geom                   
-------------------------------------------
 SRID=4326;LINESTRING(2 3,4 5)
 SRID=4326;LINESTRING(2 3,4 5,5 6)
 SRID=4326;LINESTRING(2 3,4 5,5 6,3 5)
 SRID=4326;LINESTRING(2 3,4 5,5 6,3 5,1 6)
(4 rows)

# select GeomFromEWKT('SRID=4326;POINT(119.8782 36.29288)');
                    geomfromewkt                   
----------------------------------------------------
 0101000020E610000039D6C56D34F85D4084D382177D254240
(1 row)

# select GeomFromEWKT('SRID=900913;POINT(119.8782 36.29288)');
                    geomfromewkt                   
----------------------------------------------------
 010100002031BF0D0039D6C56D34F85D4084D382177D254240
(1 row)


# select 'SRID=4326;POINT(119.28983 36.99289)'::geometry;
                      geometry                     
----------------------------------------------------
 0101000020E610000094D920938CD25D404243FF04177F4240
(1 row)

# select 'SRID=900913;POINT(119.28983 36.99289)'::geometry;
                      geometry                     
----------------------------------------------------
 010100002031BF0D0094D920938CD25D404243FF04177F4240
(1 row)






|----------------------------------------------------------------------------------------|
                           版权声明  版权所有 @zhyiwww
            引用请注明来源 http://www.blogjava.net/zhyiwww   
|----------------------------------------------------------------------------------------|
posted on 2009-07-10 15:49 zhyiwww 阅读(399) 评论(0)  编辑  收藏 所属分类: Postgis

只有注册用户登录后才能发表评论。


网站导航: