[gdal-dev] Gdal2tiles in Gdal18 and creating KMZ files

Vincent Schut schut at sarvision.nl
Mon Feb 21 03:31:12 EST 2011


Hi Roland,

(lets cc the gdal list, so others can join in reading and/or answering)

If I recall correctly, you just have to make sure your input dataset is 
rgba. I think I usually had a 4-channel 8-bit geotiff, tiled, and with 
overviews (use gdaladdo to add them). I'm using a self-compiled very 
recent version of gdal (from svn repository) however, so that might be a 
cause of difference.
But it's some time ago I did this, and I'm not sure I recall everything 
correctly. Only that it seemed the most easy way to me to create kmz's 
with gdal :-)

Hope you'll succeed with some more experimenting.

Btw, have you checked the contents of the kmz file? Are you sure there 
are png's inside, and not jpeg's? I'm nog entirely sure anymore of how 
to force png output, my '-co format=png' might have been wrong...

If you don't succeed, don't hesitate to ask again on the gdal list :-)

Vincent.

On 02/18/2011 09:49 PM, Roland Duhaime wrote:
> Thanks for the response Vincent.  I wasn't aware of the new
> kmlsuperoveraly format.  I was able to create the KMZ file with PNG
> files.  However, the png files had black pixels instead of transparent
> pixels.  Were you able to get "gdal_translate -of kmlsuperoverlay -co
> format=png..." to preserve transparent pixels?  If so, what were some of
> the details of your source image or do you have a sample image I can
> repeat the process with?  I was able to maintain transparency with the
> same image using gdal2tiles but not with -kmlsuperoverlay.
>
> I see others had a similar experience here:
>
> http://osgeo-org.1803224.n2.nabble.com/gdal-dev-kmlsuperoverlay-nodata-support-td5624321.html
>
> Thanks Again,
> Roland
>
>
> On Fri, Feb 18, 2011 at 2:34 AM, Vincent Schut <schut at sarvision.nl
> <mailto:schut at sarvision.nl>> wrote:
>
>     Roland,
>
>     not really an answer to your question, but note that - with a recent
>     gdal - you can also create kmz by using the kmlsuperoverlay output
>     format, e.g.:
>
>     gdal_translate -of kmlsuperoverlay <infile> out.kmz
>
>     your infile need be a rgb or rgba format (if you want to maintain
>     transparency, add '-co format=png' to the gdal_translate command,
>     otherwise jpeg's will be created for the tiles).
>
>     Regards,
>     Vincent.
>
>
>     On 02/17/2011 06:28 PM, Roland Duhaime wrote:
>
>         Thanks Brian,
>
>         I have reviewed OSGeo4W\bin\gdal2tiles.py and specifically line 1597
>         containing the href tag to the png file:
>
>         <Icon>
>         <href>%(ty)d.%(tileformat)s</href>
>         </Icon>
>
>         I was curious if someone had any idea on how to modify this href
>         tag to
>         include the relative path as Brian suggests below.  I see that the
>         appropriate path is already included in the name tag if the .kml is
>         changed to .png.  Any ideas on the best approach would be
>         appreciated.
>         Also, is this relative path something that should be added to the
>         general release to support kmz compression?
>
>         Thanks,
>         Roland
>
>
>
>
>         On Wed, Feb 16, 2011 at 5:35 PM, brian <rush at winkey.org
>         <mailto:rush at winkey.org>
>         <mailto:rush at winkey.org <mailto:rush at winkey.org>>> wrote:
>
>             Roland
>
>
>             the problem is in /12/1211/2558.kml line 26
>
>         <href>2558.png</href>
>
>             this should be a relative path from the root of the zipfile
>         not from
>             2558.kml
>
>             Brian
>
>
>
>             On Wed, 2011-02-16 at 15:14 -0500, Roland Duhaime wrote:
>          >
>          > I am following the instructions for creating one KMZ file
>         that are
>          > posted here:
>          >
>          > http://trac.osgeo.org/gdal/wiki/UserDocs/Gdal2Tiles
>          >
>          > I am using gdal2tiles under the "gdal" package 1.8.  I have
>         having
>          > success creating superoverlays and the related folder structure.
>               I am
>          > able to read the created doc.kml in Google Earth.  However,
>         when I
>          > attempt to zip up the folder structure using 7zip and rename
>         the file
>          > to test.kmz, the file doesn't read properly in Google Earth
>         (GE).  GE
>          > zooms into the correct location but all I see is a red "x".
>          > Compressing the superoverlay structure seems to break the link
>             between
>          > the doc.kml file and the png files.  As an example, I have
>         created a
>          > tiny (21 KB)  example and placed it here:
>          >
>          > http://www.edc.uri.edu/Personal/roland/test.kmz
>          >
>          > I am curious if someone had some insight.
>          >
>          > All the Best,
>          > Roland
>          >
>          >
>          >
>          > _______________________________________________
>          > gdal-dev mailing list
>          > gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>         <mailto:gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>>
>
>          > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
>         _______________________________________________
>         gdal-dev mailing list
>         gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>         http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>


More information about the gdal-dev mailing list