GPSFileDepot Forums

General Category => Map Making Support => Topic started by: nm_map_user on April 23, 2013, 09:12:16 AM

Title: Creating installer using Inno
Post by: nm_map_user on April 23, 2013, 09:12:16 AM
In this thread - http://forums.gpsfiledepot.com/index.php/topic,2383.0.html (http://forums.gpsfiledepot.com/index.php/topic,2383.0.html) (page 9), you provide a sample Inno script. I just want to make I understand this script. If I read the script correctly, you are forcing the user to install in the user's Garmin\maps directory. Also, I see no indication that you are writing the registry entries. Not a criticism, just a question.

Thanks.
Title: Re: Creating installer using Inno
Post by: Boyd on April 23, 2013, 10:50:33 AM
My technique uses Garmin's new(er) .gmap format which IMO is a big improvement over the older registry based maps. .gmap is file/directory based and therefore compatible with both MacOS and Windows. Actually, you don't even need an "installer" for .gmap - just copy the .gmap folder to the ~\Garmin\Maps folder and it's "installed".  ;) That's really all the installer is doing, aside from providing a little info to the user.

You must install the maps in this directory (which varies on different versions of Windows - see that other long thread) or Basecamp and Mapsource won't "see" them. If a user wants them in another location, that can be accomplished after installation using gmtk: http://www.javawa.nl/gmtk_en.html

The same author also has a tool for converting .gmap back to the registry format (MapReverseConverter) if a user needs to (for using them with nRoute, for example).

Actually, I think the inno installer does write something to the registry, so that you can uninstall the map. This registry stuff is like a black art for me, since I come from a unix/Mac background.  ;) But we've see lots of threads here relating to registry problems. Microsoft changed something in Win 7/64 which broke the old GPSFileDepot installer (IIRC,it used different keys for something).

Then there's the problem where people just delete the map files without uninstalling. This will break Mapsource - I think it will refuse to start with a cryptic message if you do this. And allowing the user to choose an install directory is just asking for trouble in most cases. This makes people think they need to "open" the .img files in that directory. We get lots of threads about this here. A very small number of users want to install maps in a custom location (not on the C drive), but they can do this with GMTK.

None of this is a problem with .gmap. Just throw away the folder and the map will be deleted, for example. I see all of this as an advantage - not to mention the universal format that only requires one download for both platforms. But Oz's installer is still available if you prefer it.

I would love to see others pick up the ball and improve on the basic inno script, but there hasn't been a whole lot of interest so far.  :)
Title: Re: Creating installer using Inno
Post by: BobT on April 23, 2013, 03:39:02 PM
I use Inno and have attached one of my scripts.  I allow the user to use the default install location or choose their own.  I also give them the option to install the original GPS tracks in case they want to view them in Google Earth.  I also give them the option to install some Word documents that explain how to get Mapsource, Basecamp, and how to load onto your GPSr.  Also included is how to get tracks off of a Nuvi and some settings changes to make to a Nuvi for off road use.  I make ATV Trail maps which are quite different than what of the guys on this site make.  I have a basic script that I just use "find and replace" to use if for a different map.  The script has some extra lines for installing the optional files and documents.

By the way I have never heard of anyone having trouble with the Window 7 issue of not recognizing the map.
Title: Re: Creating installer using Inno
Post by: nm_map_user on April 23, 2013, 04:30:24 PM
I was unfamiliar with the .gmap approach. To try it out, I took a mapset that was working via registry entries and moved the files (mapsetname.img, mapsetname.tdb, and *.img)  to ...AppData/Roaming/Garmin/Maps/<mapsetname>.gmap/
I removed the registry entries.
I fire up MapSource (6.16.3) and the maps don't appear on the list of available mapsets. I guess I don't understand what you're saying to do.
Title: Re: Creating installer using Inno
Post by: Boyd on April 23, 2013, 04:38:33 PM
You can't just go dragging files around, they must be converted.  ;)

The classic way is to use a Garmin antique called mapconverter: http://www8.garmin.com/support/download_details.jsp?id=3898

Run this and it will let you choose which maps to convert (it leaves the original registry maps in place). Then you will have a .gmap.

