ST_MinimumBoundingCircle 椭圆而不是圆
ST_MinimumBoundingCircle ellpse instead of circle
我使用 postgis,我想计算我的几何图形的最小边界圆。
我的观点是:
我使用 ST_MinimumBoundingCircle
函数,但它显示的是椭圆而不是圆(参见 )。
重现以下样本:
select ST_Centroid(collection), ST_MinimumBoundingCircle(collection) from (
select ST_COLLECT(point) as collection from (
select ST_SetSRID(ST_MakePoint(20.513371, 54.720205),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.493725, 54.717761),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.495189, 54.726808),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.501414, 54.716445),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.509221, 54.719836),4326) as point
) a
)b
我不明白我做错了什么。
你没有做错任何事。您可能会将缓冲区视为椭圆,因为您用来创建它的点离赤道(加里宁格勒)很远。请记住,您是将椭圆体投影到 2D 平面结构中,因此这种扭曲是正常的。
WITH j (geom) AS (
VALUES
('SRID=4326;POINT(20.513371 54.720205)'),
('SRID=4326;POINT(20.493725 54.717761)'),
('SRID=4326;POINT(20.495189 54.726808)'),
('SRID=4326;POINT(20.501414 54.716445)'),
('SRID=4326;POINT(20.509221 54.719836)')
)
SELECT ST_MinimumBoundingCircle(ST_Collect(geom::geometry))
FROM j;
但是如果你在靠近赤道的地方画一个类似的缓冲区,失真就不会那么明显了。请参阅下面的示例(巴西北部):
WITH j (geom) AS (
VALUES
('SRID=4326;POINT(-56.30 1.55)'),
('SRID=4326;POINT(-56.63 1.14)'),
('SRID=4326;POINT(-55.95 0.70)'),
('SRID=4326;POINT(-55.57 1.38)')
)
SELECT ST_MinimumBoundingCircle(ST_Collect(geom::geometry))
FROM j;
进一步阅读:
为了避免失真,请在创建缓冲区之前转换为更正确地表示长度的坐标系。
我使用 postgis,我想计算我的几何图形的最小边界圆。
我的观点是:
我使用 ST_MinimumBoundingCircle
函数,但它显示的是椭圆而不是圆(参见
重现以下样本:
select ST_Centroid(collection), ST_MinimumBoundingCircle(collection) from (
select ST_COLLECT(point) as collection from (
select ST_SetSRID(ST_MakePoint(20.513371, 54.720205),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.493725, 54.717761),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.495189, 54.726808),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.501414, 54.716445),4326) as point
UNION ALL
select ST_SetSRID(ST_MakePoint(20.509221, 54.719836),4326) as point
) a
)b
我不明白我做错了什么。
你没有做错任何事。您可能会将缓冲区视为椭圆,因为您用来创建它的点离赤道(加里宁格勒)很远。请记住,您是将椭圆体投影到 2D 平面结构中,因此这种扭曲是正常的。
WITH j (geom) AS (
VALUES
('SRID=4326;POINT(20.513371 54.720205)'),
('SRID=4326;POINT(20.493725 54.717761)'),
('SRID=4326;POINT(20.495189 54.726808)'),
('SRID=4326;POINT(20.501414 54.716445)'),
('SRID=4326;POINT(20.509221 54.719836)')
)
SELECT ST_MinimumBoundingCircle(ST_Collect(geom::geometry))
FROM j;
但是如果你在靠近赤道的地方画一个类似的缓冲区,失真就不会那么明显了。请参阅下面的示例(巴西北部):
WITH j (geom) AS (
VALUES
('SRID=4326;POINT(-56.30 1.55)'),
('SRID=4326;POINT(-56.63 1.14)'),
('SRID=4326;POINT(-55.95 0.70)'),
('SRID=4326;POINT(-55.57 1.38)')
)
SELECT ST_MinimumBoundingCircle(ST_Collect(geom::geometry))
FROM j;
进一步阅读:
为了避免失真,请在创建缓冲区之前转换为更正确地表示长度的坐标系。