I have several jpeg2000 tiles non georeferenced and covering a certain area. I know in qgis you can mosaic image using the merge tool but I have done it only using georeferenced images, which is quite straightforward. I would like to know if there is a method with qgis to mosaic raster images non goreferenced. So basically just stitching tiles above, below, left and right.
1 Answer
This workaround should work:
Create fake world files (.wld or .j2w). Use pixel size 1, -1 and put the origin of your master image into 1,1. Check the size of your images is pixels (width, height) with gdalinfo and calculate origins for the other tiles to match. Remember these:
- origin is at the center of the top-left pixel
- Y (northing) is decreasing from top to down
- putting origin into 0,0 would feel natural but in some cases it can make GDAL to do odd things and using 1,1 instead is more safe
The complete world file for tile1 would be
1.0
0
0
-1.0
1.0
1.0
Another option is to create a .vrt file from all the images with gdalbuildvrt utility and edit the resulting .vrt file http://www.gdal.org/gdal_vrttut.html which is a XML text file. element has roughly the same information as a world file.
-
thanks, how do you create in qgis such fake files? How do you change the origin of the upper left?– rducaCommented Jun 18, 2015 at 15:18
-
Use text editor, world file it is just 6 lines of plain text en.wikipedia.org/wiki/World_file. It you have image image.jp2 write a world file and save it as image.j2w. I added a world file for tile1 into my answer. As I wrote, this is a workaround but it will work. Commented Jun 18, 2015 at 15:22
-
I have done what you explained and I have created a tile containing the text you attached to the post. When loading in qgis it gives me an error.– rducaCommented Jun 19, 2015 at 9:25
-
What files do you have now? What is the error? Could you run gdalinfo for the image and paste the result? Or perhaps put the image and world file for downloading? Commented Jun 19, 2015 at 10:47
-
I run the gidal info on my image and i Have Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library Files: /Volumes/FREECOM HDD/image.jp2 /Volumes/FREECOM HDD/image.jp2.aux.xml Size is 424, 17390 Coordinate System is `' Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0,17390.0) Upper Right ( 424.0, 0.0) Lower Right ( 424.0,17390.0) Center ( 212.0, 8695.0) Band 1 Block=424x2048 Type=UInt16, ColorInterp=Undefined Overviews: 212x8695, 106x4347, 53x2173 Overviews: arbitrary Image Structure Metadata: NBITS=12– rducaCommented Jun 19, 2015 at 10:52