merging tile trees

915 views
Skip to first unread message

salias

unread,
Mar 9, 2009, 9:41:26 PM3/9/09
to MapTiler User Group
Greets:

Was wondering what the preferred method is to merge tile trees?

klo...@gmail.com

unread,
Mar 10, 2009, 11:23:11 AM3/10/09
to mapt...@googlegroups.com
Hi,

> Was wondering what the preferred method is to merge tile trees?

Right now gdal2tiles/maptiler can generate tiles from more input files
by reading a VRT file, which is text (XML) description of the merging
of another raster files.
VRT can be prepared during preprocessing step by one of the utilities:
gdal_vrtmerge or by preprocess.py from MapTiler SVN, or by
gdalbuildvrt from GDAL 1.7 (SVN).
You can also merge the files into one bigger GeoTIFF by gdalwarp or by
gdal_merge.py and then render tiles from that one.

I also implemented the true "merging of the tile trees" - the way that
you just select the existing directory with tile tree as the output
and gdal2tiles instead of overwriting tiles simply do the true alpha
channel composition in RGBA - then the old tiles are visible under the
newly rendered tiles in the overlay areas with transparency.
It is not yet committed but it running quite well. Remind me the
commit in the end of week - if you are interested ;-)

Klokan
--
http://blog.klokan.cz/
http://www.maptiler.org/
http://www.oldmapsonline.org/

Chris h

unread,
Mar 10, 2009, 12:15:51 PM3/10/09
to mapt...@googlegroups.com
On Tuesday 10 March 2009 11:23:11 klo...@gmail.com wrote:
> Hi,
>
> > Was wondering what the preferred method is to merge tile trees?
>
> Right now gdal2tiles/maptiler can generate tiles from more input files
> by reading a VRT file, which is text (XML) description of the merging
> of another raster files.

From reading previous posts this was your recommendation in the past. Not a
developer but I can follow instructions really good..:)

My concern is that I want to do this with NOAA charts and not really sure if
this would work with files that are of a different scale but of the same
location. ie: 1:1000000, 1:50000, 1:20,000 all more or less of the same area.
Was wondering if you could confirm this so as to not go down the wrong road
and waste time.

Basically what I'm trying to copy or recreate but only for the Eastern
Seaboard as this is where I plan to sail is the following:

http://demo.geogarage.com/noaa/ and learning everything from scratch..:)

But have it run locally on my laptop as internet connections at sea are
limited. Hence the ability to toggle the basemap which already works fine
with maptiler is a requirement.

Its a great planning tool not intended to replace a proper ECS (electronic
charting system) rather supplement it.

> VRT can be prepared during preprocessing step by one of the utilities:
> gdal_vrtmerge or by preprocess.py from MapTiler SVN, or by
> gdalbuildvrt from GDAL 1.7 (SVN).
> You can also merge the files into one bigger GeoTIFF by gdalwarp or by
> gdal_merge.py and then render tiles from that one.
>
> I also implemented the true "merging of the tile trees" - the way that
> you just select the existing directory with tile tree as the output
> and gdal2tiles instead of overwriting tiles simply do the true alpha
> channel composition in RGBA - then the old tiles are visible under the
> newly rendered tiles in the overlay areas with transparency.
> It is not yet committed but it running quite well. Remind me the
> commit in the end of week - if you are interested ;-)

I've put a reminder into my calender..

Thanks for your response. Its really appreciated.
--
/ch

klo...@gmail.com

unread,
Mar 11, 2009, 5:10:17 AM3/11/09
to mapt...@googlegroups.com
Chris,

> My concern is that I want to do this with NOAA charts and not really sure if
> this would work with files that are of a different scale but of the same
> location. ie: 1:1000000, 1:50000, 1:20,000 all more or less of the same area.
> Was wondering if you could confirm this so as to not go down the wrong road
> and waste time.

It is possible to use gdal2tiles and GDAL library as a base for such
tile rendering and stitching... You can also use another open-source
projects like MapServer/TileCache or GeoServer or Mapnik...
But you need to make customization for particular tasks and chain the
tools correctly. That's exactly what I do for my customers, and in
case they allow me to publish the patches for gdal2tiles then new
features are appearing in the public gdal2tiles/maptiler utility...

BTW GDAL is also used in Google Earth or some ESRI products and is
behind a lot of software tools.

I am providing commercial consultancy and assistance for such tasks
(http://www.maptiler.com/) - including rendering of tiles in a cloud
(Amazon EC2 cluster, ..), correct merging and automatic clipping of
the collars from NOAA RNC and similar maps.
You are welcome to be one of my clients ;-)

> Basically what I'm trying to copy or recreate but only for the Eastern
> Seaboard as this is where I plan to sail is the following:
>
> http://demo.geogarage.com/noaa/ and learning everything from scratch..:)

People who needs tiles ONLY FOR PERSONAL USE in the laptop are very
often making a local copy from tile servers. I guess it would not be
hard to decode the JavaScript code which is doing the translation of
the x,y,z tile into the png tile and use it in a script for batch
downloading. Such scripts are very often source of the map data for
GPL navigation software and similar private projects like you are
describing.

