8000 Centroid not working on Ubuntu 24.04 with EPSG:4326 projected factory · Issue #376 · rgeo/rgeo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Centroid not working on Ubuntu 24.04 with EPSG:4326 projected factory #376
Open
@LocoDelAssembly

Description

@LocoDelAssembly

Steps to reproduce

require 'rgeo'
require 'rgeo/proj4'

factory = RGeo::Geographic.projected_factory(
  srid: 4326, 
  projection_srid: 4326,
  projection_proj4: 'EPSG:4326',
  has_z_coordinate: true
)

polygon = factory.polygon(factory.linear_ring(
  [[0,0], [10,0], [10,10], [0,10], [0,0]].map { |a,b| factory.point(a, b) }
))

expected_centroid = factory.point(5, 5)

puts polygon.inspect
puts "EXPECTED CENTROID: #{expected_centroid}"
puts "ACTUAL CENTROID: #{polygon.centroid}"

raise "INVALID CENTROID" unless polygon.centroid == expected_centroid
puts "polygon.centroid == expected_centroid TEST PASSED"

Expected behavior (Ubuntu 20.04 & 22.04)

#<RGeo::Geographic::ProjectedPolygonImpl:0x424 "POLYGON ((0.0 0.0 0.0, 10.0 0.0 0.0, 10.0 10.0 0.0, 0.0 10.0 0.0, 0.0 0.0 0.0))">
EXPECTED CENTROID: POINT (5.0 5.0 0.0)
ACTUAL CENTROID: POINT (5.0 5.0 NAN)
polygon.centroid == expected_centroid TEST PASSED

Actual behavior (Ubuntu 24.04)

script.rb:13:in `<main>': INVALID CENTROID (RuntimeError)
#<RGeo::Geographic::ProjectedPolygonImpl:0x424 "POLYGON ((0.0 0.0 0.0, 10.0 0.0 0.0, 10.0 10.0 0.0, 0.0 10.0 0.0, 0.0 0.0 0.0))">
EXPECTED CENTROID: POINT (5.0 5.0 0.0)
ACTUAL CENTROID: POINT (NAN NAN NAN)

Notes

I've prepared a repo to use Github testing environments and tested against Ubuntu versions 20.04, 22.04 and 24.04 with packages libgeos-dev and libproj-dev installed and using Ruby 3.3.6. Only Ubuntu 24.04 fails: https://github.com/LocoDelAss 5330 embly/rgeo-centroid-test/actions/runs/13298190081

I had this problem on a rails app actually, and narrowed down to rgeo + rgeo/proj4, but don't know how to debug deeper to pin down the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0