Qt World Summit: Submit your Presentation

QtLocation with custom map

  • Hi,

    Is there something in Qt Location module which could work with custom map (Mercator projected) and convert gps coord BLH to cartezian xyz on a given map. So basicaly convert lat long to pixels x/y on a custom map (lat/long of the cornes are given)

    Best Regards

  • Lifetime Qt Champion


    I may be wrong but that likely would require a custom plugin.

    I'd recommend asking this on the interest mailing list. You'll find there QtLocation's developers/maintainers.

  • Moderators

    @SGaist said in QtLocation with custom map:

    I may be wrong but that likely would require a custom plugin.

    You're not wrong. I've researched it recently and it appears the only way is to write your own plugin.

  • You could look into the ArcGIS Runtime SDK for Qt. This is a 3rd party API outside of Qt Location, and there is extensive support for many different coordinate systems and data conversions (among many other things)- https://developers.arcgis.com/qt/latest/qml/guide/spatial-references.htm

  • Thanks for that link.
    I have written some functions to convert from spherical GPS to flat x,y with Mercator projection, but this link may be very usefulf.

    Best Regards

  • @Marek, also look at GDAL (www.gdal.org) as it does a whole host of geospatial referencing using WKT. There are literally thousands of pre-defined projects available for use.

  • atually I had this problem:
    I have a rectangle map of a small area (1km), map is not facing north, so when I get GPS coordinates of the four corners they don't make rectangle with right angles but some rhomboid figure. I thought that after applying mercator equation to GPS coordinates It will translate this to rectangle with right angles so I can have rect piece of map (x,y in pixels) and rect gps data that I can compare, but again mercator produced rhomboid figure just in different coordinates. Finally I had to write some mathematical function to translate rhomboid (gps coordinates) to rectangle and then compare translated gps data to rectangle image (in pixels).
    Is this a common problem with gps data and piece of map not facing the north ?

  • Moderators

    @Marek said in QtLocation with custom map:

    Is this a common problem with gps data and piece of map not facing the north ?

    I'm no expert but I'd expect it is. Mercator is a cylindrical projection and as such is not "preserving" all the qualities of the original WGS84 (or equivalent) coordinates. Actually I'd expect similar problems with most if not all possible projections.

  • @Marek Since the earth is a sphere and longitude line not being parallel, the further away from the equator you go, the less "flat" type mappings make sense. What happens in these cases (for a decent approximation), the cos (lat) is always a factor when going from lat,lon,alt to x,y,z. So you can get crazier mappings. Most good projections are only valid for a small region before a new one will need to be used (look at US SP27 or NAD83 and UTM) to keep a rough grid. This presents a problem when crossing zones or matching up coordinates. You have to know the projections used.

    The better solution would be to rectify your image so you know what corner represents what lat,lon and its orientation. Then you cam map it onto your coordinates.

    For some good tools so you do not have to write projections (leave it to the masters that wrote them long ago)

    www.gdal.org - GDAL
    geographiclib.sourceforge.net - GeoGraphicLib
    proj.osgeo.org - PROJ.4

    The sites provide software to do all the transforms you could ever want... and more. ArcGIS is good too but it is pay for play if you are selling a product. The others are open source.

    Good Fun!

Log in to reply