Notices


Reply
Thread Tools
Posts: 40 | Thanked: 18 times | Joined on May 2008
#31
At my PM janszoon is asking me for some detailed instructions. I understand quite a number of people still do not use Linux these days but there is a way of doing the thing on Windows.

A guy at a Russian forum asked me for giving him instruction in Russian, so I've posted them here http://n8xx.com/post54305.html#p54305. Unfortunately I'm quite busy at the moment to prepare an English version of these. As soon as I have a bit more time I'll come back to this.

Meanwhile, perhaps Google Translate might help (although the translation is pretty much terrible):
http://translate.google.com/translat...post54305.html
 

The Following User Says Thank You to vadp For This Useful Post:
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#32
Thanks mate. I may have to wait for you to get round to the English version as my russian is very bad, and my linux is even worse, my python is literally non exisitant.

I may be biting off more than I can chew trying to get NZ Nautical maps into Mappero, but I will try to follow the steps. Perhaps even write a noobs guide to doing. And by Noob, I mean.... What do i even do with the script, how do I access it, how do I tell it where to look and what to do etc...

Soo...Please excuse my ignorance

I'm at step one:
I have installed/extracted the programs/7zips as suggested. I have a folder full of my .kap files ready to be processed. Can I point the script to a folder, or do I need to convert each chart individually?

At the CMD I access the script with the following:
Code:
cd C:\<location>\bsb2tiles
C:\<location>\bsb2tiles>python bsb2gdal.py c:\<source directory> -c -t C:\<destination directory>
Can you please help me with the correct syntax? I would like to remove the border as suggested too.

