Active Topics

 



Notices


Reply
Thread Tools
Posts: 40 | Thanked: 18 times | Joined on May 2008
#51
Originally Posted by jaybonomad View Post
The file has 4 /PLY elements. Using your latest bsb2gdal.py does not change the core problem
Code:
DEBUG:root:('-123.183900 47.032780\n-123.183900 47.599720\n-122.168100 47.599720 \n-122.168100 47.032780\n',) 
DEBUG:root:gdaltransform -tps -i -t_srs +proj=longlat 18448_1.kap 
DEBUG:root:('', '')
Apparently, the script cannot catch gdaltransform output. It must be something like:
Code:
DEBUG:root:('-123.183900 47.032780\n-123.183900 47.599720\n-122.168100 47.599720\n-122.168100 47.032780\n',)
DEBUG:root:gdaltransform -tps -i -t_srs +proj=longlat 18448_1.KAP
DEBUG:root:('264.235828047997 8192.85411369754 0\n264.23553921845 313.584303449666 0\n9864.84455602684 313.584331807953 0\n9864.84455306079 8192.854118532 0\n', '')
Can you try to feed this
Code:
-123.183900 47.032780
-123.183900 47.599720
-122.168100 47.599720
-122.168100 47.032780
manually into
Code:
gdaltransform -tps -i -t_srs +proj=longlat 18448_1.KAP
I've came across such an effect some time ago at the Russian thread.
Do you use 32-bit python distribution? If so, perhaps it's worth trying 64-bit version.

Update: Just tried your chart on 32-bit XP -- no problem
BTW Found a little bug though, so here a yet another version
Attached Files
File Type: txt bsb2gdal.py.txt (13.3 KB, 156 views)

Last edited by vadp; 2010-11-16 at 14:16.
 
Posts: 5 | Thanked: 0 times | Joined on Nov 2010
#52
Originally Posted by vadp View Post
Can you try to feed this
Code:
-123.183900 47.032780
-123.183900 47.599720
-122.168100 47.599720
-122.168100 47.032780
manually into
Code:
gdaltransform -tps -i -t_srs +proj=longlat 18448_1.KAP
I assumed this worked. The output was:
Code:
E:\DeepZoom\dev\bsb2tiles>gdaltransform -tps -i -t_srs +proj=longlat 18448_1.KAP

-123.183900 47.032780
264.235828047997 8192.85411369754 0
-123.183900 47.599720
264.23553921845 313.584303449666 0
-122.168100 47.599720
9864.84455602684 313.584331807953 0
-122.168100 47.032780
9864.84455306079 8192.854118532 0
I looked into using the 64bit version of Python, but apparently PIL isn't readily available in 64bit, and it sounds like this pathway has numerous other problems. See:
http://stackoverflow.com/questions/2...s-python-2-6-4

Unless you have another suggestion, I guess it's time to load a 32bit VM.

Last edited by jaybonomad; 2010-11-17 at 05:34.
 
Posts: 5 | Thanked: 0 times | Joined on Nov 2010
#53
Originally Posted by jaybonomad View Post
Unless you have another suggestion, I guess it's time to load a 32bit VM.
OK. I created a Win7 32bit VHD, loaded it up with Python and... Exactly the same problem at gdalwarp, the POLYGON is empty.

Code:
DEBUG:root:gdalwarp -tps -dstalpha -wo INIT_DEST=NO_DATA -wo CUTLINE=POLYGON(())
 -of VRT 18448_1.aux_vrt 18448_1.vrt
Does anybody have this working with Win7?

Last edited by jaybonomad; 2010-11-17 at 20:22.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#54
Originally Posted by jaybonomad View Post
Exactly the same problem at gdalwarp, the POLYGON is empty.
Hi jaybonomad! I'm back home and I have made a little trick that may help you. Could you please try the version attached?
Attached Files
File Type: txt bsb2gdal.py.txt (13.4 KB, 138 views)
 
Posts: 5 | Thanked: 0 times | Joined on Nov 2010
#55
Originally Posted by vadp View Post
Hi jaybonomad! I'm back home and I have made a little trick that may help you. Could you please try the version attached?
Still no luck using your latest version. Here are the last few lines of output:

.72 -gcp 2623 4302 -9196176.01 4063804.02 -gcp 2623 2819 -9196176.01 4067511.15
-gcp 2623 2714 -9196176.01 4067773.50 -gcp 1623 8114 -9198676.16 4054273.39 -gcp
1623 7265 -9198676.16 4056396.14 -gcp 1623 5784 -9198676.76 4060099.05 -gcp 162
3 4302 -9198676.61 4063804.02 -gcp 1623 3528 -9198676.61 4065738.98 -gcp 623 811
4 -9201176.90 4054273.39 -gcp 623 7265 -9201176.68 4056396.14 -gcp 623 5784 -920
1176.68 4060099.05 -gcp 623 4302 -9201176.45 4063804.35 -gcp 623 3528 -9201176.4
5 4065738.98 -gcp 10087 7265 -9177517.23 4056396.36 -gcp 252 7265 -9202103.87 40
56396.36 -gcp 10087 5784 -9177517.23 4060099.05 -gcp 252 5784 -9202103.65 406009
9.05 -gcp 10087 4302 -9177517.00 4063804.35 -gcp 252 4302 -9202103.65 4063804.35
-gcp 10087 2819 -9177517.00 4067511.37 -gcp 2555 2819 -9196345.46 4067511.15 -g
cp 10087 1335 -9177516.78 4071221.22 -gcp 3512 1335 -9193952.88 4071221.56 -expa
nd rgb 18446_1.KAP 18446_1.vrt
DEBUG:root'', '')
DEBUG:root:gdalwarp -tps -dstalpha -wo INIT_DEST=NO_DATA -wo CUTLINE=POLYGON(())
-of VRT 18446_1.aux_vrt 18446_1.vrt
DEBUG:root'', 'ERROR 1: Failed to parse CUTLINE geometry wkt.\n')
Traceback (most recent call last):
File "bsb2gdal.py", line 324, in <module>
kap2vrt(f)
File "bsb2gdal.py", line 274, in kap2vrt
command(warp_cmd)
File "bsb2gdal.py", line 94, in command
raise Exception("*** External program failed: %s\n%s" % (' '.join(params),st
derr))
Exception: *** External program failed: gdalwarp -tps -dstalpha -wo INIT_DEST=NO
_DATA -wo CUTLINE=POLYGON(()) -of VRT 18446_1.aux_vrt 18446_1.vrt
ERROR 1: Failed to parse CUTLINE geometry wkt.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#56
Originally Posted by jaybonomad View Post
I looked into using the 64bit version of Python, but apparently PIL isn't readily available in 64bit, and it sounds like this pathway has numerous other problems.
It seems there are 2 options here:
1) Install 32-bit Python, then edit registry, then 32-bit PIL, etc, as described here: Installing PIL (Python Imaging Library) in Win7 64 bits, Python 2.6.4
2) Use unofficial 64-bit builds: running PIL on 64bit
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#57
Originally Posted by jaybonomad View Post
Still no luck using your latest version.
OK man. I've made process interaction for windows another way, so see if it's any better for you

You would need to install pywin32 as well
Attached Files
File Type: txt bsb2gdal.py.txt (13.7 KB, 121 views)

Last edited by vadp; 2010-12-06 at 14:12.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#58
Originally Posted by pekkis View Post
It seems that the calibration is off by few hundred meters. I'll try to get you the map samples.
I think I found a better datum for your charts. See the script attached.
Attached Files
File Type: txt ozi2gdal.py.txt (13.6 KB, 132 views)
 

The Following User Says Thank You to vadp For This Useful Post:
Posts: 38 | Thanked: 6 times | Joined on Mar 2006 @ Finland
#59
Originally Posted by vadp View Post
I think I found a better datum for your charts. See the script attached.
Works fine !

