RGeo::Geographic.spherical_factory doesn't allow longitude less than -90?

72 views
Skip to first unread message

Patrick McCarthy

unread,
Jan 12, 2018, 11:53:53 AM1/12/18
to RGeo-Users
Hi,

I'm new to using RGeo and I'm a little bit lost on this bug I've been seeing.  My understanding of `RGeo::Geographic.spherical_factory` is that it accepts a latitude and longitude and returns an RGeo object with the same latitude and longitude, however when I try anything West of -90, it will always return `POINT(longitude, -90)`

e.g.

//works correctly
irb
(main):001:0> RGeo::Geographic.spherical_factory(srid: 4326).point(52.52000659999999, 13.404953999999975)
=> #<RGeo::Geographic::SphericalPointImpl:0x3fea9c8f570c "POINT (52.52000659999999 13.404953999999975)">

//returns -90 as the longitude
irb
(main):002:0> RGeo::Geographic.spherical_factory(srid: 4326).point(52.52000659999999, -113.404953999999975)
=> #<RGeo::Geographic::SphericalPointImpl:0x3fea9c8ee650 "POINT (52.52000659999999 -90.0)">

I'm still digging into the docs of the library to understand it at a deeper level, but does anyone know why this is happening on first glance?

Thanks,

Patrick

Daniel Azuma

unread,
Jan 12, 2018, 6:52:30 PM1/12/18
to rgeo-...@googlegroups.com
Latitude and longitude are in (longitude, latitude) order. Which makes sense if you think about it: coordinates are ordered (x, y). Reverse the order of your coordinates.

Daniel

--
You received this message because you are subscribed to the Google Groups "RGeo-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rgeo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages