Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#7101 closed defect (fixed)

gdal.Grid Segmentation fault

Reported by: winsent Owned by: warmerdam
Priority: normal Milestone: 2.2.3
Component: Algorithms Version: 2.2.2
Severity: normal Keywords: grid, linear, mem
Cc:

Description

gdal.Grid with linear algorithm periodically falls or return different result. Tested on Ubuntu 14.04 and MacOS with GDAL 2.2.0, 2.2.1, 2.2.2

from osgeo import gdal, ogr

wkt = 'POLYGON ((37.3495241627097 55.6901648563184 187.680953979492,37.349543273449 55.6901565410051 187.714370727539,37.3495794832707 55.6901531392856 187.67333984375,37.3496210575104 55.6901595647556 187.6396484375,37.3496398329735 55.6901716597552 187.596603393555,37.3496726900339 55.6901780852222 187.681350708008,37.3496793955565 55.6901829988139 187.933898925781,37.3496921360493 55.6901860225623 187.934280395508,37.3497162759304 55.6902037870796 187.435394287109,37.3497484624386 55.6902094566047 187.515319824219,37.3497618734837 55.6902241973661 190.329940795898,37.3497511446476 55.690238560154 190.345748901367,37.3497404158115 55.6902567026153 190.439697265625,37.3497142642736 55.6902650179072 189.086044311523,37.349688783288 55.6902608602615 187.763305664062,37.3496626317501 55.6902468754498 187.53678894043,37.3496378213167 55.6902412059301 187.598648071289,37.3496103286743 55.6902400720261 187.806274414062,37.3495902121067 55.6902313787607 187.759521484375,37.3495734483004 55.6902177719067 187.578125,37.349532879889 55.6902035980954 187.56965637207,37.3495161160827 55.6901939599008 187.541793823242,37.3495187982917 55.6901754394418 187.610427856445,37.3495241627097 55.6901648563184 187.680953979492))'
polygon = ogr.CreateGeometryFromWkt(wkt)

ds = gdal.Grid('', polygon.ExportToJson(), \
    width=115, height=93, outputBounds=[37.3495161160827, 55.6901531392856, 37.3497618734837, 55.6902650179072], \
    format='MEM', algorithm='linear')

print(ds.GetRasterBand(1).ReadAsArray())

Change History (5)

comment:1 Changed 2 months ago by Jukka Rahkonen

I wonder if it makes sense to use polygon as an input. Have you tried what happens if you convert your vertices into a bunch of points first?

Last edited 2 months ago by Jukka Rahkonen (previous) (diff)

comment:2 Changed 2 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 40485:

GDALGrid() with linear algorithm: avoid assertions/segmentation fault when GDALTriangulationFindFacetDirected() fails (fixes #7101)

comment:3 Changed 2 months ago by Even Rouault

In 40486:

GDALGrid() with linear algorithm: avoid assertions/segmentation fault when GDALTriangulationFindFacetDirected() fails (fixes #7101)

comment:4 Changed 2 months ago by Even Rouault

Milestone: 2.2.3

comment:5 Changed 2 months ago by Even Rouault

In 40487:

Add test case for bugfix (refs #7101)

Note: See TracTickets for help on using tickets.