Cheers.
(please tell me I'm not the only one who finds this daunting )
__________________
My N900 Photo Gallery and Slideshow

Last edited by janszoon; 2010-11-03 at 09:02.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#33
Originally Posted by janszoon View Post
At the CMD I access the script with the following:
Code:
cd C:\<files location>\bsb2tiles
C:\<location of files>\bsb2tiles>python bsb2gdal.py c:\<source directory> -c -t C:\<destination directory>
Did you edit bsb2tiles.bat, so the lines there look like this?
set PYTHON=<python location>
set GDAL=<gdal location>

If so, you can check if it works
Code:
cd /d <drive>:\<source directory>
bsb2gdal.py
The script will start, but then complain of the lack of parameters. This is fine.

Then you just type (do not hit Enter):
Code:
bsb2gdal.py --cut
Then drag a .KAP file here from the Explorer's file list window, then hit Enter. You should get .vrt file.
Then (you can drag as well):
Code:
gdal2tiles.py <vrt file>
You'll get a folder with tile pyramid (so-called TMS-format). Watch for googlemaps.html there, you can fire it with a Firefox or IE.
Then:
Code:
tiles-merge.py --gtiles <pyramid folder>
You'll get gtiles subfolder inside the pyramid. That's what you need for the mappero (as people say

Last edited by vadp; 2010-11-03 at 09:39.
 

The Following User Says Thank You to vadp For This Useful Post:
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#34
Ok baby steps...this is probalby more a lesson in Linux than mapping but I appreciate the time / help:

Originally Posted by vadp View Post
Did you edit bsb2tiles.bat, so the lines there look like this?
set PYTHON=<python location>
set GDAL=<gdal location>
How do I get from your bsb2tiles.tar.gz file (attached to original thread) to .bat ?
__________________
My N900 Photo Gallery and Slideshow
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#35
Originally Posted by janszoon View Post
How do I get from your bsb2tiles.tar.gz file (attached to original thread) to .bat ?
bsb2tiles.bat file attached to the Russian instructions referenced above. You would also need gdal2tiles.py from there
 
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#36
Hi Vadp.

Some progress, I got the batch file running etc and get to the step below:

I run the batch file and get a CMD window with:

Setting environment for using the GDAL and MapServer tools.
Hiding the OCI plugin library.
C:\Maps\bsb2tiles>


If so, you can check if it works
Code:
cd /d <drive>:\<source directory>
bsb2gdal.py
cd /d c:\Maps\NewZealand

C:\Maps\NewZealand>bsb2gdal.py
Usage: bsb2gdal.py [--cut] [--dest-dir=DEST_DIR] KAP_file...

bsb2gdal.py: error: No input file(s) specified

C:\Maps\NewZealand>

Yes this works


Then you just type (do not hit Enter):
Code:
bsb2gdal.py --cut
Then drag a .KAP file here from the Explorer's file list window, then hit Enter. You should get .vrt file.
Yes I type the above then I drag the file in (add debug) and hit enter as stated but I get the following error:


Code:
C:\Maps\NewZealand>bsb2gdal.py -d --cut C:\Maps\NewZealand\NZ21.kap
DEBUG:root:{'broken_raster': None, 'cut': True, 'get_cutline': None, 'dtm': None
, 'use_dtm': None, 'bsb_proj': None, 'debug': True, 'datum': None, 'quiet': None
, 'blend_dist': None, 'last_column_bug': None, 'long_names': None, 'dest_dir': '
', 'bsb_datum': None, 'srs': None, 'proj': None}
DEBUG:root:['! Created by mc2bsbh beta09 - Use at your own risk!', '! MD5SUM 4a4
515550f69362eb58e8b080c10acdf', '! GETMAP http://charts.linz.govt.nz/tifs/nz21.t
if', '! WARNING! Not to be used for navigation.', '! MAPCPR Sourced from Land In
formation New Zealand data. Crown Copyright Reserved.', '! CALCPR Calibration by
 Marco Certelli. Free for PERSONAL (non-commercial) use only.', 'VER/2.0', 'BSB/
NA=Norfolk Island to Cape Egmont,NU=NZ21(INT641),RA=8504,12992,DU=309', 'KNP/SC=
1500000,GD=WGS84,PR=MERCATOR,PP=-23,PI=UNKNOWN,SP=UNKNOWN,SK=0.0,TA=90.0,UN=METE
RS,SD=LOWEST ASTRONOMICAL TIDE,DX=123.46,DY=123.46', 'CED/SE=2005,RE=199,ED=10/3
0/2009', 'OST/1', 'REF/1,8032,1213,-28,177', 'REF/2,8033,10816,-38,177', 'REF/3,
768,10816,-38,168', 'REF/4,767,12293,-39.4333333,168', 'REF/5,768,8802,-36,168',
 'REF/6,767,6840,-34,168', 'REF/7,768,4924,-32,168', 'REF/8,767,3050,-30,168', '
REF/9,472,2127,-29,167.633333', 'REF/10,471,1214,-28,167.633333', 'REF/11,471,70
0,-27.4333333,167.633333', 'REF/12,8033,699,-27.4333333,177', 'REF/13,8032,2127,
-29,177', 'REF/14,8033,3049,-30,177', 'REF/15,8033,3982,-31,177', 'REF/16,8033,4
924,-32,177', 'REF/17,8033,5877,-33,177', 'REF/18,8034,6841,-34,177', 'REF/19,80
33,7815,-35,177', 'REF/20,8033,8802,-36,177', 'REF/21,8033,9802,-37,177', 'REF/2
2,8033,11844,-39,177', 'REF/23,8033,12292,-39.4333333,177', 'REF/24,471,11843,-3
9,167.633333', 'REF/25,471,9802,-37,167.633333', 'REF/26,472,7815,-35,167.633333
', 'REF/27,472,5877,-33,167.633333', 'REF/28,471,3983,-31,167.633333', 'REF/29,3
997,699,-27.4333333,172', 'REF/30,3996,1213,-28,172', 'REF/31,3996,3050,-30,172'
, 'REF/32,3996,4924,-32,172', 'REF/33,3996,6840,-34,172', 'REF/34,3996,8803,-36,
172', 'REF/35,3996,10816,-38,172', 'REF/36,3996,12293,-39.4333333,172', 'CPH/0.0
', 'PLY/1,-27.4329697,168.508336', 'PLY/2,-28.562655,168.508384', 'PLY/3,-28.558
2023,167.633597', 'PLY/4,-39.4339571,167.633333', 'PLY/5,-39.4333334,174.566667'
, 'PLY/6,-39.0000001,174.566667', 'PLY/7,-39,174.966667', 'PLY/8,-38.1833335,174
.966667', 'PLY/9,-38.1833333,177', 'PLY/10,-27.4333333,177', 'DTM/0,0', 'IFM/4',
 'RGB/1,255,255,255', 'RGB/2,10,10,10', 'RGB/3,200,0,255', 'RGB/4,241,185,255',
'RGB/5,60,190,217', 'RGB/6,197,235,244', 'RGB/7,98,171,116', 'RGB/8,246,200,110'
]
INFO:root: C:\Maps\NewZealand\NZ21.kap - Norfolk Island to Cape Egmont
DEBUG:root:gdaltransform -tps -i -t_srs +proj=longlat C:\Maps\NewZealand\NZ21.ka
p
DEBUG:root:('1177.48132351963 698.165854778137 0\n1177.7057324942 1727.257272287
99 0\n471.831471934524 1722.51303476368 0\n470.751540657892 12290.2286919792 0\n
6068.08746619724 12285.7027812577 0\n6068.08511972069 11841.0032599708 0\n6391.0
7235584312 11840.9187311518 0\n6391.06362576488 11003.6105320604 0\n8033.0002443
801 11003.6205704853 0\n8033.00000052232 698.999726849576 0\n', 'ERROR 6: Unable
 to load PROJ.4 library (proj.dll), creation of\nOGRCoordinateTransformation fai
led.\n')
DEBUG:root:[(1, 8032, 1213, -28, 177), (2, 8033, 10816, -38, 177), (3, 768, 1081
6, -38, 168), (4, 767, 12293, -39.433333300000001, 168), (5, 768, 8802, -36, 168
), (6, 767, 6840, -34, 168), (7, 768, 4924, -32, 168), (8, 767, 3050, -30, 168),
 (9, 472, 2127, -29, 167.63333299999999), (10, 471, 1214, -28, 167.6333329999999
9), (11, 471, 700, -27.433333300000001, 167.63333299999999), (12, 8033, 699, -27
.433333300000001, 177), (13, 8032, 2127, -29, 177), (14, 8033, 3049, -30, 177),
(15, 8033, 3982, -31, 177), (16, 8033, 4924, -32, 177), (17, 8033, 5877, -33, 17
7), (18, 8034, 6841, -34, 177), (19, 8033, 7815, -35, 177), (20, 8033, 8802, -36
, 177), (21, 8033, 9802, -37, 177), (22, 8033, 11844, -39, 177), (23, 8033, 1229
2, -39.433333300000001, 177), (24, 471, 11843, -39, 167.63333299999999), (25, 47
1, 9802, -37, 167.63333299999999), (26, 472, 7815, -35, 167.63333299999999), (27
, 472, 5877, -33, 167.63333299999999), (28, 471, 3983, -31, 167.63333299999999),
 (29, 3997, 699, -27.433333300000001, 172), (30, 3996, 1213, -28, 172), (31, 399
6, 3050, -30, 172), (32, 3996, 4924, -32, 172), (33, 3996, 6840, -34, 172), (34,
 3996, 8803, -36, 172), (35, 3996, 10816, -38, 172), (36, 3996, 12293, -39.43333
3300000001, 172)]
DEBUG:root:{'PR': 'MERCATOR', 'PP': '-23', 'SP': 'UNKNOWN', 'SD': 'LOWEST ASTRON
OMICAL TIDE', 'SK': '0.0', 'GD': 'WGS84', 'DY': '123.46', 'DX': '123.46', 'UN':
'METERS', 'SC': '1500000', 'PI': 'UNKNOWN', 'TA': '90.0'}
INFO:root:      WGS84, MERCATOR
DEBUG:root:(0, 0)
DEBUG:root:+proj=merc +lat_ts=-23 +datum=WGS84 +nodefs
DEBUG:root:proj +proj=merc +lat_ts=-23 +datum=WGS84 +nodefs
Traceback (most recent call last):
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 321, in <module>
    kap2vrt(f)
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 239, in kap2vrt
    command(['proj'] + out_srs.split(), latlong).splitlines()]
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 88, in command
    process=Popen(params,stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newline
s=True)
  File "C:\Python26\lib\subprocess.py", line 623, in __init__
    errread, errwrite)
  File "C:\Python26\lib\subprocess.py", line 833, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Am I missing a file or similar?

Cheers.
__________________
My N900 Photo Gallery and Slideshow

Last edited by janszoon; 2010-11-05 at 08:45.
 
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#37
I have also tried a newer version of Gdal form the russian thread. (1.7) and now I get the attached pop up error, at the same place in the process.
Attached Images
 
__________________
My N900 Photo Gallery and Slideshow
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#38
Originally Posted by janszoon View Post
Code:
 'ERROR 6: Unable  to load PROJ.4 library (proj.dll), creation of\nOGRCoordinateTransformation fai
led.\n')
...
DEBUG:root:proj +proj=merc +lat_ts=-23 +datum=WGS84 +nodefs
...
WindowsError: [Error 2] The system cannot find the file specified
It seem the environment wasn't set properly.

Can you call 'proj' from a command prompt?

Also check the location of proj.dll. Then check the PATH environment variable( 'echo %PATH%' or even just 'set'). The location of proj and proj.dll must be among the folders listed at PATH.
 
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#39
you mean under my computer>>advanced>> environmental variables>>Path ?
__________________
My N900 Photo Gallery and Slideshow
 
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#40
Popup like above and then this...

Code:
Setting environment for using the GDAL and MapServer tools.
Hiding the OCI plugin library.
C:\Maps\bsb2tiles>cd /d c:\Maps\NewZealand

C:\Maps\NewZealand>bsb2gdal.py --cut -d C:\Maps\NewZealand\NZ2325_2.kap
INFO:root:C:\Maps\NewZealand\NZ2325_2.kap
DEBUG:root:['! Created by mc2bsbh beta09 - Use at your own risk!', '! GETMAP htt
p://charts.linz.govt.nz/tifs/nz2325.tif', '! MD5SUM 1f0bcf293b76f65fcbbe322fe472
f586', '! IMGMOD nz2325.tif 0 3900 4201 1432 1914', '! MAPCPR Sourced from Land
Information New Zealand data. Crown Copyright Reserved.', '! CALCPR Calibration
by Marco Certelli. Free for PERSONAL (non-commercial) use only.', '! WARNING! No
t to be used for navigation.', 'VER/2.0', 'BSB/NA=Lake Taupo (Taupomoana) - Boat
 Harbour Kawakawa Point,NU=NZ2325_2,RA=1432,1914,DU=302', 'KNP/SC=5000,GD=WGS84,
PR=TRANSVERSE MERCATOR,PP=175.821,PI=UNKNOWN,SP=UNKNOWN,SK=0.0,TA=90.0,UN=METERS
,SD=Minimum Lake Operating Level (355.85m amls),DX=0.42,DY=0.42', 'CED/SE=2006,R
E=70,ED=3/30/2007', 'OST/1', 'REF/1,82,1833,-38.6833333,175.816667', 'REF/2,1349
,1832,-38.6833333,175.822833', 'REF/3,1349,84,-38.6766667,175.822833', 'REF/4,82
,84,-38.6766667,175.816667', 'CPH/0.0', 'PLY/1,-38.6766667,175.816667', 'PLY/2,-
38.6830333,175.816667', 'PLY/3,-38.6830333,175.822833', 'PLY/4,-38.6766667,175.8
22833', 'DTM/0,0', 'IFM/4', 'RGB/1,255,255,255', 'RGB/2,10,10,10', 'RGB/3,200,0,
255', 'RGB/4,241,185,255', 'RGB/5,60,190,217', 'RGB/6,197,235,244', 'RGB/7,98,17
1,116', 'RGB/8,246,200,110']
DEBUG:root:['gdaltransform', '-tps', '-i', '-t_srs', '+proj=longlat', 'C:\\Maps\
\NewZealand\\NZ2325_2.kap']
ERROR:root:
Traceback (most recent call last):
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 247, in <module>
    kap2vrt(f)
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 181, in kap2vrt
    poly_tr=command(['gdaltransform','-tps','-i','-t_srs','+proj=longlat', kap],
 latlong).splitlines()
  File "C:\Maps\bsb2tiles\bsb2gdal.py", line 74, in command
    raise Exception("*** External program failed: %s" % params[0])
Exception: *** External program failed: gdaltransform
__________________
My N900 Photo Gallery and Slideshow
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:54.