Log in

View Full Version : Custom Maps for Maemo Mapper


slamp
2007-09-05, 00:39
Been using MMapper since January, what a great program, I have noticed in several treads, folks wonder how to get a custom map into MMapper, here is what worked for me.

Start with MapCruncher from MS

http://research.microsoft.com/mapcruncher/

Tutorial at:
http://research.microsoft.com/mapcruncher/tutorial/version3.0docs/index.htm#_Toc148418544

Started by scanning some high quality Topo maps that include hiking trails that are highlighted on the map. Tried several levels; the 600 DPI seems to work best.

Once you have your map source file, you can open it in MapCruncher, check the borders, and create the GPS Correspondences. The program will render the Individual map tiles for the map. MS level 14 = MM level 3 for zoom (worked well for my maps). I also set the max zoom to 14 for the maps in Cruncher (limits the number of output tiles). See tutorial for getting the correspondences more accurate as you may need to add numerous points and adjust them based on the points 'Error'. The best points seem to be North - South Street intersections.

When MapCruncher renders the tiles, it will create a large number of .png files in a directory. The naming convention for these tiles is as follows: the number of characters in the file name indicates zoom level. So if the file is named 0012.png it means that it is zoom level 4. MS VE coded these tiles so they only contain 0 thru 3 as valid characters in the file name. These represent grid that is overlays the tile, so a picture of the world would have North America in quadrant 0 Europe in Quad 1 South America in Quad 2 and India in Quad 3. In this way one can read the name of the file one character a a time that indicates the quadrant that one is to zoom to for that zoom level. In our earlier example '0021.png' would read 0 first quadrant (North America) then each successive zoom to the quadrant of the tile that is zoomed too, read the next number and zoom to that quadrant. In my case I took all of the files that were 14 characters long and copied them to another directory.
At this point I also batch renamed all of the files to a jpg extension.
As I do not have a program to 'rename' the file name itself, only the files extension. Each has to be renamed, started by creating a VE repository on my N800 that roughly contained the area of the map from an X - Y area that the map covered. I then moving the directory over to the computer opened the MS VE Streets directory and the MapCruncher files in another view. I then identified the tiles that represent the same place on the map. Using this I renamed the MS Cruncher files to the MMapper format. To keep these clear I appended a -# to the end of the file to help keep them straight. For example one of the files 03023221300332.png is re-named 6055-2.jpg in the MapCruncher directory. Once I was done renaming all of the files for the map I would then copy a 'set' 6054-2.jpg, 6055-2.jpg, 6056-2.jpg, 6057-2.jpg into the 4710 'Y' directory of MMapper. Once the files are copied they are renamed to loose the -2 part of the name as MMapper would not reconize it. Once you have the files renamed to this format you can simply view the thumbnails by name, without this you may need to view by 'creation date' or 'modified' in order to keep them straight order-wise.

I have found that the maps I have processed have the actual trail within a meter or so to the actual GPS Track in MMapper. MMapper is ok with the files being .png files that are renamed .jpg.
It takes about an hour to scan in the map, crunch it, and rename the tiles. I would be great to have a script to read the 03023221300332.png name and place it into a directory name 4710 with a file name of 6054.jpg. Cruncher allows for transparency’s of layers of maps. I have also taken some historic maps of the area and crunched them with success. Odd display artifacts are visible when the tile is not complete, MMapper trys to 'fill' in the space by duplicating part of the tile itself (best not to use partial tiles -- looks cleaner in MMapper).
Happy Mapping, ps the tutorial for MapCruncher is good, MMapper is great....

sping
2007-09-05, 13:52
Very cool - thanks for the info - I have a hiking map in mind I'd really like to scan. I'll be playing with this once I get the time, and may be able to make a rename script, as renaming by hand offends my sensibilities ;).

Question - are the zoom levels 1:1 - if 14 is equivalent to MM 3, is 13 (or 15) 2? I'd want to go down to 1 or 2.

