[Qgis-developer] Full geometry of a point

Martin Dobias wonder.sk at gmail.com
Sun Apr 5 19:40:11 EDT 2009


On Sun, Apr 5, 2009 at 11:33 PM, Matthew Vavrek <mattvavrek at hotmail.com> wrote:
> Sorry I wasn't more specific before, but I did get what I wanted eventually
> using the exportToWkt() function. I was using asPoint() before, and it was
> giving me the shortened values. Not sure if this should be noted somewhere
> in the API (or if it already is and I missed it)

The asPoint() function must not do any changes to the geometry. I
suspect that the loss of precision happened when doing conversion to
string - check out this:

>>> "%f" % 123.4567890123456789
'123.456789'

for better precision, override the precision:

>>> "%.9f" % 123.4567890123456789
'123.456789012'

Regards
Martin


More information about the Qgis-developer mailing list