JaVaWa also has a tool for this, which looks good but I haven't tried it myself. http://www.javawa.nl/mapconverter_en.html
Title: Re: Creating installer using Inno
Post by: nm_map_user on April 23, 2013, 04:59:31 PM
Quote from: Boyd on April 23, 2013, 04:38:33 PM
You can't just go dragging files around, they must be converted.  ;)

The classic way is to use a Garmin antique called mapconverter: http://www8.garmin.com/support/download_details.jsp?id=3898



How about when you're creating a new mapset? How do I get from the outputs of cgpsmapper (*.img, .tdb) to gmap? The description of mapconverter suggests that it will convert installed maps. Do I have to install them first, just to create the gmap format? Is there a 3rd party tool that will assemble the pieces. I tried looking for such a thing, but nothing seemed to fit.
Title: Re: Creating installer using Inno
Post by: Boyd on April 23, 2013, 06:20:41 PM
The software in my previous post is the only way I know of making a .gmap. For a GPSFileDepot author, the final step in the process would usually be to run Mapconverter on your Windows mapset to create the Mac version. http://www.gpsfiledepot.com/tutorials/how-to-create-garmin-topo-maps---part-9---compiling-data/
Title: Re: Creating installer using Inno
Post by: Seldom on April 23, 2013, 06:34:54 PM
To recap: compile w/ cgpsmapper to create IMG files and use MapSetToolkit or cgpsmapper to create TDBs & IDXs.  Use either JavaWa's software or MapConverter to create the GMAP from the cgpsmapper compiled files.  Use Innosetup to create the GMAP installer. 

Did I miss a way to directly compile GMAP files, and if so, what data does that compiler use?  It was a mighty long thread.
Title: Re: Creating installer using Inno
Post by: nm_map_user on April 23, 2013, 07:23:11 PM
I just downloaded Garmin MapConverter and verified what the description appears to say - it will only convert mapsets that are already installed. So, unless you want to install the mapset just to convert it, stick with JaVaWa Mapconverter.

