# [Solved] Get geographic data from point on map

• 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!

• 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.

• 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.

• 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...]

• 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.

• 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.

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

• 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/).

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.