我们有一个由多个点(蓝线)组成的LineString(地图上的路线),然后我们将其缓冲以产生它周围的区域。我们发现除非路线与自身相交,否则一切看起来都符合预期,此时缓冲区域会获得相当大的纵向曲率。
一个例子显示了不同的结果:http://geojson.io/#id=gist:jgwconsulting/1e2a6e8bad9f018f2c6321016a527bef&map=6/55.621/-3.618
SELECT ST_AsGeoJSON(
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-14.466666666666667,55.25],[7.233333333333333,54],[0,58.86666666666667],[-11.7,52.06666666666667],[-12.6,56.55]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')
);
SELECT ST_AsGeoJSON(
ST_Union(
ARRAY[
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-14.466666666666667,55.25],[7.233333333333333,54]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[7.233333333333333,54],[0,58.86666666666667]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[0,58.86666666666667],[-11.7,52.06666666666667]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-11.7,52.06666666666667],[-12.6,56.55]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry
]
));
SELECT ST_AsGeoJSON(
ST_Collect(
ARRAY[
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-14.466666666666667,55.25],[7.233333333333333,54]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[7.233333333333333,54],[0,58.86666666666667]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[0,58.86666666666667],[-11.7,52.06666666666667]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry,
ST_Buffer(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-11.7,52.06666666666667],[-12.6,56.55]]}')::geography, 9260, 'quad_segs=30 endcap=round join=round')::geometry
]
));
是否有人能够解释我们所看到的不同结果,表面上是使用相同的坐标集,特别是为什么交叉线会如此显着地改变缓冲区?
这是创建(不同)路线的示例,显示一旦添加了与路线的另一部分相交的线,缓冲区几何体如何发生显着变化。
这是一个非常好的人在GIS StackExchange上的一个很好的答案: