Project

General

Profile

[WGoogleMap] Precision issue with markers / dirty JavaScript generation

Added by Lucas Vitorino about 12 years ago

Hi all,

It seems that I don't have the rights to open an issue, so I'm posting it here.

But I think this is an issue and should be corrected.

I need to use a WGoogleMap widget for my application, and to draw markers with quite a high precision.

After some struggling, it came obvious that the Wt library was not offering that precision by default.

The thing is that no matter the precision of the WGoogleMap::Coordinate object, the precision of the std::stringstream used to generate the JavaScript is not high enough.

By default, even if you feed this object a double, it just takes 6 digits. That means that if you have 1 digit before the point, you have 5 after, and if you have 2 digits before the point, you have 4 after.

Therefore, the precision depends on the coordinates.

For example :

- In Paris, (lat = 45 lng = 6) : you have poor precision in latitude (4 digits), but great in longitude (5 digits)

  • In New York (lat = 40 lng= 74) : you have poor precision in both latitude and longitude

To solve the issue, the precision of the std::stringstream object must be set with the std::stringstream.precision(int n) method before generating the JavaScript code and appending the values of the W:GoogleMap::Coordinate object's members.

Will it be added in a future release of Wt ?

Or is there a feature I did not see to set this precision ?

Have a good day,

Lucas


Replies (1)

RE: [WGoogleMap] Precision issue with markers / dirty JavaScript generation - Added by Wim Dumon about 12 years ago

Weird, anyone should be able to open an issue...

Anyway, I created one for you: #1253

    (1-1/1)