[postgis-users] Difference between geometryFromText and geomFromWKB

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Jan 8 07:34:39 PST 2007


On Mon, 2007-01-08 at 10:37 -0300, Antonio Grassi wrote:

(cut)

> Does anyone know the reason of this difference? Is it due to a
> difference between the precision obtained in the asText representation
> and that of the 8 byte double? We need to work with the
> geometryFromText constructor and text representations of geometries,
> so I would be very gratefull If someone could explain this
> difference. 

Hi Antonio,

Well it's more to do with floating point numbers not being able to store
accurate numbers in base 10 - the Wikipedia article at
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems gives a
good explanation of the problem.

In short, it sounds as if you may need to use the WKB format. By
converting the hex string into a set of doubles, then outside of the
initial conversion from text to floating point as it is inserted into
the database, the accuracy on the client can be preserved.


Kind regards,

Mark.





More information about the postgis-users mailing list