PostGIS query point online

1, buffer method: fm query the database table, and coordinates (12989691.512 4798962.444) 0.0001 meters away data (coordinate 3857)

SELECT ID the FROM FM WHERE ST_Intersects (ST_Transform (ST_Buffer (ST_Transform (st_geomfromtext ( ' Point (12,989,691.512 4,798,962.444) ' , 3857 ), 3857 ), . 1 ), 3857 ), GEOM);
 - if a coordinate system, transform may not 
SELECT ID the FROM FM WHERE ST_Intersects (ST_Buffer (st_geomfromtext ( ' Point (12,989,691.512 4,798,962.444) ' ), from 0.0001), GEOM);

2, buffer method: query fm table, a point feature geometry of 0.0001 meters away from the elements

--geometry(例:0101000000D34D62709FC66841FA7E6A9C7C4E5241)
SELECT id FROM fm where st_intersects(st_buffer('0101000000D34D62709FC66841FA7E6A9C7C4E5241',0.0001),geom) ;

3, spatial analysis: ST_Intersects View intersect

--带业务逻辑
select t.gid,t.geom from fm t where t.gid  in (
          select a.gid from fm a,(select c.* from zy c where c.gid = up_temprow.gid) b where ST_intersects(a.geom,b.geom) 
        )
--简化
select t.gid,t.geom from fm t where t.gid  in (
          select a.gid from fm a,zy b where ST_intersects(a.geom,b.geom) 
        )

 

Guess you like

Origin www.cnblogs.com/giser-s/p/11655810.html