-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geography point support #7
Comments
Btw, this is how it looks in psql: geo=# select loc from users;
loc
----------------------------------------------------
0101000020E6100000D82C978DCED12A40B8E9CF7EA4424A40
(1 row)
geo=# select ST_AsText(loc) from users;
st_astext
----------------------------
POINT(13.409779 52.520645)
(1 row)
geo=# select ST_AsEWKT(loc) from users;
st_asewkt
--------------------------------------
SRID=4326;POINT(13.409779 52.520645)
(1 row) |
It's probably trying to deserialize the hex WKB as 2 f64: Looking at this |
This crate already provides a EWKB decoder for geography Point types (with SRID): The wkb crate doesn't seem to support it though: |
Yes, it's trying to interpret the first 8 bytes as the first f64 and the next 8 bytes as the second coordinate: So now we know how to parse it correctly, but how should we serialize it? This works: cast('0101000020E6100000D82C978DCED12A40B8E9CF7EA4424A40' as geography) This also: cast('0101000020E6100000D82C978DCED12A40B8E9CF7EA4424A40' as geometry) https://gis.stackexchange.com/a/210400 But there's probably a better way.. |
@YetAnotherMinion do you have an idea what's the right way to serialize the EWKB? |
I understand how to do the serialization. Rust-postgis code is pretty clear to me. I don't think that both geometry and geography should live in the same crate. There is some irreducible complexity around diesel_cli's automatic schema generation where both types are called I think sister crates are the best way to allow development by two relatively independent groups of users. I will create a diesel_geography crate using this one as a template because I like keeping the file layout close to diesel's internal layout. |
@YetAnotherMinion Thanks, I'm looking forward to using the |
@Boscop Update: I am now fixing compiler errors in rust-postgis 0.6 to be able to use their postgres::types::FromSql impl. The errors only appear in nightly and not stable or beta. I am going to check if this is a compiler regression. The error is consistent with trait bounds not being applied. |
@YetAnotherMinion Any update on this? :) |
I implemented |
I tried to use it with geography point type
geography(point, 4326) not null
in postgres andPgPoint
in my model struct, but it's not deserializing the values correctly:When I insert
and then print it in my Rust executable, it prints:
:/
The text was updated successfully, but these errors were encountered: