TOOL which generate GPI file from GPX

Last-modified: 2020-08-10 (月) 08:51:37
Today:?/Total:?

Abstract

This is tool which generate GPI file implemented as Custom POI on Garmin device from GPX.
CSV is not supported. Because it's terrible.

Then, USE AS IS.

DOWNLOAD

Requirements

  • 3.0.0
    .NET framework 4.8 or .NETCore3.1

  • 1.7.0
    .NET framework 4.6.1 or lator

License

See attachment license.txt.
In short, it's New BSD license.

Third party software & license

Feature

  • Generate GPI file from the folder of GPX file.
  • Generate GPI file from a definition file.
  • Supported a hierarchy category.
  • Supported POI's icon by BITMAP file.
  • Supported multi POI's icon in the one category(only generation by a definition file)
  • Supported some string encoding.(all language supported by .NET framework)
    Default is 65001(utf-8)
    But, I don't know whether a DEVICE supports or not.

  • Supported the jpeg, mp3 and TourGuide.

Compare with POI Loader

  • Even if a number exists in the GPX file name, ALERT is not enabled.
  • CSV file does not supported. Please convert it by other tool.
  • Proximity's unit is only m(meter), Speed is only km/h(meter per hour). Mile? nice joke :D
  • How to round a Proximity and Speed may be different...
  • If a waypoint is more than 512, it's divided like a POI Loader but how to round is probably different.
  • If a waypoint by the same point is more than 512, an error occurs.
    POI Loader crashes.

  • String length is 65535byte because it's saved as 2 byte.
    If a length is more than it, an error occur.
    POI Loader does not make an error but a length became a strange.

  • If there are multi jpeg/mp3/TourGuide in the one waypoint, it stores only thing which found in first.
    POI Loader stores all items. But I guess that GPI format does not support mulit jpeg/mp3/TourGuide.
    Then, since mp3's store is shared by some waypoints, a duplicated file is not stored.
    ## jpeg is stored all files because it does not share the store.
    POI Loader storesall items even if it's duplicated.

  • If "cmt" is empty and "desc" also is empty, it's not stored.
    POI Loader stores "desc" as empty.

Problem

This is implemented as GPI formart is unknow.
So, it may not normally be implemented and an invalid GPI file may be generated.
And then, an invalid GPI file is installed, a device may be not started.
# Because a Device read an invalid GPI and fails.
In this case, it restores by deleting an invalid GPI file.

Use

Use by command line.

	usage: gg.exe [OPTIONS] GPX file/Folder/HJSON [Outputted filename]
	[OPTIONS]
	  -?, -h, --help             Help
	  -c, --codepage=VALUE       Converted CodePage. Default is 65001(UTF-8).
	  -p, --proximity=VALUE      Proximity distance(m)
	  -s, --speed=VALUE          Speed. 1-199(km/h)
	  -Q                         Quiet
	  -v, --verbose              Verbose
	      --generate-hjson-from  Generate a .hjson file from FILE/FOLDER structure.
	      --test-hjson           Test a .hjson file.

Example for,

  • Generate gpi(utf-8) by one file.
    As a "poi.gpx" exists,
    >gg poi.gpx
    "poi.gpi" is generated. Category name is "poi".
  • Generate gpi(cp932) by one file.
    As a "poi.gpx" exists,
    >gg -c 932 poi.gpx
    "poi.gpi" is generated. Category name is "poi".
  • Generate gpi(utf8) by multi files.
    As the following files exist,
    poi/
        poi1.gpx
        poi2.gpx
    >gg poi
    "poi.gpi" is generated. Category name is "poi1" and "poi2".
  • Generate gpi(utf8) with hierarchy by multi files.
    As the following files exist,
    poi/
        root/
            poi1.gpx
            poi2.gpx
    >gg poi
    "poi.gpi" is generated. Category name(first) is "poi", and then Category name(Second) is "poi1" and "poi2".
  • Generate gpi(utf8) with ALERT by one file.
    As a "poi.gpx" exists,
    >gg -p 500 -s 100 poi.gpx

"poi.gpi" is generated. Category name is "poi".

  • Generate gpi(utf8) with image by multi files(#1).
    As the following files exist,
    poi/
        poi1.gpx
        poi1.bmp
        poi2.gpx
    >gg poi
    "poi.gpi" is generated. Category name is "poi1" and "poi2".
    Category "poi1"'s waypoint has an image.
    Category "poi2"'s waypoint does not have an image.
  • Generate gpi(utf8) with image by multi files(#2).
    As the following files exist,
    poi/
        root.bmp
        root/
            poi1.gpx
            poi2.gpx
    >gg poi
    "poi.gpi" is generated. Category name(first) is "poi", and then Category name(Second) is "poi1" and "poi2".
    A waypoint of the both Category has an image.
  • Generate gpi(utf8) by HJSON.
    As the following files exist,
    poi/
        poi1.gpx
        poi1.bmp
        poi2.gpx
        poi3.gpx
        poi4.gpx
    >type xx.hjson
    [
        {
            name: Category1
            categories:[{
                name: Category11
                src: poi/poi1.gpx
              },{
                name: Category12
                src: poi/poi2.gpx
              },
          ]
        },{
             name: Category2
             src:[
                 {src: poi/poi3.gpx}
                 {src: poi/poi4.gpx}
                 ]
        }
    ]
    >gg xx.hjson

"xx.gpi" is generated. GPI name is a HJSON file name.
Category is outputted as following.

+ Category1
    - Category11
    - Category12
    - Category2

Category11's contents are poi1.gpx, Category12's contents are poi2.gpx, Category2's contents are poi3.gpx and poi4.gpx.
There is not a IMAGE configuration, but image is used like a folder.
So, Category11's wypoint has poi1.bmp but other waypoints does not have an image.

  • Generate HJSON from file/folder.
    As the following files exist,
    poi/
        poi1.gpx
        poi2.gpx
    >gg --generate-hjson-from poi

"poi.hjson" is generated.

  • Check a HJSON file.
    A there is a poi.hjson
    >gg --test-hjson poi.hjson

Display the list of GPX file and IMAGE every category.
If a file exists, green circle is displayed. If it does not exist, red circle is displayed.
Then, if a problem occurs, can chose the cancel or continue.

Cannot chose on QUIET mode. Please check %ERRORLEVEL%.

Detail of definition file

HJSON format. Must utf-8 encoding.
https://hjson.org/

  • 1 category is 1 file/folder.
    {
        name:	Category name
        src:	GPX file/folder
        img:	image file
    }

If a folder is set, it's not hierarchy.
All files in folder is outputted as one categpry.

  • 1 category is multi file/folder.
    {
        name:	Category name
        src:	[
                       {
                           src:	GPX file/folder
                           img:	image file
                       }
                       ...
                  ]
        img:	image file
    }

mulit GPX files is outputted as one category

  • Category as hierarchy
{
    name:	Category name
    categories: [
                    {
                         name:	Sub Category name
                         src:	[
                                   {
                                        src:	GPX file/folder
                                        img:	image file
				    }
                                   ...
                              ]
                         img:	image file
                   }
                   ...
                ]
    img:	image file
}

"categories" is defined instead of "src".
If there is both of "src" and "categories", "src" is ignored.

  • Multi category
    [
        {
            name: Category name
            ...
        }
        ...
    ]

A definition of the former category is enclosed by [].

  • Comment
    // or /* */

[ FAQ ]
Q. doesn't work?
A.

 アキラメロン
   _工_
  /×× \
  / ××× ニヘ
 |×・∀・× ニ|
 ヽ ××× _ニ/
  \××_ニ/