空间sql

sqlserver

 

 



DECLARE @g GEOMETRY SET @g = ( GEOMETRY::STGeomFromText('POLYGON ${geom}', 4326) )
SET @g = @g.MakeValid();  
@g.STContains(GEOMETRY::STGeomFromText('POINT ('+ CONVERT(VARCHAR(50),lon)+ ' '+ CONVERT (VARCHAR(50), lat)+ ')', 4326)) = 1

  

oracle

 declare geom sdo_geometry:=sdo_geometry('POLYGON((80.83422302246095
                                                        20.518481140136714,
                                                        120.4135076904297
                                                        50.314989929199214,
                                                        80.83422302246095
                                                        50.314989929199214,
                                                        80.83422302246095
                                                       20.518481140136714))',4326);
  begin
     --输出并换行
   dbms_output.put_line(sdo_Geom.SDO_BUFFER(geom,1,0.002).get_wkt());
 end;        

 

posted @ 2018-07-09 17:31  shine_pan  阅读(302)  评论(0编辑  收藏  举报