3

I'm currently working on a Qt Quick application that will provide a map viewer for a smallish area (1 square KM or so), the map details for which will be provided in a single geo-referenced image file (GeoTIFF, geo-referenced PDF, ESRI Shape file etc.), along with display of current location, operator identified points of interest etc. It's primarily responsibility is the display of custom maps (as opposed to generic maps retrieved from public map image service providers (OSM, MabBox, ESRI etc)), and it will often be used in areas with limited connectivity

An extensive web search has identified others who have made similar enquiries in the past (here, Qt forums etc), and the general suggestions for solutions are as follows:

  • ArcGIS Runtime with Qt SDK Doesn't work for me as down the track I'm intending to target an embedded linux device using an ARM processor, and ArcGIS doesn't make source available for cross-compilation for arbitrary targets. They've recently produced an Android release, but nothing for ARM linux in general)
  • QGIS developer libraries GPL licence not compatible with my commercial development
  • Use the Qt Location Map component with a local tile server or offline tile collection (some plugins have recently introduced support for this) Seems a bit of a hack, as noted I'm primarily using custom maps, as opposed to offline copies of public map server images, and my images won't be big enough to really warrant tiling otherwise

It would be feasible to develop a Qt Quick component from scratch to do this, but given that the existing Qt Location Map component provides a well defined pre-existing front end interface for everything my map would need to do and has an extendable plugin based architecture, writing a custom Qt Location GeoServices plugin seems the most sensible and elegant way forward.

I've started examining the source code of the existing plugins, but can't shake the feeling that in a world containing 8 billion people, with "nothing new under the sun", this would have been done already if it was a good idea....

Would anyone with more familiarity with the Qt Location module care to comment?

Richard Lang
  • 456
  • 4
  • 15
  • Did you (consider to) ask the same in the [Qt Forum](https://forum.qt.io/)? I would expect that it might be the primary site to research your specific issue. (This aside of the fact that I found answers to _my_ questions mostly in SO but sometimes also there.) – Scheff's Cat Dec 06 '17 at 10:10
  • Yeah, have posted same question on Qt forums and GIS Stack Exchange https://gis.stackexchange.com/questions/264348/writing-a-custom-qt-location-geoservices-plugin-to-use-geo-referenced-image-file https://forum.qt.io/topic/85704/qt-location-geoservices-plugin-to-use-geo-referenced-image-file-as-map-source – Richard Lang Dec 06 '17 at 16:46

2 Answers2

1

Since geo-referenced images can be arbitrarily large, it is the standard to convert them into a tile pyramid, to be able to efficiently display them on any hardware (at the cost of doubling the size, at worst, depending on how many layers you want). Even if you would write your own geoservice plugin, you most likely will end up (directly or by using 3rd party code) tiling your geotiff.

This said, QtLocation does allow you to use custom tilesets ( http://doc.qt.io/qt-5/location-plugin-osm.html, look for osm.mapping.custom.host) served in most ways (http, https, file, qrc, etc.).

So go ahead, fire up QGis, install the QTiler plugin, and convert your images. If you need to serve these pictures over the net directly to the clients (thus needing to do the conversion on the client), you can either see what QTiler does, or build up your gdal pipeline (gdal_translate, gdalwarp and gdal2tiles), and ship the relevant gdal bits with your application.

If you need multiple images at the same time, you can either use multiple Plugin elements with different plugin parameters, or you can fork the osm plugin and support multiple custom hosts.

Pa_
  • 641
  • 1
  • 5
  • 17
  • Thanks Paul, As noted above I was aware of this approach, but was working on the assumption that the map files I would be working with would be small enough that tiling them (as opposed to loading the entire image at once) wouldn't be intrinsically appropriate. However now I've started playing with a couple of real world example files (approx. 1M geo-referenced PDFs) I see that they easily balloon to to 5-10x the size by the time they have been rendered as an in-memory raster image, which as I'm intending to target an embedded platform is getting up there a bit. – Richard Lang Dec 07 '17 at 23:00
  • Took a bit of a look at the Qt Location source, and what I was proposing looked pretty hard work for a newcomer too. Got the impression that the plugin would have to fully implement it's own image transforms (including camera model effects) and scene graph manipulation, with very little in the way of documentation, example code or source comments to point the way. – Richard Lang Dec 07 '17 at 23:10
0

Based upon Paul's response, and a couple of similar responses to the same enquiry on Qt forums and mailing lists, plus my own investigation, I'd conclude the following:

Generating a custom Qt Location GeoServices plugin to directly provide map imagery from a geo-referenced image file would not be a great idea as the implementation would be less than straightforward, and in practice any non-trivial map image would likely be large enough that an initial tiling step, followed by use of one of the standard tiled mapping plugins referencing a local tile set would be more appropriate anyway.

Richard Lang
  • 456
  • 4
  • 15