Thanks!
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#60
DRAFT!!!

How to install bsb2tiles kit on Windows:

Here are the prerequisites for the kit: Python (v 2.6), Python imaging library (PIL), NumPy package, GDAL (v. 1.6 and above) and, optionally, pngnq utility.
  1. Install these packages:Python, PIL, numpy. Download them from here: http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi, http://effbot.org/media/downloads/PI...in32-py2.6.exe and http://pypi.python.org/packages/2.6/...in32-py2.6.exe
  2. Unpack GDAL from http://vbkto.dyndns.org/sdk/release-...server-5-6.zip to a folder
  3. Take bsb2tiles.tar.gz from the 1st post in this thread: http://forums.internettablettalk.com...05&postcount=1
  4. Unpack it with 7zip (http://7-zip.org) to another folder
  5. in this folder edit bsb2tiles.bat, to modify the paths to the Python and GDAL packages, for example:
    Code:
    set PYTHON=D:\bin\Python26
    set GDAL=D:\bin\release-1400-gdal-1-7-mapserver-5-6
  6. Now you can launch bsb2tiles.bat

*** Map conversion

After bsb2tiles.bat starts, a command line window pop-ups. In this window you do the job.

First you navigate to the folder with the source data: OZI .MAP, BSB .KAP, JPEG, PNG, TIFF rasters, etc. For example:
Code:
cd /d D:\test\bsb\tst-ozi
These files can be dragged here from the Windows Explorer window to compose a command line.

bsb2gdal.py script creates a GDAL's .VRT file from a BSB .KAP file.

ozi2gdal.py script translates ozi .MAP data into a format GDAL's .VRT. A corresponding raster file (jpg, png, tiff) must be in the the same folder. NB: OZF2 and OZF3 are not supported, but on the Internet you could find some converters for them.

gdal2tiles.py using information from .VRT file converts a raster to a tile pyramid folder (in so-called TMS structure). It also puts a few helper files there. In particular, googlemaps.html, with this file you can check the result of a conversion with a browser.

tiles2mapper.py converts a set of tiles from one format to another. By default it converts TMS pyramid into a maemo-mapper SQLite data base

In the simplest case, the data preparation for maemo-mapper looks like this:
Code:
bsb2gdal.py my_map.kap
or
ozi2gdal.py my_map.map
...
gdal2tiles.py my_map.vrt
...
tiles2mapper.py my_map
...
The result is in the file my_map.db. You'd need to copy it to N8xx the folder with the other maemo-mapper map caches. Then, in maemo-mapper you'd need to create a new repository. The path parameter of the repository to set the path of the ".db" file . The URL value in this case is not important, for example you can put there something like http://myserver/maps/%0d/%d/%d.png

Notes:
  • The scripts have a useful "--help" option
  • Some BSB or OZI files have a description of a "useful" part of a raster. This region can be "cut out":
    Code:
    bsb2gdal.py --cut my_map.kap 
    or
    ozi2gdal.py --cut my_map.map
  • On some maps a "useless" area is painted by some color (or you can paint it by your own). These can mask by the "--no-data" option:
    Code:
    ozi2gdal.py --no-data=111,222,333 my_map.map
  • When rendering tiles for upper pyramid levels, gdal2tiles.py gives somewhat better result with "-r antialias":
    Code:
    gdal2tiles.py -r antialias my_map.vrt
  • The range of zoom levels generated by gdal2tiles.py can be set by: "-z 9-15"
  • Multiple maps can be sewn into one by tiles-merge.py:
    Code:
    tiles-merge.py map1-folder map2-folder map3-folder result-folder
    where mapN-folder are the folders generated by gdal2tiles.py
  • The pyramid of tiles can be transformed into a google-compliant form:
    Code:
    tiles2mapper.py --to gtiles source-tiles result-tiles
    The result is compatible with mappero cache, so can be copied straight to N900

Last edited by vadp; 2010-12-08 at 14:00.
 
Reply


 
Forum Jump


All times are GMT. The time now is 21:38.