Maproom / qmapshack

Consumer grade GIS software
GNU General Public License v3.0
298 stars 64 forks source link

Support for Garmin timezone map img #679

Open howff opened 4 months ago

howff commented 4 months ago

Is your feature request related to a problem? Please describe.

No problem, apart from when you load gmaptz.img there's no map displayed.

Describe the solution you'd like

The Garmin timezone map file gmaptz.img is presumably a map where the polygons have an attribute that gives an offset from UTC. (although this is just my assumption). It would be nice to be able to visualise this in qmapshack since it already has great support for Garmin img files.

Describe alternatives you've considered

After some internet research I've not found any other software which can do this (I've tried gpsmapedit, gmaptool etc)

Give a reason why someone else should spend time on that request

There are many reports of people trying to debug problems on their gps device/watch where there seems to be a timezone problem so I though this would help those people determine if it's a timezone bug or a device bug.

Additional context

wthaem commented 4 months ago

The Garmin timezone map file gmaptz.img is presumably a map

No. This file has a structure different to the usual gmapsupp.img map file structure - map tile subfiles are not included in the file (can be checked with GMapTool). Thus, no map can be displayed.

The following TMS/WMTS file can be used in QMS to show worldwide timezones:

<TMS>
<Layer idx="0">
<Title>Timezones (WMTS)</Title>
<Script><![CDATA[(
function convert(z,x,y)
{
z=z;
return "http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/WorldTimeZones/default/default028mm/"+z+"/"+y+"/"+x+".png"
}
)]]></Script>
</Layer>
</TMS>    
howff commented 4 months ago

Ah, when I saw the gmaptool output for my file I thought there was a map?

File:       gmaptz.img, length 579584
Header:     03.04.2024 12:37:46, DSKIMG, XOR 00, V 37.00, Ms 0, 006-D1074-00
Mapset:     Time Zone Map
fat:        1000h - 1200h - 1C00h, block 1024
maps:       1, sub-files 3

Sub-file         fat     length
 TIMEZONE RGN   1200h    555898
 TIMEZONE LBL   1800h      2954
    CP 1252, American
 TIMEZONE TRE   1A00h     13018
    map 1e13f7d (31539069)
    date 03.04.2024 12:18:03
    priority 0, parameters 0 0 33 0, signed
    levels [13,14,15,16], zoom [86,85,84,3]
    N: 90.000000, S: -90.000000, W: -180.000000, E: 180.000000
    GARMIN TimeZone Map
    Copyright 1995-2024 by GARMIN Corporation.

Map              length s-f  CP    prio  PID   FID  name
 TIMEZONE MPC    571870  3  1252   0   S
kiozen commented 4 months ago

The structural information of each IMG file is easy to read as it is well known. The above lists the section of data in the file. LBL and TRE are also well known. The general structure of the RGN section, too.

However if it comes to the details of the coded data in the RGN section things get difficult. Not everything is known. As this data is highly compressed failing to interpret a sequence of bits will result into failing to read the data after this field as there is no general size information.

As far as I know the format of the information stored in the timezone file is not known publicly. Therefore someone has to reverse engineer it. This is a very time consuming task. So I doubt anyone is volunteering.

QMapShack has an internally stored timezone file. To activate it you select menu->View->Setup Timezone->Automatic. The database is quite old, thus expect some mismatch in certain regions of the wold. Also next to the sea shore and borders the database lacks precision due to quantification. But same applies to the Garmin file, too.

howff commented 4 months ago

Thanks very much for your detailed explanation.