Fix can’t cast RGeo::Geographic::SphericalPointImpl to point

If you are using Rails with activerecord-postgis-adapter 3.1.4 perhaps you got into a point where you were suddenly getting the following error:

If you would try to debug what’s going on you would probably go through the following files:

only to find out that Rails returns a point type column instead of desired geography(Point,4326).

The mistake is then obvious, replace your point type in your migrations or schema.rb file with st_point or geography types:

Join the Conversation


Leave a comment

Your email address will not be published. Required fields are marked *