If you select convert and install, JaVaWa will place the maps in C:\Program Data\Garmin\Maps. However, the maps will also work in \users\<user-name>\AppData\Roaming\Garmin\Maps, which strikes me as a much better place for them (though I suppose they probably won't be found by other users on the same computer.)
Title: Re: Creating installer using Inno
Post by: Boyd on April 23, 2013, 07:51:35 PM
Quote from: Seldom on April 23, 2013, 06:34:54 PMDid I miss a way to directly compile GMAP files

I have never heard of such a thing.
Title: Re: Creating installer using Inno
Post by: popej on April 24, 2013, 09:10:34 AM
I'm using some batches to install maps.

For example this one finds directory for gmap files, it works in Windows XP and later:

@echo off
echo.
if "%OS%"=="Windows_NT" goto :DIRECT
echo This batch works only on Windows 2000 or later.
goto :STOP

:DIRECT
SETLOCAL ENABLEEXTENSIONS
if DEFINED ProgramData (
set ALL_DIR=%ProgramData%
goto DISPLAY
)

set APP_DIR1=%APPDATA%
:LOOP
set APP_DIR2=%APP_DIR1%
for /F "tokens=1,* delims=\" %%i in ("%APP_DIR1%") do set APP_DIR1=%%j
if NOT "%APP_DIR1%" == "" goto LOOP
set ALL_DIR=%ALLUSERSPROFILE%\%APP_DIR2%

:DISPLAY
echo ====== Directories ===========================
echo.
echo %ALL_DIR%\Garmin\Maps
echo.
echo %APPDATA%\Garmin\Maps
echo.
echo.
echo ====== Maps ==================================
echo.
dir /A:D /B "%ALL_DIR%\Garmin\Maps\*.gmap" 2> NUL
dir /A:D /B "%APPDATA%\Garmin\Maps\*.gmap" 2> NUL
echo.
echo ==============================================

:STOP
echo.
ENDLOCAL
pause


Next one is for installing gmap directory. It should be placed next to gmap folder. Folder name should be set in MAPSET and MAPDEL variables inside batch. This batch needs Vista or later Windows.

@echo off
echo.
if "%OS%"=="Windows_NT" goto :DIRECT
echo This batch works only on Windows 2000 or later.
goto STOP

:DIRECT
SETLOCAL ENABLEEXTENSIONS

set MAPSET=OSMfenixAfrica_v3
set MAPDEL=OSMfenixAfrica
if NOT exist "%MAPSET%.gmap" (
echo. == Unknown mapset, nothing installed.
goto STOP
)

if DEFINED ProgramData (
set ALL_DIR=%ProgramData%
goto WORK
)

set APP_DIR1=%APPDATA%
:LOOP
set APP_DIR2=%APP_DIR1%
for /F "tokens=1,* delims=\" %%i in ("%APP_DIR1%") do set APP_DIR1=%%j
if NOT "%APP_DIR1%" == "" goto LOOP
set ALL_DIR=%ALLUSERSPROFILE%\%APP_DIR2%

:WORK
if exist "%ALL_DIR%\Garmin\Maps" (
for /D %%I in ("%ALL_DIR%\Garmin\Maps\%MAPDEL%*.gmap") do (
rd "%%I"
if not exist "%%I" (
echo. == %%~nI uninstalled from %ALL_DIR%\Garmin\Maps
echo.
)
)
)
if exist "%APPDATA%\Garmin\Maps" (
for /D %%I in ("%APPDATA%\Garmin\Maps\%MAPDEL%*.gmap") do (
rd "%%I"
if not exist "%%I" (
echo. == %%~nI uninstalled from %APPDATA%\Garmin\Maps
echo.
)
)
)
if exist "%ALL_DIR%\Garmin\Maps" (
if exist "%ALL_DIR%\Garmin\Maps\%MAPSET%.gmap" rd "%ALL_DIR%\Garmin\Maps\%MAPSET%.gmap"
if NOT exist "%ALL_DIR%\Garmin\Maps\%MAPSET%.gmap" (
mklink /J "%ALL_DIR%\Garmin\Maps\%MAPSET%.gmap" "%~dp0%MAPSET%.gmap"
if exist "%ALL_DIR%\Garmin\Maps\%MAPSET%.gmap" (
echo. == %MAPSET% installed in %ALL_DIR%\Garmin\Maps
echo.
goto STOP
)
)
)

if not exist "%APPDATA%\Garmin\Maps" md "%APPDATA%\Garmin\Maps"
if exist "%APPDATA%\Garmin\Maps" (
if exist "%APPDATA%\Garmin\Maps\%MAPSET%.gmap" rd "%APPDATA%\Garmin\Maps\%MAPSET%.gmap"
if NOT exist "%APPDATA%\Garmin\Maps\%MAPSET%.gmap" (
mklink /J "%APPDATA%\Garmin\Maps\%MAPSET%.gmap" "%~dp0%MAPSET%.gmap"
if exist "%APPDATA%\Garmin\Maps\%MAPSET%.gmap" (
echo. == %MAPSET% installed in %APPDATA%\Garmin\Maps
echo.
goto STOP
)
)
)

echo. == No maps installed.

:STOP
echo.
ENDLOCAL
pause


Last one installs map in old img format. It isn't universal batch but only an example. All file names and FID should be set correctly inside batch and batch should be placed in map directory. Actually this is a batch created by GMapTool:

echo off
echo -
echo -
echo -  This batch will install map for Mapsource
echo -
echo -  Map:  "Test Example"
echo -  FID:  9021
echo -  PID:  1
echo -
echo -  Press Enter to continue or Ctrl-C to abort.
echo -
pause

echo Adding registry keys.

set KEY=HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource
if %PROCESSOR_ARCHITECTURE% == AMD64 goto key_ok
set KEY=HKLM\SOFTWARE\Garmin\MapSource
:key_ok

reg ADD %KEY%\Families\FAMILY_9021 /v ID /t REG_BINARY /d 3D23 /f
reg ADD %KEY%\Families\FAMILY_9021\1 /v Loc /t REG_SZ /d "%~dp0\" /f
reg ADD %KEY%\Families\FAMILY_9021\1 /v Bmap /t REG_SZ /d "%~dp0TestMap.img" /f
reg ADD %KEY%\Families\FAMILY_9021\1 /v Tdb /t REG_SZ /d "%~dp0TestMap.tdb" /f
pause
exit 0