Nominate our 2022 Qt Champions!

Latlong position over any world map image using at charts

  • Hi,
    I am developing a simple app where user can enter the latlong position and the corresponding dot will be created over world map image.

    I am using qt carts for creating dot or say plotting a list of latlong positions.

    My problem is how to convert latlong position to actual image pixel and fit it to qtchart.

    I am using world image as background of qt chart. Having fixed x and y axis range same as image width and height.

    Please help .

  • It's not a simple app. There is a lot of study and a lot of math involved in doing this with real accuracy. You'll need to understand reference spheroids, DATUM, coordinate systems such as UTM vs arc-degrees, the idea of "cartographic projections", the "great circle" algorithm, and the value in translating to a linear coordinate system like UTM to make your location translations linear. GDAL is also a useful open source tool for cartographic number crunching. I always translate arc-degrees to UTM to work on since I have no interest in extreme latitudes.

    Not trying to discourage your curiosity, but don't plan on quick-n-dirty. You're going to have to dig into the science. Look at existing open-source cartographic apps to see what they are doing.

  • @Kent-Dorfman thanx for reply.

    Actually I saw few java script programs for pointing accurate pixel values on image by using Mercator projection and it's formula.

    I checked it works fine in Java script. But in qt I want to display whole lat long trace so wanted to plot chart with image as it's background. But not able to correctly det the background image as per chart x and y axis values.