Do not crash when rgeo can’t calculate polygon area

example are “hourglass” shaped polygons
This commit is contained in:
Paul Chavard 2020-09-23 14:37:07 +02:00
parent 61c315b276
commit 26a6e18cb9
3 changed files with 29 additions and 2 deletions

View file

@ -79,13 +79,13 @@ class GeoArea < ApplicationRecord
def area
if polygon? && RGeo::Geos.supported?
rgeo_geometry.area&.round(1)
rgeo_geometry&.area&.round(1)
end
end
def length
if line? && RGeo::Geos.supported?
rgeo_geometry.length&.round(1)
rgeo_geometry.length.round(1)
end
end