Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Get geographic data from point on map
Forum Updated to NodeBB v4.3 + New Features

[Solved] Get geographic data from point on map

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 3 Posters 3.6k 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.
  • P Offline
    P Offline
    pascal95abc
    wrote on last edited by
    #1

    Hello,

    I am creating an application in which the user should create a polygon on a map dynamically.

    Therefore, I have a Map and a MapPolygon as the Map's child. With "addCoordinate" I can add coordinates. This is my idea.
    The user should click anywhere on the map and this point should be added.
    I can get the position with mouse.x and mouse.y, this is my first step; but howto *convert them into latitude and longitude *which are the required paramters for addCoordinate ?

    Someone understood my problem and can help me ?
    Thank you!

    Qt 4.7.3
    Symbian OS v9.4 / Symbian^1, S60 5th Edition
    on N97

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

      there has been a similar discussion in "this thread":http://qt-project.org/forums/viewthread/16267/ today.

      The same question for the map projection comes up here too.
      Size of your area?
      If you want to draw on a map, you definitely need to know the mapping projection used.

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pascal95abc
        wrote on last edited by
        #3

        The size of my area is very small, i.e. not more than 100metres X 100metres. So, the earth's curvature can be neglected.
        I am working with coordinates in degree as a float, so I just have to know the factor to be multiplied with to get, say a pixel, stretched to one degree.
        I think in N/S direction and W/O the factor shall be the same.

        And sorry, I didn't saw the other thread.

        Qt 4.7.3
        Symbian OS v9.4 / Symbian^1, S60 5th Edition
        on N97

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

          You are probably looking for "Map::toCoordinate()":http://doc.qt.nokia.com/qtmobility/qml-map.html#toCoordinate-method

          [Edit: I may have misread the question...]

          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
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            The simplest conversion from degree of latitude to meters is quite simple (as long as you do not get to the details ;-) )
            The great circle of Earth is the basis for the definition of the meter. A meter is 1 / 40 000 000 of the length of this circle. Or 1 degree is 111.111 km in latitude. The scaling for longitude is only the same at the equator. The scaling there is about 111.111*cos(latitude) km per degree.

            I think you mean double (8 byte) not float (4 byte) to store lat and lon.

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

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pascal95abc
              wrote on last edited by
              #6

              Hello again.
              @koahnig: This is a very simple and good idea!
              I first had to think of the use of cosinus here what I had to clear up for me with a picture I drew.
              !http://e44.img-up.net/Screenshotya8r.png(geographic)!

              Because radius and the length of the circle is proportional for all latitudes, this leads to the formula which is really good.

              And of course "Map::toCoordinate()" which I tested and worked, is the easiest way without thinking of maths.

              Qt 4.7.3
              Symbian OS v9.4 / Symbian^1, S60 5th Edition
              on N97

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

                Thinking of what you are doing help sometimes a bit. Using already available code as well ;-)

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

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pascal95abc
                  wrote on last edited by
                  #8

                  Yes, thank you all, this really helped.

                  Maybe, you want to write in the thread linked above ("this one":http://qt-project.org/forums/viewthread/16267/).

                  Qt 4.7.3
                  Symbian OS v9.4 / Symbian^1, S60 5th Edition
                  on N97

                  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