logo separator

[mkgmap-dev] overview, tdb, detail files naming

From Anton Todorov antod05-mkgmap at yahoo.co.uk on Sun Jun 21 08:18:33 BST 2009

Hi,
I am new to the list but would like to share some thoughts about naming the files.

Detail maps: the files has name of 8 digits. The internal subfiles are with the same digits or combination of 'I'+7digits.

TDB: there is relation that is always digits(4byte field) to map names.(section 0x42 for overview and 0x4c for detail)

Overview map: in mkgmap the map name is 8 digits too. But mapsource permit the use of text for overview and tdb file. So I think for overview map we should think that there are two definitions: mapname and mapnumber than can be different. for example the overview map and tdb files can have name Country.img and Country.tdb, the detail map with file name 12345678.img. The only thing that need to be added is the internal map number in Country.img and this number to be described in Country.tdb (section 0x42 and 0x4c).

I attached patch for this change in my previous mail but maybe it is lost. So here is the patch inline:

Best Regards,
Anton Todorov

Index: doc/mkgmap-man.txt
===================================================================
--- doc/mkgmap-man.txt    (revision 1067)
+++ doc/mkgmap-man.txt    (working copy)
@@ -28,4 +28,9 @@
     displayed in the chosen character set into unaccented characters.
 
 --overview-mapname=''name''
-    This gives the name of the overview map.
+    If --tdbfile is enabled, this gives the name of the overview .img and .tdb files.
+    The default map name is OSM_map.
+    
+--overview-mapnumber=''8 digit number''
+    If --tdbfile is enabled, this gives the internal 8 digit number used in overview map and
+    tdb file. The default number is 63240000.
Index: resources/help/en/options
===================================================================
--- resources/help/en/options    (revision 1067)
+++ resources/help/en/options    (working copy)
@@ -98,7 +98,14 @@
 --series-name
 --family-name
 --area-name
---overview-mapname
+--overview-mapname=name
+    If --tdbfile is enabled, this gives the name of the overview .img and .tdb files.
+    The default map name is OSM_map.
+    
+--overview-mapnumber=8 digit number
+    If --tdbfile is enabled, this gives the internal 8 digit number used in overview map and
+    tdb file. The default number is 63240000.
+    
 
 Misc options:
 --max-jobs[=number]
Index: src/uk/me/parabola/mkgmap/CommandArgsReader.java
===================================================================
--- src/uk/me/parabola/mkgmap/CommandArgsReader.java    (revision 1067)
+++ src/uk/me/parabola/mkgmap/CommandArgsReader.java    (working copy)
@@ -56,7 +56,8 @@
         // line before any user supplied options.
         add(new CommandOption("mapname", "63240001"));
         add(new CommandOption("description", "OSM street map"));
