Closed AlekSi closed 8 years ago
Hey thanks for taking a look. I'll check it out this evening.
Any news?
So sorry for the long silence.
I just realized tonight the solution is much simpler than I had in my head :frowning:
You'll just need to use GeomFromEWKB() as I do in the README.
DB.Exec("INSERT INTO pois (lonlat) VALUES (GeomFromEWKB($1))", postgis.PointS{SRID: 4326, X: 42, Y: 77})
However when using SELECT, the data will be scanned automatically. I'll see if we can automate this function call.
Why are you using WKB instead of WKT in Value()
?
A mix of two reasons. EWKB is how Postgres actually stores the data so there's no chance of loss of accuracy. Secondly, it makes the code easier to maintain.
As you mention, the disadvantage is needing to do GeomFromEWKB but I'm sure there are ways to mitigate that.
We ended up implementing our own types, and just few days ago started to open-source them there: https://github.com/mc2soft/pq-types/tree/postgis
Perfect timing! You got your first star :)
Hello,
I'm using
github.com/lib/pq
and trying to insert PointS into database with code like this:It fails with
pq: invalid byte sequence for encoding "UTF8": 0x00
.