Problems generating tiles for VRT with overlapping bounding boxes

761 views
Skip to first unread message

eigentx

unread,
Feb 23, 2009, 1:56:17 PM2/23/09
to MapTiler User Group
Hello,

We have several raster data which we want to process with gdal2tiles.
These data refers to geographic regions which bounding boxes overlap.
We generate a VRT for these data using gdal_vrtmerge, and then process
it with gdal2tiles, but we have problems in the overlapping areas and
the raster data is not shown correctly on them.

Is it required that the mosaic of images of the VRT file do not
overlap, or there is an option to manage overlapping correctly?

Thanks in advance,

klo...@gmail.com

unread,
Feb 23, 2009, 4:47:11 PM2/23/09
to mapt...@googlegroups.com
Hello Felix,

> We have several raster data which we want to process with gdal2tiles.
> These data refers to geographic regions which bounding boxes overlap.
> We generate a VRT for these data using gdal_vrtmerge, and then process
> it with gdal2tiles, but we have problems in the overlapping areas and
> the raster data is not shown correctly on them.

Can you please write a bit more details (or even better give a link to
an online mashup presentation) for what you mean with "raster data is
not shown correctly". I have no clue now how your reported error looks
like and what kind of data are you using as the input.

> Is it required that the mosaic of images of the VRT file do not
> overlap, or there is an option to manage overlapping correctly?

The gdal_vrtmerge tool should be usable for merging the overlaping rasters...
You can also try the official tool gdal_merge to check if you receive
the correct results.

I am working on the Tile Tree Merging functionality (you can add votes
for this feature):
http://maptiler.uservoice.com/pages/general/suggestions/125891-tile-tree-merging

Best regards

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

Jorge Arévalo

unread,
Feb 23, 2009, 5:34:42 PM2/23/09
to mapt...@googlegroups.com
Hello Klokan

I'm working with Felix in the same project. I think we can provide you some screenshots. A link to the mashup may be difficult. I've created a scheme (ok, I used paint, sorry for this :-)) that shows our problem. It's attached to this message.

We have many adjacent provinces, and the problem is when the bounding box of one of the provinces overlaps the boundig box of another one. In the picture, as you can imagine, the white area with the label "LACK OF DATA!" should be pink, like the rest of PROV. B

Thanks in advance
Jorge
overlap.PNG

klo...@gmail.com

unread,
Feb 23, 2009, 6:26:15 PM2/23/09
to mapt...@googlegroups.com
Hi Jorge,

gdal is able to make this kind of merging in case your input files are
using NODATA transparency (one color is set as a transparent) instead
of the separate Alpha channel transparency...

At least gdal_merge.py supports this merging - it even has a -n option for that.

For the true merging with alpha channel (several level of
transparency) you would need to implement it separately - I don't know
about any public gdal-based utility which would be able to do this
kind of merging (even though it would not be as hard to hack
gdal_merge.py to do the true alpha channel merging too). You can also
try at gdal-dev conference.

My proposed Tile Tree Merging functionality should be able to make
this kind of merging once it is finished...

Klokan

Jorge Arévalo

unread,
Feb 23, 2009, 6:55:31 PM2/23/09
to mapt...@googlegroups.com
Hi Klokan,

We are using true transparency channel. Our png tiles have 4 bands (ARGB). So, based on your information, we can't use gdal_vrtmerge, and we'll have to implement merging by hand (maybe using gdal_merge).

By the way, we're having a lot of problems with this kind of tiles (alpha channel based) and some web browser. In theory, the tiles should be 50% transparent (127 as value for alpha channel). These tiles can be rendered with IE6 (and a hack, of course) and Firefox, but IE7 shows a really ugly grey background below of each tile. If we create opaques tiles (this is, with 255 as a value to alpha channel), we can change the transparency level on IE7 and Firefox, using Google Maps' TileLayer and transparency control, but it doesn't work for IE6. Always render opaque tiles.

Would the change of "transparency system" (from alpha channel to NODATA) be the solution? Do we have to apply pngnq or any type of PNG processing to make the tiles properly visible for these 3 browsers?

Oh, and I think that your proposal of feature is really, really useful and interesting. I'll vote you :-)

Thanks again
Jorge

klo...@gmail.com

unread,
Mar 19, 2009, 7:02:59 AM3/19/09
to mapt...@googlegroups.com, Jorge Arévalo
Jorge,

just wanted to tell you that there is an update in the merging you was
voting for...

Have a look at: http://groups.google.com/group/maptiler/msg/879d7f5abd094ffe
Now gdal2tiles from maptiler SVN can do the true alpha transparency
merging with existing tile trees.
The post also include nice TIFF example files for testing it - based
on your blue-red land :-)

Ad subject of this thread "VRT with overlapping bounding boxes":

If you need NODATA merging in VRT with overlapping bounding boxes just
use <ComplexSource> with NoDataValue set in VRT (look at:
http://www.gdal.org/gdal_vrttut.html) and then the files are merged
correctly...
I will probably use this technique for MapTiler GUI preprocessing.py
for merging more input files with NODATA transparency.

Ad your problem in older IE related to visible gray background:

I am not able to reproduce it on my computer, and none of my customers
so far reached this problem... I am not sure if you are using the IE
hacks correctly... Does this problem appear in the template generated
by gdal2tiles too?
Anyway, now I have seen a similar bug report suggesting a change in
mapserver rendering:
http://trac.osgeo.org/mapserver/ticket/1089

It is written there:
"""
I have done a few tests using tweakpng (http://entropymine.com/jason/tweakpng/).

The images returned by mapserver don't have the bKGD chunk set, and the default
in IE is grey. If I set the bKGD chunck to white using tweakpng, it works as I
would expect in IE.
"""

You can dig into this problem more... maybe this is a good start...
Feel free to report what you discovered...

Best regards

Klokan

Jorge Arévalo

unread,
Mar 19, 2009, 7:16:03 AM3/19/09
to klo...@gmail.com, mapt...@googlegroups.com
Hi Klokan

Thanks, I'll take a look on it later.

About the dark grey background, I've found a "solution" that works, but I'm not sure why... Finally, I used the alpha-channel based PNG files with 50% of transparency. With JS, I check if the navigator is IE7 or IE6. With IE7, the method "getOpacity" of the TileLayer's implementation returns 1.0 (So, basically, I show the PNG files with the highest transparency level available, this is the 50%, its own opacity by default). With IE6, the method returns the value of the "opacity" var defined. Then, the PNG files are shown with a given value of opacity over its own opacity value (that is, the 50%).

Then, although the opacity isn't the same when using IE6 or IE7, visually works... I know that it isn't an "orthodox" solution, but I ned the fastest one.

Anyway, I'll take a look to your information, as I said. Thanks a lot again!

Regards
Jorge
Reply all
Reply to author
Forward
0 new messages