Rgeo to unknown data type...

43 views
Skip to first unread message

Darrell Sommerlatt

unread,
Oct 28, 2016, 10:10:28 PM10/28/16
to RGeo-Users
Hi!

In my DB I'm saving location as #<RGeo::Geographic::SphericalPointImpl:0x3fc84bf02e4c "POINT (-118.4622327750244 34.054010552354974)">

after my SQL query location is in this format

:location=>"0101000020E6100000A0F7C638959D5DC073005AD1E9064140"



1) What format is it in now? and  2) Can I transform this back to rgeo OR something in which I can get a lat/lng?


Thanks!

Andrew Libby

unread,
Oct 31, 2016, 8:28:33 AM10/31/16
to rgeo-...@googlegroups.com

It looks like well known binary (WKB), but I can't parse it
with RGeo or postgis ST_GeomFromWKB(); The error I get from
potgis is:

alibby=# select
ST_GeomFromWKB('0101000020E6100000A0F7C638959D5DC073005AD1E9064140', 4326);
ERROR: Invalid endian flag value encountered.
CONTEXT: SQL function "st_geomfromwkb" statement 1

I wonder if this open issue is related:

https://github.com/rgeo/rgeo/issues/150

What version of MySQL are you using? You might
consider trying the activerecord-mysql2spatial-adapter fork
referenced in the above issue or perhaps switch to postgres
if you're not too heavily invested in MySQL.

Andy


On 10/28/16 5:30 PM, Darrell Sommerlatt wrote:
> Hi!
>
> In my DB I'm saving*location as
> #<RGeo::Geographic::SphericalPointImpl:0x3fc84bf02e4c "POINT
> (-118.4622327750244 34.054010552354974)">*
>
> *after* my *SQL query* location is in this format
> *
> :location=>"0101000020E6100000A0F7C638959D5DC073005AD1E9064140"*
>
>
> 1) What format is it in now? and 2) Can I transform this back to rgeo
> OR something in which I can get a lat/lng?
>
>
> Thanks!
>
> --
> 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
> <mailto:rgeo-users+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages