[postgis-users] Problem with PostGIS 1.0.0 RC1
Markus Schaber
schabios at logi-track.com
Sat Jan 22 06:26:43 PST 2005
Hi, Mark,
Mark Cave-Ayland schrieb:
> Could we do this using the type system? For example, could we create a new
> type called postgis_binary and then change GeomFromWKB to accept
> postgis_binary instead of bytea? We then write two implicit casts: a bytea
> to postgis_binary cast and a text to postgis_binary cast. In the case of the
> bytea to postgis_binary cast, we simply return the binary data unaltered.
> For the text to postgis_binary cast, we parse the hex string into binary and
> return that. Hopefully this would allow GeometryFromWKB() to work with both
> bytea and hex string data.... What do you think?
I don't think the work of introducing and maintaining a new PostgreSQL
type is worth the effort (but strk may correct me, as he's the one who
has to do the work :-).
My solution would be to have two GeometryFromWKB() methods, one accepts
bytea and the other text.
Both are implemented as small stubs that both call the same WKB parsing
function, but with a different "byte getting" method. In C, the easiest
way to do this should be a struct that includes context information and
a function pointer to the actual byte reading function.
This is somehow similar to the approach I took in my Java code, but I
had the advantage that Java provides classes and objects.
HTH,
Markus
More information about the postgis-users
mailing list