Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:04:10+00:00 2026-06-02T11:04:10+00:00

I’m asking you because I struggled for a few days now ; I searched

  • 0

I’m asking you because I struggled for a few days now ; I searched the Internet and stackoverflow and didn’t find anything.

I need to place markers/circles/whatever quite precisely on a map.
However, it seems that I can only draw them on a grid whose degree of precision depends on the place I am. Therefore, their location is not accurate enough.

I’m using Wt (C++), but it doesn’t seem to be part of the issue.
I wrote code that draws a 20*20 array of circles, whose coordinates are equally spaced. I don’t get the same results whether I’m in Paris or in New York.

In Paris :
(can’t post images, because it’s my first question)
http://img818.imageshack.us/img818/7841/parism.png

In New-York :
http://img193.imageshack.us/img193/9822/newyorkq.png

In Paris, I get accuracy in longitude, but not in latitude.
In New-York, I can’t get accuracy either in latitude nor in longitude.

Here is the code I used :

    /*Choose between both*/
    double centerLat = 40.714468; double centerLng = -74.005966;//New-York
    //double centerLat = 48.854607; double centerLng = 2.347126;//Paris

    /*Other parameters*/
    double lngMargin = 0.000400;
    double latMargin = 0.000400;
    int granularity = 20;

    int i,j;
    WVBoxLayout* layout = new WVBoxLayout();
    WColor::WColor myBlue = WColor::WColor(0,0,255,255);
    WColor::WColor myRed  = WColor::WColor(255,0,0,255);
    WColor::WColor myTransparent = WColor::WColor(0,0,0,0);
    WGoogleMap::Coordinate coordArray[granularity][granularity];

    /* Creating and configuring the map */
    WGoogleMap *map = new WGoogleMap(WGoogleMap::Version3);
    WGoogleMap::Coordinate centerCoord = WGoogleMap::Coordinate(centerLat,centerLng);
    setLayout(layout);
    resize(height,width);
    map->setCenter(centerCoord,19);
    map->setMapTypeControl(WGoogleMap::DefaultControl);
    map->enableScrollWheelZoom();
    map->addCircle(centerCoord,2,myBlue,2,myTransparent);

    /* Here is the loop that draws the circles */
    for(i=0 ; i<=granularity-1 ; i++){
            for(j=0 ; j<=granularity-1 ; j++){

                    coordArray[i][j] = WGoogleMap::Coordinate(centerLat + beforeOrAfterTheCenter_Lat * (latMargin/granularity) * i,
                                    centerLng + beforeOrAfterTheCenter_Lng * (lngMargin/granularity) * j); 

                    map->addCircle(coordArray[i][j],1,myRed,2,myTransparent);
            }
    }

The code is supposed to work okay. Do you have any clue about what I could do to get more accuracy ? Is it a well-known issue ?

Thank you very much for any help you could provide,

L.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:04:11+00:00Added an answer on June 2, 2026 at 11:04 am

    After some hours of struggling, I finally found out what the issue was.

    I’m using Wt (C++), but it doesn’t seem to be part of the issue

    Well, it was actually.
    Wt uses a std::stringstream to generate JavaScript code, and this object doesn’t has default infinite precision when you give him 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.
    That’s why we had great precision for longitude in Paris, but not for latitude (lng is 6 but lat is 45). And that’s why precision for both latitude and longitude in New-York was poor (both have 2 digits before the point)

    To solve the issue, I just overloaded the addCircle (and addMarker and all the other functions) with a custom function of mine and I set the precision of the std::stringstream used with the
    std::stringstream::precision(int n)
    method that I didn’t know yet.

    I’m reporting this issue on the Wt redmine, it may be corrected soon.

    Heitor, muito obrigado pela ajuda.

    See you,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.