Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drawing GPS coordinates on screen.
Qt 6.11 is out! See what's new in the release blog

Drawing GPS coordinates on screen.

Scheduled Pinned Locked Moved General and Desktop
11 Posts 6 Posters 8.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MyQT
    wrote on last edited by
    #1

    Hi,

    I want to draw GPS location as a dot on screen. please let me know the correct way of doing this.

    How can i convert latitude & longitude into coordinates to draw on screen?
    Thanks in Advance.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      That would ultimately depend on your map projection. What map projection is suitable, depends on your purposes: a display to indicate a point in a city on a map is different from one that would do the same for the whole world, for instance. Are you looking for a map to display on that screen as well (for reference perhaps)?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MyQT
        wrote on last edited by
        #3

        Hi
        Thanks for the reply.
        Actually i want to draw a point on blank screen only, not on map. (this is the requirement)
        There are @50 location available that i need to draw on screen relatively to each othere.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Again: on what scale? A park? A city? A small country? A continent? The world? And even: near the equator, or near the poles?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MyQT
            wrote on last edited by
            #5

            it is small park. or you can say play area of @1000 meter.
            I need info about how to convert latitude and longitude in coordinate system (x,y) so that I can draw it on my screen.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              "rough conversion":http://geography.about.com/library/faq/blqzdistancedegree.htm

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                I understand that, but in order to recommend a "map projection":http://en.wikipedia.org/wiki/Map_projection it is important to understand the scale you're working on.

                In your case, the distances are so small, that you can use a quite simple one. Perhaps a simple "equirectangular projection":http://en.wikipedia.org/wiki/Equirectangular_projection will do fine for your purpose.

                You can use the formula in the article referenced above to get a set of x, y coordinates. Then, all you need to do is to scale and transpose these coordinates so they can be mapped in a sensible way to your screen.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MyQT
                  wrote on last edited by
                  #8

                  Thanks for the reply.
                  My requirement is to draw GPS location which are very near to each other.
                  I tried to draw it is but becuase of GPS location are very close @10 meter range, two points are getting overlapped.

                  Do you have any solution for this?

                  M 1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mlong
                    wrote on last edited by
                    #9

                    bq. Do you have any solution for this?

                    Zoom in closer on the area in your view?

                    Otherwise, what behavior would you like to see if the points overlap?

                    Software Engineer
                    My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                    1 Reply Last reply
                    0
                    • M MyQT

                      Thanks for the reply.
                      My requirement is to draw GPS location which are very near to each other.
                      I tried to draw it is but becuase of GPS location are very close @10 meter range, two points are getting overlapped.

                      Do you have any solution for this?

                      M Offline
                      M Offline
                      Munkhtamir
                      wrote on last edited by
                      #10

                      @MyQT Hello. Did you find any solution for drawing GPS point as overlay on widget ?

                      1 Reply Last reply
                      0
                      • BuckwheatB Offline
                        BuckwheatB Offline
                        Buckwheat
                        wrote on last edited by
                        #11

                        Hi @MyQT

                        Since you do not have requirements for projections and mappings, you could use flat-earth approximation which converts decimal degrees to nautical miles. From there you can convert to feet, meters, etc.

                        Flat-earth approximation is really quite simple. There are 60nm per degree. So
                        y = latitude * 60;
                        x = longitude * 60 / cos (latitude);

                        This is fast and light weight. If you really want to localize and minimize errors, you can also subtract a local reference latitude/longitude for the park or area in question. For more robust map projections, I use GDAL (gdal.org) and PROJ.4 (proj4.org). This allows me to position anywhere in the world with surveyor accuracy. It is not as light weight but it is robust and well supported. GeographicLib also has great API for UTM/UPS and MGRS conversion.

                        One problem you could have with tight points and scaling is that if you do NOT use line width 0 in your pen, the pen width will scale as you zoom. I typically make my point diameters 1ft or .3048m and this tends to make zooming better.

                        Dave Fileccia

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved