logo separator

[mkgmap-dev] Small contribution

From David david.tlp at orange.fr on Fri Feb 13 12:51:46 GMT 2009

Hello,

As I am new here, I introduce myself.
I am the author of a Garmin map made with the well known cgpsmapper. I 
discovered OpenStreetMap few months earlier and I started to work with 
mkgmap. My goal is to produce my map with mkgmap. I am not yet ready 
because of these "problems" :

- mkgmap cannot compile one of my big polygons even if I slice it with 
mapedit.
- mkgmap produces bigger files than cgpsmapper.
- derspite data come from OSM, routing does not work with my maps in 
Mapsource (it is not a real problem, I cannot also do that with free 
cgpsmapper).
- mkgmap produces a different draw of the map when compiled with net and 
route options : roads name appear and cities name are not displayed in 
Mapsource.

For mkgmap routing revision 856 and later :

PolishMapDataSource.java (line 405):
I found a minor bug in polish format reader : the max resolution is 
wrong when X != 0 in 'DataX'

Here is the code that works for me work :

private void setResolution(MapElement elem, String name) {
        if (endLevel > 0){
      elem.setMinResolution(extractResolution(endLevel));
      //EMERALDISLAND
      elem.setMaxResolution(extractResolution(name));
        } else {
            int res = extractResolution(name);
            elem.setMinResolution(res);
            elem.setMaxResolution(res);
        }
    }

I also noticed with an old Mapsource version (6.11.x) that strings 
defined with map.addInfo() and map.addCopyright() in MapBuilder.java 
appear in a different order (menu help/about/product info). It might be 
a bug from Mapsource...

When you select a map in Mapsource, the column zone is fielded with 
"overview map". I activated the option --overview-name and also 
--product-info. Changes are done in these 2 files : TdbBuilder.java and 
TdbFile.java

TdbBuilder.java :

public class TdbBuilder implements Combiner {
    private static final Logger log = Logger.getLogger(TdbBuilder.class);

    private OverviewMap overviewSource;

    private TdbFile tdb;

    private int parent = 63240000;
    private String overviewMapname;
    //EMERALDISLAND
    private String overviewName;
    private int tdbVersion;

    /**
     * Initialise by saving all the information we require from the 
command line
     * args.
     *
     * @param args The command line arguments as they are at the end of 
the list.
     * In otherwords if the same argument appears more than once, then 
it will
     * have the value that was set last.
     */
    public void init(CommandArgs args) {
        overviewMapname = args.get("overview-mapname", "63240000");
        try {
            parent = Integer.parseInt(overviewMapname);
        } catch (NumberFormatException e) {
            log.debug("overview map name not an integer", overviewMapname);
        }

    //EMERALDISLAND
    overviewName = args.get("overview-name", "Overview map");

        int familyId = args.get("family-id", 0);
        int productId = args.get("product-id", 1);

        String seriesName = args.get("series-name", "OSM map");
        String familyName = args.get("family-name", "OSM map");
        //EMERALDISLAND
        short productVersion = (short)args.get("product-version", 100);

        if (args.exists("tdb-v4")) {
            tdbVersion = TdbFile.TDB_V407;
        } else {
            tdbVersion = TdbFile.TDB_V3;
        }

        tdb = new TdbFile(tdbVersion);
       //EMERALDISLAND
        tdb.setProductInfo(familyId, productId, productVersion, 
seriesName, familyName, overviewName);
    }

In private void addToTdb(FileInfo finfo) :
// add a space between mapdesc and first (
String desc = mapdesc + ' (' + mapname + ')';


TdbFile.java :

Add this private class data :
private String overviewName;

public void setProductInfo(int familyId, int productId,
            short productVersion, String seriesName, String familyName, 
String _overviewName)
    {
        headerBlock = new HeaderBlock(tdbVersion);
        headerBlock.setFamilyId((short) familyId);
        headerBlock.setProductId((short) productId);
        headerBlock.setProductVersion(productVersion);
        headerBlock.setSeriesName(seriesName);
        headerBlock.setFamilyName(familyName);
        //EMERALDISLAND
        overviewName = _overviewName;
    }

Finally, I noticed that Version.VERSION returns 'svn' in mapBuilder.java

As I was looking for why my contour lines and summits with altitude in 
meters in my file (polish format .mp) are displayed in meters divided by 
3.2808399 (a feet to meters conversion) - is there a setting to solve 
this ? - I found the function distance() where the earth is supposed to 
be a sphere which is a pretty good approximation. After a fast search, I 
found this interesting link for distance computation :
WGS84 distance :
http://www.movable-type.co.uk/scripts/latlong-vincenty.html
spherical distance :
http://www.movable-type.co.uk/scripts/latlong.html

In the case I want to contribute to the code (to correct bugs or 
activate functions for example), how can I do this ?

Thank you for your great work.

PS : there is also somewhere a string "OMS map" instead of "OSM map", I 
don't remember which file.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20090213/16915132/attachment.html 


More information about the mkgmap-dev mailing list