-        add(new CommandOption("overview-mapname", "63240000"));
+        add(new CommandOption("overview-mapname", "OSM_map"));
+        add(new CommandOption("overview-mapnumber", "63240000"));
     }
 
     public CommandArgsReader(ArgumentProcessor proc) {
Index: src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java    (revision 1067)
+++ src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java    (working copy)
@@ -48,6 +48,7 @@
 
     private int parent = 63240000;
     private String overviewMapname;
+    private String overviewMapnumber;
     private String overviewDescription;
     private int tdbVersion;
 
@@ -59,11 +60,12 @@
      * In otherwords if the same argument appears more than once, then it will
      */
     public void init(CommandArgs args) {
-        overviewMapname = args.get("overview-mapname", "63240000");
+        overviewMapname = args.get("overview-mapname", "OSM_map");
+        overviewMapnumber = args.get("overview-mapnumber", "63240000");
         try {
-            parent = Integer.parseInt(overviewMapname);
+            parent = Integer.parseInt(overviewMapnumber);
         } catch (NumberFormatException e) {
-            log.debug("overview map name not an integer", overviewMapname);
+            log.debug("overview map number not an integer", overviewMapnumber);
         }
 
         overviewDescription = args.get("overview-description", "Overview Map");
@@ -113,7 +115,7 @@
         String mapname = finfo.getMapname();
         String mapdesc = finfo.getDescription();
 
-        detail.setMapName(mapname);
+        detail.setMapName(mapname, mapname);
 
         String desc = mapdesc + " (" + mapname + ')';
         detail.setDescription(desc);
@@ -123,7 +125,8 @@
         detail.setNetDataSize(finfo.getNetsize());
         detail.setNodDataSize(finfo.getNodsize());
 
-        log.info("overview-mapname", parent);
+        log.info("overview-mapname", overviewMapname);
+        log.info("overview-mapnumber", parent);
         detail.setParentMapNumber(parent);
 
         tdb.addDetail(detail);
@@ -216,7 +219,7 @@
 
         // We can set the overall bounds easily as it was calcualted as part of
         // the overview map.
-        tdb.setOverview(overviewMapname, overviewSource.getBounds());
+        tdb.setOverview(overviewMapname, overviewSource.getBounds(), overviewMapnumber);
 
         writeTdbFile();
         writeOverviewMap();
@@ -234,7 +237,7 @@
         params.setMapDescription(overviewDescription);
 
         try {
-            Map map = Map.createMap(overviewMapname, params);
+            Map map = Map.createMap(overviewMapname, params, overviewMapnumber);
             mb.makeMap(map, overviewSource);
             map.close();
         } catch (FileExistsException e) {
Index: src/uk/me/parabola/mkgmap/main/MapMaker.java
===================================================================
--- src/uk/me/parabola/mkgmap/main/MapMaker.java    (revision 1067)
+++ src/uk/me/parabola/mkgmap/main/MapMaker.java    (working copy)
@@ -86,7 +86,7 @@
 
         log.info("Started making", args.getMapname(), "(" + args.getDescription() + ")");
         try {
-            Map map = Map.createMap(args.getMapname(), params);
+            Map map = Map.createMap(args.getMapname(), params, args.getMapname());
             setOptions(map, args);
 
             MapBuilder builder = new MapBuilder();
Index: src/uk/me/parabola/mkgmap/main/AbstractTestMap.java
===================================================================
--- src/uk/me/parabola/mkgmap/main/AbstractTestMap.java    (revision 1067)
+++ src/uk/me/parabola/mkgmap/main/AbstractTestMap.java    (working copy)
@@ -54,7 +54,7 @@
 
         Map map;
         try {
-            map = Map.createMap("32860003", params);
+            map = Map.createMap("32860003", params, "32860003");
         } catch (FileExistsException e) {
             throw new ExitException("File exists already", e);
         } catch (FileNotWritableException e) {
Index: src/uk/me/parabola/tdbfmt/TdbFile.java
===================================================================
--- src/uk/me/parabola/tdbfmt/TdbFile.java    (revision 1067)
+++ src/uk/me/parabola/tdbfmt/TdbFile.java    (working copy)
@@ -118,10 +118,10 @@
      * @param name The overview map name.
      * @param bounds The bounds for the map.
      */
-    public void setOverview(String name, Area bounds) {
+    public void setOverview(String name, Area bounds, String number) {
         overviewMapBlock = new OverviewMapBlock();
         overviewMapBlock.setArea(bounds);
-        overviewMapBlock.setMapName(name);
+        overviewMapBlock.setMapName(name, number);
         overviewMapBlock.setDescription(overviewDescription);
     }
 
Index: src/uk/me/parabola/tdbfmt/OverviewMapBlock.java
===================================================================
--- src/uk/me/parabola/tdbfmt/OverviewMapBlock.java    (revision 1067)
+++ src/uk/me/parabola/tdbfmt/OverviewMapBlock.java    (working copy)
@@ -107,10 +107,10 @@
         this.description = description;
     }
 
-    public void setMapName(String mapName) {
+    public void setMapName(String mapName, String mapNumber) {
         this.mapName = mapName;
         try {
-            this.mapNumber = Integer.parseInt(mapName);
+            this.mapNumber = Integer.parseInt(mapNumber);
         } catch (NumberFormatException e) {
             this.mapNumber = 0;
         }
Index: src/uk/me/parabola/imgfmt/app/map/Map.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/map/Map.java    (revision 1067)
+++ src/uk/me/parabola/imgfmt/app/map/Map.java    (working copy)
@@ -81,7 +81,7 @@
      * @throws FileNotWritableException If the file cannot
      * be opened for write.
      */
-    public static Map createMap(String mapname, FileSystemParam params)
+    public static Map createMap(String mapname, FileSystemParam params, String mapnumber)
             throws FileExistsException, FileNotWritableException
     {
         Map m = new Map();
@@ -92,13 +92,13 @@
         m.filename = outFilename;
         m.fileSystem = fs;
 
-        m.rgnFile = new RGNFile(m.fileSystem.create(mapname + ".RGN"));
-        m.treFile = new TREFile(m.fileSystem.create(mapname + ".TRE"), true);
-        m.lblFile = new LBLFile(m.fileSystem.create(mapname + ".LBL"));
+        m.rgnFile = new RGNFile(m.fileSystem.create(mapnumber + ".RGN"));
+        m.treFile = new TREFile(m.fileSystem.create(mapnumber + ".TRE"), true);
+        m.lblFile = new LBLFile(m.fileSystem.create(mapnumber + ".LBL"));
 
         int mapid;
         try {
-            mapid = Integer.parseInt(mapname);
+            mapid = Integer.parseInt(mapnumber);
         } catch (NumberFormatException e) {
             mapid = 0;
         }


      



More information about the mkgmap-dev mailing list