Hi Steve,

A new fs sounds good to me, would be great if you could do that,
I am always unsure where to call close(). 

Reg. FileCopier: 
I have to read the DEM file to make sure that it matches, I just 
think that it would be better to store a reference to the existing file
instead of copying it into memory. The code that writes the new img file
would somehow notice that the data is not in memory but on disk.
No idea if this would really improve anything, maybe the partial reading
of DEM already requires a full copy in memory.
I'll have a closer look at this now.

Gerd

________________________________________
Von: mkgmap-dev <[email protected]> im Auftrag von Steve 
Ratcliffe <[email protected]>
Gesendet: Sonntag, 28. Januar 2018 22:41
An: [email protected]
Betreff: Re: [mkgmap-dev] gmapi reader?


Hi Gerd

I would use a new implementation of FileSystem, named GmapFS
or similar, which would go in package .imgfmt.sys
Then add the trait FileSystem.openFS() which will return the
correct ImgFS or GmapFS.

Then your code would be roughly:

        fs = FileSystem.openFS(demReuseDir); // Will return ImgFS or GmapFS
        chan = fs.open(demFilename, "r")

        // read DEM header to check if it can be used.

To copy without having to read it into memory, you can use
FileCopier.

I could implement GmapFS as I was already thinking of doing that so
that we would be able to convert gmapi format to gmapsupp.

Steve

> Hi Steve, I hope you can help me out here.
>
> I've implemented a new option --x-dem-reuse which allows to copy the DEM file
> from an older map.
> My idea is that the option specifies the path to either
> 1) a gmapsupp or
> 2) a gmap folder  or
> 3) a directory containing *.img files
> from a previous run with similar dem-dist option and tile boundaries.
>
> If given, mkgmap tries to find the matching *.DEM in any of these formats,
> checks if the content matches the wanted boundary and dem-dist option and - 
> if ok -
> uses the existing file instead of doing the DEM calculations again.
>
> At the moment I have some working quick+dirty code (see attached patch).
> I assume the new code in MapBuilder should go somewhere in package 
> uk.me.parabola.imgfmt.app,
> maybe a new class ImgFinder or so? Or do we already have such code in mkgmap?
> What I also don't like is that it copies the data from the existing file into 
> memory.
> Is there already an easy way to avoid that?
>
> Gerd
>
>
>
>
>
>
>
>
> _______________________________________________
> mkgmap-dev mailing list
> [email protected]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>

_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to