slamp
2007-09-06, 01:17
No the zoom levels appear to vary, I 'found' the cross reference to MM zoom level 3 = MS Cruncher level 14. I am certain that other zoom levels can be cross matched as well. MMapper allows a zoom to level 0,1, and 2 even though I only have level 3 for the custom map. This zoom works similar to the double pixels setting, zooming in on the scanned image. Higher levels do not work this way and MMapper only displays the black screen at these zooms. The zoom level will likely vary depending on the size of the scanned image.

PieZZo
2007-09-06, 15:26
Is it possible to get somekind of script what renames files automaticly?

MarkW
2007-11-30, 12:40
Been using MMapper since January, what a great program, I have noticed in several treads, folks wonder how to get a custom map into MMapper, here is what worked for me.

Thanks, that was very helpful in getting me started. I'm too lazy, though, to do that manual renaming, so I figured out a simple way to create a map repository using the Map Cruncher output. I'm interested in getting nautical charts into Maemo mapper, and here's what I did:

When you've run Mapcruncher, you're left with tile files in the same format/naming convention that Virtual Earth uses internally. So what's left to do is roll your own Virtual Earth style map repository, which can be done simply by dumping the tile files into a directory of a handy web server and creating a repository in Maemo Mapper. I have a web server running locally on a computer on my home network with an address of 192.168.0.9, and the tiles are in a web server directory called tiles, so the url looks like:

http://192.168.0.9/tiles

and the Maemo mapper repository url looks like:

http://192.158.0.9/tiles/%0s.png

Then I used the maemo mapper auto downloading to pull in the chart. Using another repository, I navigated to the chart area, then switched to my chart repository and scrolled around to bring in the chart.

slamp
2007-11-30, 23:16
You may have answered my only concern of moving on to v2.x of this great program, as new version did not appear to have a way to import custom map data, now that the maps are stored in the database.

What was missing was a method of putting these custom maps in into the new database structure. Renaming the tiles is a pain. I have some maps from 1895 of my home town that I need to try this with.

Thank you this appears to be the missing part of the puzzle.

technut
2007-11-30, 23:51
Under Maps / Manage Maps there is the ability to force the download of the map tiles by specifying an area.

slamp
2007-12-01, 17:03
Putting the results of the Map Cruncher into a web directory works like a charm. Thanks

Nait
2008-06-25, 05:40
You may have answered my only concern of moving on to v2.x of this great program, as new version did not appear to have a way to import custom map data, now that the maps are stored in the database.

What was missing was a method of putting these custom maps in into the new database structure. Renaming the tiles is a pain. I have some maps from 1895 of my home town that I need to try this with.

Thank you this appears to be the missing part of the puzzle.

I used a program map2gdbm to convert tiles form MM1 format into MM2 (*.db file) and vbs script to convert MCruncher's files to MM1.
http://www.internettablettalk.com/forums/showthread.php?t=14925&page=2

I modified Nuri's (http://n8xx.com/subject-245-3.html) script, he used it for moving cache data from GoogleMV to MM1 format.

Move_Cruncher_Cache.vbs

Const OverwriteExisting = FALSE
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objBaseFolder = objFSO.GetFolder("C:\misc\GPS\CRUN12_ORIG")
Set colSubfolders = objBaseFolder.Subfolders

Dim strFilename, strLetter, varLength, strNewFileName, strNewFolderName
Dim i, x, y, z, q
'Wscript.Echo "Start"
q = 0
For Each objSubfolder in colSubfolders
'Wscript.Echo "Start 1"
Set colFiles = objSubFolder.files

For Each objFile in colFiles

x = 0
y = 0
z = 17

strFilename = objFile.Name

varLength = Len(strFilename) - 4

'Wscript.Echo "Length " & varLength

If varLength < 19 Then

For i = 1 To varLength

strLetter = Mid(strFilename,i,1)

'Wscript.Echo "Letter " & strLetter

Select Case strLetter
Case "0"
x = x * 2
y = y * 2
z = z - 1
Case "1"
x = x * 2 + 1
y = y * 2
z = z - 1
Case "2"
x = x * 2
y = y * 2 + 1
z = z - 1
Case "3"
x = x * 2 + 1
y = y * 2 + 1
z = z - 1
End Select
'Wscript.Echo "X for " & strLetter & " = " & x
'Wscript.Echo "Y for " & strLetter & " = " & y
'Wscript.Echo "Zoom " & z

Next

'Wscript.Echo "Zoom end " & z
'Wscript.Echo "X Dir " & x

strNewFolderName = "C:\misc\GPS\MM_F_CRUN\" & z
If Not objFSO.FolderExists(strNewFolderName) Then
objFSO.CreateFolder(strNewFolderName)
End If

strNewFolderName = "C:\misc\GPS\MM_F_CRUN\" & z & "\" & x
'Wscript.Echo strNewFolderName
If Not objFSO.FolderExists(strNewFolderName) Then
objFSO.CreateFolder(strNewFolderName)
End If

strNewFileName = strNewFolderName & "\" & y & ".jpg"

Set objOldFile = objFSO.GetFile(objSubfolder.Path & "\" & strFileName)

If Not objFSO.FileExists(strNewFileName) Then
objOldFile.Copy strNewFileName, OverwriteExisting
q = q + 1
End If

'Wscript.Echo strFilename & " x=" & x & " y=" & y & " z=" & z
'Wscript.Echo strNewFileName
'Wscript.Echo objBaseFolder & "\" & strFileName

End If

Next
Next
Wscript.Echo q & " Tiles copied"

Nait
2008-06-25, 09:03
C:\misc\GPS\CRUN12_ORIG - input dir, where you have only 1 other dir with MMaper files,

C:\misc\GPS\MM_F_CRUN\ - output dir where vbs-script will collect files (in dir-levels) im MM1 format.
Draw attention that Move_Cruncher_Cache.vbs has now 2 output entries for dir C:\misc\GPS\MM_F_CRUN\ .

Next step - loading MM1 to MM2.
It's quite enough to rename PNG file to JPG, but you should to
recompile map2gdbm, consider my remarks:

http://www.internettablettalk.com/forums/showthread.php?t=14925&page=2

Other way - you can use free IrfanView program to convert PNG files to JPG (or gif - better).
IrfanView has "Batch conversion/rename" mode for easy converting a lot of files in any format.
Select 90% or 80% of quality for better compress files.
If you will use unchanged version of map2gdbm, files (tiles) should be less than 64k.

davstockholm
2010-07-14, 20:54
so I figured out a simple way to create a map repository using the Map Cruncher output. I'm interested in getting nautical charts into Maemo mapper, and here's what I did:

When you've run Mapcruncher, you're left with tile files in the same format/naming convention that Virtual Earth uses internally. So what's left to do is roll your own Virtual Earth style map repository, which can be done simply by dumping the tile files into a directory of a handy web server and creating a repository in Maemo Mapper. I have a web server running locally on a computer on my home network with an address of 192.168.0.9, and the tiles are in a web server directory called tiles, so the url looks like:

http://192.168.0.9/tiles

and the Maemo mapper repository url looks like:

http://192.158.0.9/tiles/%0s.png

Then I used the maemo mapper auto downloading to pull in the chart. Using another repository, I navigated to the chart area, then switched to my chart repository and scrolled around to bring in the chart.

Hi,

I tried the method above but it did not work. Perhaps the latest Maemo Mapper version changed way of handling Virtual Earth repositories?

This is what I did. I rendered the tiles of a scanned TOPO map using MapCruncher and it worked fine. Mapcruncher builds a demo HTML together with the tiles to show that they can be read. Everything was successful.

Then I applied your procedure, setting up a webserver, creating a new repository in Maemo Mapper as described. It does not work, white screen on the related map location.

Does this procedure still works in the latest Maemo Mapper?

Thank you in advance!

mardy
2010-07-15, 05:05
It should still work in Mappero, but you need to be careful when configuring the tile source: you must set the "type" field to QUAD_ZERO.
Let me know how it goes. Is your web server public?

davstockholm
2010-07-15, 18:07
It works! It was just a problem with folder names. The tiles profile in Mappero is exactly like the Virtual Earth one.

The URL looks like:
http://192.168.2.100/Layer_NewLayer/%0s.png

This is a good method to include raster maps in mappero! MapCruncher makes the calibration very easy. Give it a try!

Cheers,
Davide