NINAnor / GarminCustomMaps

The GarminCustomMap plugin exports the current map canvas to a .kmz-file, which is compatible with Garmin`s Custom Maps format for handheld GPS units. That way individual maps styled in QGIS can be used as background (raster) maps on the compatible Garmin GPS units, like Alpha, Astro, Dakota, Oregon, Colorado, GPSMAP 62 series, GPSMAP 64 series, GPSMAP 78 series, Edge 800, Montana, Rino, eTrex® 20 and 30.
GNU General Public License v2.0
18 stars 7 forks source link

Crash with zoom != 1.0 running QGIS in debug mode #19

Open nirvn opened 3 years ago

nirvn commented 3 years ago

First, nice plugin, thanks!

When running QGIS in debug mode (where ASSERTs will kill the app), the plugin causes QGIS to die when the zoom != 1.0. That's because the painter's DPI doesn't match the output DPI.

The way to fix this is to declare a DPI in the QImage used to paint the map:

                # create output image and initialize it
                image = QImage(QSize(width, height), QImage.Format_RGB555)
                image.setDotsPerMeterX(target_dpi / 0.0254);
                image.setDotsPerMeterY(target_dpi / 0.0254);
                image.fill(qRgb(255, 255, 255))
esan0 commented 2 years ago

@nirvn could you test the latest version of the plugin and report back whether you are seeing the same error or not?

Thanks