SQL Server 2012,UnionAggregate 缺少 Z 和 M
SQL Server 2012, UnionAggregate Missing Z and M
在具有 M 和 Z 的多个有序线几何图形上使用联合聚合,但最终结果缺少这些 Z 和 M 值。我也尝试使用地理位置,但没有成功。
测试查询
create table #test
(shape geometry)
insert into #test(shape)
values (geometry::STGeomFromText('LINESTRING (-89.831404 29.869888 2.5 28.58, -89.835404 29.869892 2.5 30.13)', 4269)), (geometry::STGeomFromText('LINESTRING (-89.835404 29.869892 2.5 30.13, -89.831403 29.869896 2.5 31.45)', 4269))
DECLARE @geom3 geometry = (select geometry::UnionAggregate(shape) FROM #test )
SELECT @geom3.AsTextZM()
drop table #test
这个returns
LINESTRING (-89.831403 29.869896, -89.835404 29.869892, -89.831404 29.869888)
我希望得到以下结果:
LINESTRING (-89.831403 29.869896 2.5 28.58, -89.835404 29.869892 2.5 30.13, -89.831404 29.869888 2.5 31.45)
UnionAgregate 将生成新的地理值,并在此过程中从源形状中删除所有 Z 和 M(高程和测量)数据。
需要注意的是,UnionAgregate 会将具有相同 X 和 Y 坐标但不同 Z 和 M 的两个点合并为具有 X 和 Y 坐标的单个点,因此以下脚本将 return 2 个点:
create table #test
(shape geometry)
insert into #test(shape)
values (geometry::STGeomFromText('POINT (-10 10 1 1)', 0)),
(geometry::STGeomFromText('POINT (-10 10 4 4)', 0)),
(geometry::STGeomFromText('POINT (-11 10 4 4)', 0));
select shape.AsTextZM() from #test
select geometry::UnionAggregate(shape).AsTextZM() FROM #test
drop table #test
在具有 M 和 Z 的多个有序线几何图形上使用联合聚合,但最终结果缺少这些 Z 和 M 值。我也尝试使用地理位置,但没有成功。
测试查询
create table #test
(shape geometry)
insert into #test(shape)
values (geometry::STGeomFromText('LINESTRING (-89.831404 29.869888 2.5 28.58, -89.835404 29.869892 2.5 30.13)', 4269)), (geometry::STGeomFromText('LINESTRING (-89.835404 29.869892 2.5 30.13, -89.831403 29.869896 2.5 31.45)', 4269))
DECLARE @geom3 geometry = (select geometry::UnionAggregate(shape) FROM #test )
SELECT @geom3.AsTextZM()
drop table #test
这个returns
LINESTRING (-89.831403 29.869896, -89.835404 29.869892, -89.831404 29.869888)
我希望得到以下结果:
LINESTRING (-89.831403 29.869896 2.5 28.58, -89.835404 29.869892 2.5 30.13, -89.831404 29.869888 2.5 31.45)
UnionAgregate 将生成新的地理值,并在此过程中从源形状中删除所有 Z 和 M(高程和测量)数据。
需要注意的是,UnionAgregate 会将具有相同 X 和 Y 坐标但不同 Z 和 M 的两个点合并为具有 X 和 Y 坐标的单个点,因此以下脚本将 return 2 个点:
create table #test
(shape geometry)
insert into #test(shape)
values (geometry::STGeomFromText('POINT (-10 10 1 1)', 0)),
(geometry::STGeomFromText('POINT (-10 10 4 4)', 0)),
(geometry::STGeomFromText('POINT (-11 10 4 4)', 0));
select shape.AsTextZM() from #test
select geometry::UnionAggregate(shape).AsTextZM() FROM #test
drop table #test