Do not crash when rgeo can’t calculate polygon area
example are “hourglass” shaped polygons
This commit is contained in:
parent
61c315b276
commit
26a6e18cb9
3 changed files with 29 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue