Active Topics

 



Notices


Reply
Thread Tools
Posts: 40 | Thanked: 18 times | Joined on May 2008
#1
Some time ago I've posted a note about creating some custom maps for maemo-mapper from BSB nautical charts: http://talk.maemo.org/showthread.php...&highlight=bsb.

I've made a bit of development since then. A new set of scripts are written in Python, so they can be used with Windows as well. The scripts requirements are: the Python (tested with v. 2.5.2 and 2.6.6) with the Python imaging library, the GDAL tool set (tested with v. 1.6.3 and 1.7.2), optionally numpy package and pngnq tool

Here is how it's all implemented:
1) bsb2gdal.py or ozi2gdal.py -- creates geo-referenced GDAL .vrt file, optionally cropping the raster;
2) gdal4tiles.py -- creates a tile set tree directory for every chart using gdal2tiles.py from GDAL; (gdal2tiles.py also creates a couple html files, so the result can be checked with a browser).
3) tiles-merge.py -- sequentially merges a few tile sets in a single one to cover the area required;
4) tiles-opt.py -- compresses png tiles into a palleted form using pngnq tool;
5) tiles2mapper.py -- creates a sqlite3 file from a tile set tree. This file you then just copy into a maemo-mapper maps directory. You'd also need to create a reference to this file at the maemo-mapper repository settings.

For options list use "--help"

There is also kml2gdal.py script which helps geo-referencing any png or jpeg raster using Google Earth: you import a raster into the Google Earth stretch it accordingly, export it as kml file, then kml2gdal.py creates a GDAL .vrt from it.

For poi2mapper.py functionality see http://talk.maemo.org/showthread.php?p=810365

Below are the latest version of the scripts

UPDATE!

Please ignore these files. A new version of these scripts are available from here: http://code.google.com/p/tilers-tools
Attached Files
File Type: gz bsb2tiles.tar.gz (16.5 KB, 270 views)
File Type: txt bsb2gdal.py.txt (13.3 KB, 333 views)
File Type: txt ozi2gdal.py.txt (12.1 KB, 400 views)

Last edited by vadp; 2011-05-17 at 11:54. Reason: scripts location updated
 

The Following 7 Users Say Thank You to vadp For This Useful Post:
Posts: 14 | Thanked: 21 times | Joined on Nov 2009 @ Moscow
#2
Thank you very much for the converter. Here is tiles2mappero.py script (made from your tiles2mapper.py) which can be used to produce folders suitable for mappero (former maemo-mapper). Mappero's repository/tiles settings dialogs seem to be very buggy, so this far I've failed to add new repository to it, but at least I've succeeded in replacing cached files in existing subdirectories of $HOME/MyDocs/.maps.
Attached Files
File Type: gz tiles2mappero.py.gz (1.8 KB, 186 views)
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#3
Cheers fionbio! Have you tried tiles-merge.py --gtiles. At the 1st glance it looks like it does what you needed, doesn't it?

Actually it's possible just feed these directories a http server (I tried boa), to download them into some other mapping application which is able to fetch google tiles.

BTW I understand there are a couple of ports of the original the maemo-mapper for n900: https://garage.maemo.org/frs/shownot...elease_id=3406 and http://shmuma.livejournal.com/24660.html

Last edited by vadp; 2010-07-04 at 07:30.
 
Posts: 4 | Thanked: 0 times | Joined on Feb 2010
#4
hi vadp,

this is output when i try to convert map with ozi ogf2 and tiff in folder.Filenames in .map file are the same as in folder.Any suggestion where to look for error.
Thank you,
Thomas


./ozi2gdal.py LJ_center_ortofoto.map
Traceback (most recent call last):
File "./ozi2gdal.py", line 234, in <module>
map2vrt(f)
File "./ozi2gdal.py", line 191, in map2vrt
gdalinfo=command(['gdalinfo',img_file])
File "./ozi2gdal.py", line 102, in command
process=Popen(params,stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#5
Originally Posted by tomaz View Post
Any suggestion where to look for error.
Hi Tomas. Can you run it with -d switch? BTW do you have gdal binaries installed and they are in the PATH?

Last edited by vadp; 2010-08-26 at 07:40.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#6
A newer version of kml2gdal.py was added to the 1st post. It has a better datum definition for the Google Earth.
 
Posts: 4 | Thanked: 0 times | Joined on Feb 2010
#7
Originally Posted by vadp View Post
Hi Tomas. Can you run it with -d switch? BTW do you have gdal binaries installed and they are in the PATH?
yes , i try but same , gdal binaries are installed .

output is here:

../ozi2gdal.py -d 116-ljubljana.map
DEBUG:root:[['OziExplorer Map Data File Version 2.2'], ['116-LJUBLJANA'], ['116-LJUBLJANA.jpg'], ['1', 'Map Code', ''], ['SLOVENIJA', 'WGS 84', '0.0000', '0.0000', 'WGS 84'], ['Reserved 1'], ['Reserved 2'], ['Magnetic Variation', '', '', 'E'], ['Map Projection', 'Transverse Mercator', 'PolyCal', 'No', 'AutoCalOnly', 'No', 'BSBUseWPX', 'No'], ['Point01', 'xy', '0', '0', 'in', 'deg', '46', '7.4997', 'N', '14', '29.9322', 'E', 'grid', '', '', '', ''], ['Point02', 'xy', '4606', '6589', 'in', 'deg', '45', '59.9989', 'N', '14', '37.5532', 'E', 'grid', '', '', '', ''], ['Point03', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point04', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point05', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point06', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point07', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point08', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point09', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point10', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point11', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point12', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point13', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point14', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point15', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point16', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point17', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point18', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point19', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point20', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point21', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point22', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point23', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point24', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point25', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point26', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point27', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point28', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point29', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Point30', 'xy', '', '', 'in', 'deg', '', '', '', '', '', '', 'grid', '', '', '', ''], ['Projection Setup', '0.000000000', '15.000000000', '0.999900000', '500000.00', '-5000000.00', '34.000000000', '40.500000000', '', '', ''], ['Map Feature = MF ; Map Comment = MC These follow if they exist'], ['Track File = TF These follow if they exist'], ['Moving Map Parameters = MM? These follow if they exist'], ['MM0', 'Yes'], ['MMPNUM', '4'], ['MMPXY', '1', '0', '0'], ['MMPXY', '2', '4606', '0'], ['MMPXY', '3', '4606', '6589'], ['MMPXY', '4', '0', '6589'], ['MMPLL', '1', '14.498870', '46.124995'], ['MMPLL', '2', '14.625038', '46.125478'], ['MMPLL', '3', '14.625887', '45.999982'], ['MMPLL', '4', '14.500004', '45.999500'], ['MM1B', '2.116049'], ['MOP', 'Map Open Position', '0', '0'], ['IWH', 'Map Image Width/Height', '4606', '6589']]
DEBUG:root:116-ljubljana.jpg
DEBUG:root:['+proj=tmerc', '+lat_0=0.000000000', '+lon_0=15.000000000', '+k=0.999900000', '+x_0=500000.00', '+y_0=-5000000.00', '+lat_1=34.000000000', '+lat_2=40.500000000', '+datum=WGS84', '+no_defs']
DEBUG:rootroj +proj=tmerc +lat_0=0.000000000 +lon_0=15.000000000 +k=0.999900000 +x_0=500000.00 +y_0=-5000000.00 +lat_1=34.000000000 +lat_2=40.500000000 +datum=WGS84 +no_defs
DEBUG:root:[[['Point01', 'xy', '0', '0', 'in', 'deg', '46', '7.4997', 'N', '14', '29.9322', 'E', 'grid', '', '', '', ''], ['Point02', 'xy', '4606', '6589', 'in', 'deg', '45', '59.9989', 'N', '14', '37.5532', 'E', 'grid', '', '', '', ''], ['', '', '0', '6589']], [['461272.21', '109590.53'], ['471022.84', '95642.33'], ['461272.21', '95642.33']]]
Traceback (most recent call last):
File "../ozi2gdal.py", line 235, in <module>
map2vrt(f)
File "../ozi2gdal.py", line 189, in map2vrt
gcps=flatten([('-gcp', i[0][2],i[0][3],i[1][0],i[1][1]) for i in zip(refs, ref_coord)])
File "../ozi2gdal.py", line 110, in flatten
return list(itertools.chain.from_iterable(listOfLists))
AttributeError: type object 'itertools.chain' has no attribute 'from_iterable'
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#8
Hi Tomas, it looks like you need a more recent version of python for this: 2.6 or above.

update: I've made another version of the script, so see if it's any better for you (remove .txt from it's name)
Attached Files
File Type: txt ozi2gdal.py.txt (11.9 KB, 282 views)

Last edited by vadp; 2010-09-15 at 07:30.
 
Posts: 4 | Thanked: 0 times | Joined on Sep 2010
#9
Hello!
I have jpg maps with .ogf2 and .map.
At first I use ozi2gdal.py to get GDAL .vrt. After that tiles-from-gdal.py to get tiles tree with some zoom levels and html's with overlay. If I check the result in browser - it ideally fits google-map or openstreetmap.
What I can't figure out is right url format for maemo-mapper, I use:
http://myserver/maps/%0d/%d/%d.png like on openstreetmap, but in server's logs I see it tries to get other tile numers I have in tree. Zoom levels are ok, but x and y differs...
For example: my generated tree contains 8/145/177 and it's identical to oss 8/145/78 and google's x=145&y=78&z=8

Last edited by ksb; 2010-09-26 at 11:42.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#10
Originally Posted by ksb View Post
Zoom levels are ok, but x and y differs...
For example: my generated tree contains 8/145/177 and it's identical to oss 8/145/78 and google's x=145&y=78&z=8
Hi ksb! I think you can try tiles-merge.py with "--gtiles" option

Last edited by vadp; 2010-09-26 at 13:12.
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:26.