Of course there are also ways how to protect tiles against such batch
download - if you look at it from the side of geodata provider.

To render your own maps would be definitively better but right now it
involves several steps and extra knowledge.

I plan to automate the process of raster merging in MapTiler the way
that it will allow completely user-friendly merging of datasets, but
this functionality is simply not yet available on the user level - I
have a set of script for particular sub tasks which needs to be used
properly in a chain to produce the correct results...

>> I also implemented the true "merging of the tile trees" - the way that
>> you just select the existing directory with tile tree as the output
>> and gdal2tiles instead of overwriting tiles simply do the true alpha
>> channel composition in RGBA - then the old tiles are visible under the
>> newly rendered tiles in the overlay areas with transparency.
>> It is not yet committed but it running quite well. Remind me the
>> commit in the end of week - if you are interested ;-)
>
> I've put a reminder into my calender..

OK ;-)

Best regards,

salias

unread,
Mar 13, 2009, 1:54:09 PM3/13/09
to MapTiler User Group
> Remind me the
> commit in the end of week - if you are interested ;-)

Just a friendly reminder, I remain very interested..;)

Best and many thanks

/ch

klo...@gmail.com

unread,
Mar 13, 2009, 6:39:11 PM3/13/09
to mapt...@googlegroups.com
Hi Chris,

I committed new version of gdal2tiles.py which contains preliminary
support for "Tile Tree Merging" and "Nodata" atribute:
http://maptiler.googlecode.com/svn/trunk/maptiler/gdal2tiles.py

You can try it on the command line with a standard GDAL 1.6 installation.
You need also PIL (Python Imaging Library) installed on your computer.

For tile tree merging just use the parameter "-r antialias" and
specify result directory with existing tile tree, the newly generated
tiles are going to be merged with already existing tiles in that
directory and the new map will be placed on top of the original one.

In this moment the bounds in the XML file and in googlemaps.html
viewer are not modified, so you need to tweak them by hand if you
would like to see tiles appearing in the web browser outside of the
original bounding box from the first map - but it is just playing with
JavaScript.
The created tile tree is going to be sparse (the empty tiles are not there).

An example of usage with attached testing 'beautiful maps' ;-):

./gdal2tiles.py -z 3-4 -r antialias merge2rgb.tif result
./gdal2tiles.py -z 3-4 -r antialias merge1rgb.tif result

merge1rgb.tif is placed on top of merge2rgb.tif in the tile tree in
directory "result". RGBA input will run as well (including true alpha
blending during compositing). Monochromatic input or input with
palette (with one band) is not yet supported, but it can be converted
in advance by "gdal_translate -expand rgba".

Best,

Klokan
merge1rgb.tif
merge2rgb.tif

Chris h

unread,
Mar 13, 2009, 7:02:31 PM3/13/09
to mapt...@googlegroups.com
On Friday 13 March 2009 18:39:11 klo...@gmail.com wrote:
> Hi Chris,
>
> I committed new version of gdal2tiles.py which contains preliminary
> support for "Tile Tree Merging" and "Nodata" atribute:
> http://maptiler.googlecode.com/svn/trunk/maptiler/gdal2tiles.py

This is great news. Thank you. Since my truck broke down and Im off work for
the weekend will actually have time to play with it. Also owe you a response
from your previous post. That will also come over the weekend.

Again...thanks

--
/ch

klo...@gmail.com

unread,
Jul 24, 2009, 10:49:16 AM7/24/09
to mapt...@googlegroups.com
Hi everybody,

several people had problem with installing PIL into the OSGeo4W to
test the merging with 'antialias' in GDAL2Tiles.

Here is a step by step guide how to do that after you have installed
OSGeo4W with GDAL1.6 as it is described at
http://help.maptiler.org/betatest/

1) Download attached "pythonregister.py" and save it directly to "C:"

2) Start OSGeo4W Shell (icon OSGeo4W on your Desktop).

3) type in "gdal16" to initialize gdal 1.6 libraries

4) type in "python C:\pythonregister.py"

5) you can close the OSGeo4W Shell and delete the pythonregister.py
file from your disk.

6) Download and run this installer:
http://effbot.org/downloads/PIL-1.1.6.win32-py2.5.exe, everything
should go well...

You are ready to use GDAL2Tiles with 'antialias' rendering, please
don't forget to upgrade to latest version of the gdal2tiles.py, so
download:
http://maptiler.googlecode.com/svn/trunk/maptiler/gdal2tiles.py and
save it to C:\OSGeo4W\apps\gdal-16\bin\

I will probably integrate PIL into the new version of MapTiler
installer to avoid this complicated setup and simplify the merging and
make it possible directly from the GUI. Just to find time to do that -
any sponsor ? ;-)

Best regards,

Klokan Petr Pridal

pythonregister.py
Reply all
Reply to author
Forward
0 new messages