I have some KMZ files that are basically aerial imagery that has been referenced to Lat/Long. I would like to convert them to a projected UTM coordinates such as NAD 83 in a geo-jpg format. I was hoping to use QGIS or some low cost method. I can't seem to get these KMZ files into QGIS to start with. If I change the file extension of KMZ to a zip, I see both the KML file and then a folder with the unprojected jpg file. QGIS just says it doesn't support or it's not valid format both the KMZ as raster format or the KML (with attached jpg) as a vector format. Any ideas what I could do here?
2 Answers
kmz with imagery (like Garmin Custom Maps) are raster files. So you have to use Add Raster Layer
, not Add vector layer. Unfortunately, GDAL only supprts kml as vector layers.
The problem is that the unzipped img files do not have georeferencing information stored by themselves. This is stored in the doc.kml file; but this is not in a format GDAL understands.
You have to georeference the files manually with the information of the kml file.
Tere is a plugin for creating Garmin Custom Maps out of QGIS, but unfortunately nothing to load them into QGIS.
-
Thanks for the answer Andre. Yeah, I kind of figured that was the case. I don't get why GDAL doesn't support KMZ or KML's as raster layers. It seems there is tough to find software that will outside of Google Earth that has no export or transformation features. Can you explain how I could manually georeference the files using the lat/long values in the kml file? I can see them in there but not seeing how I get those jpg file and converted to UTM.– wilbevCommented Mar 16, 2013 at 18:45
-
1The doc.kml gives you the north/south/east/west coordinates in WGS84. So you can load the image in the georeferencer, point the four edges, and enter the coordinates listed in the kml file with copy and paste. Would be a nice idea for a plugin, if you have lots of them.– AndreJCommented Mar 16, 2013 at 18:49
-
Yes, it would be a nice plug-in. I'm pretty new to QGIS, and I'm not finding a good way to get this converted to UTM projected jpg. I see Translate under Raster menu, but that doesn't seem to do an true transformation if I select a different projection such as UTM.– wilbevCommented Mar 16, 2013 at 19:16
-
@wibev - select thegeoreferenced image layer, and save layer as.. Commented Mar 16, 2013 at 20:03
-
1No, Save Layer As only works for vector layers (and is not available for raster layers). You have to use
Raster -> projection -> Transform
. But this only works for Geotiffs, which have the CRS information stored within. Images with worldfile won't work.– AndreJCommented Mar 16, 2013 at 20:32
If you use the coordinates in the doc.kml to create a jpeg world file[1] alongside your unzipped jpeg and tell QGIS that your image is EPSG:4326, you will then be able to warp it into your new projection. If you don't know how to calculate the world file, post the kml.doc in a gist and someone here can help you with the calculation.
-
For privacy concerns, I can't post the doc.kml file. I did try just manually copying and pasting the lat/long values into the 4 corners of the image, but it ended up not being very accurate, so it's like the lat/long values are not the true edits of the image. So I'm not sure what I'm doing wrong.– wilbevCommented Mar 17, 2013 at 0:06
-
The world file isn't the 4 corners. It is the upper left and then the pixel size, which you can calculate from the swath size (n-s) & (w-e) divided by the pixel size in each dimension.– Dan DyeCommented Mar 17, 2013 at 2:52