根据sqlserver geometry数据定义获取空间类型边界范围

--获取指定街道边界的xy最大最小值
declare @point_cnt int,@i int,@point geometry,@jdcode nvarchar(50)

set @jdcode='440307006'--街道编码

create table #temp_point(id int identity,x float,y float)
select  @point_cnt =geom.STNumPoints()
from [dbo].[jd]
where jdcode=@jdcode

set @i=1
while @i<=@point_cnt
begin
    select @point = geom.STPointN(@i)
    from [dbo].[jd]
    where jdcode=@jdcode

    insert into #temp_point(x,y)
    values(@point.STX,@point.STY)
    set @i = @i+1
end

select min(x) as minx,min(y) as miny,max(x) as maxx,max(y) as maxy
from #temp_point

truncate table #temp_point;
drop table #temp_point

 

相关文章:

  • 2022-02-06
  • 2022-12-23
  • 2021-11-23
  • 2021-12-06
  • 2021-10-08
  • 2021-12-19
  • 2021-08-28
猜你喜欢
  • 2021-05-17
  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2023-01-10
  • 2021-10-30
  • 2022-12-23
相关资源
相似解决方案