Skip to main content
added 62 characters in body
Source Link
user30184
  • 69k
  • 4
  • 71
  • 125

When you created a buffer for a self-intersecting linestring the algorithm finds the correct intersection point of the geography linestrings. ThereforeThis point is obviously added as a new vertex for the buffer algorithm, the buffer area gets a bend and the result "Grey" is rather close to correct Great circle result.

You had a right idea with your tests with splitted linestrings. However, you did the split in planar coordinate system and therefore isthe test did not reveal the curvature of lines.

When you created a buffer for a self-intersecting linestring the algorithm finds the correct intersection point of the geography linestrings. Therefore the buffer area gets a bend and the result "Grey" is rather close to correct Great circle result.

You had a right idea with your tests with splitted linestrings. However, you did the split in planar coordinate system and therefore is did not reveal the curvature of lines.

When you created a buffer for a self-intersecting linestring the algorithm finds the correct intersection point of the geography linestrings. This point is obviously added as a new vertex for the buffer algorithm, the buffer area gets a bend and the result "Grey" is rather close to correct Great circle result.

You had a right idea with your tests with splitted linestrings. However, you did the split in planar coordinate system and therefore the test did not reveal the curvature of lines.

Source Link
user30184
  • 69k
  • 4
  • 71
  • 125

Interestingly the curved version is correct if you play with geography. See the image below. The green line is your original GeoJSON plotted with a GIS client that can only use a planer coordinate system. The purple line is created with PostGIS query

SELECT ST_Segmentize(
ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-14.466666666666667,55.25],[7.233333333333333,54],[0,58.86666666666667],[-11.7,52.06666666666667],[-12.6,56.55]]}')::geography
,100000)::geometry;

So, the linestring as a geography is segmentized to have a vertex at every 100 km. Cast back to geometry is done just for the non-geography capable viewer.

You can see that straight geography linestrings look curved when showed in planar coordinate system because they follow the shortest path on spheroid, the "Great circle".

When you created a buffer for a self-intersecting linestring the algorithm finds the correct intersection point of the geography linestrings. Therefore the buffer area gets a bend and the result "Grey" is rather close to correct Great circle result.

You had a right idea with your tests with splitted linestrings. However, you did the split in planar coordinate system and therefore is did not reveal the curvature of lines.

It is good practice to segmentize/densify very long segments first because algorithms often deal only with vertices and relation between the vertices is supposed to be linear.

This is your GeoJSON geometry after it has been segmentized as geography

LINESTRING ( -14.466666666666667 55.25, -13.08889310538655 55.28704917903751, -11.709085410988154 55.30856429689069, -10.328321900711986 55.31451602902716, -8.947686100999091 55.30489625061711, -7.5682608415558965 55.2797180910541, -6.191122358792509 55.2390158458828, -4.8173344877503546 55.182844747514125, -3.4479430194254133 55.11128059830464, -2.08397029629682 55.02441927167354, -0.7264101130495206 54.92237608887058, 0.6237770178397885 54.8052850807411, 1.965668184524082 54.673298145319606, 3.2983819365313143 54.52658411328878, 4.621081656167955 54.36532773424728, 5.9329784191675055 54.18972859732803, 7.233333333333333 54, 6.426253723121359 54.63004535265149, 5.5938895637791735 55.25455611476192, 4.735073398743345 55.87322373000668, 3.8485894193265504 56.48571996916197, 2.933173741727981 57.09169567833502, 1.9875152761669712 57.69077947986619, 1.0102573167737552 58.282576433304996, 0 58.86666666666667, -0.8577481647393383 58.47718586936625, -1.696558719455395 58.082108080613004, -2.5168773980849872 57.681640525397924, -3.3191531135004273 57.27598307621911, -4.103836026168624 56.86532837869072, -4.871375832210857 56.449861996384726, -5.622220255301017 56.02976257142281, -6.35681372690526 55.605201997699375, -7.075596239659377 55.17634560396123, -7.77900235915053 54.743352344289534, -8.46746037997258 54.30637499382855, -9.141391612621591 53.86556034787863, -9.80120978855862 53.42104942272201, -10.44732057156455 52.97297765677625, -11.080121164325472 52.52147511087597, -11.7 52.06666666666667, -11.802260557330674 52.627431878544535, -11.907175699454038 53.1881067638425, -12.014870581450193 53.74868704835126, -12.125478108810857 54.30916819186383, -12.239139549252082 54.86954536705044, -12.356005203049094 55.429813436297565, -12.476235138501552 55.98996692627955, -12.6 56.55 )

enter image description here