This helped me a bunch in calculating the positions for my tiles. I created and used a world file for each tile after calculating the top left x,y coordinate (in meters, lat/lon, feet, etc.) of each tile. Once all my world files were created and I checked them over to see if they were correct, I used gdaltindex. I'm going to post a section of a previous post someone sent me when I was encountering problems with tile indexing:
OK – it’s not as bad as all that – don’t fire up Photoshop yet. If you have a set of tiles which together create a seamless large image, and those tiles are of a regular size and shape, don’t bother pasting them together. Each world file has six numbers in it, two of which will be 0. For each image tile you need a world file that contains the X/Y coordinates of the upper left pixel of the image (two numbers), and the dimension (size) of each pixel in X (one number) and Y (one number) units. In the vast majority of cases the last two numbers will be identical except for sign (the Y value is normally a negative number since Y values decrease as you go from the top to the bottom of the image). If your images make a rectangle when pasted together, just treat them as one. Find the X/Y coordinates of the upper left corner of the entire image area, and the X/Y coordinates of the lower right corner of the entire image area. Find the size of the entire mosaiced rectangle in X and Y pixels. The X pixel dimension will be (maxx – minx) / xpixels, and the Y will be (miny – maxy) / ypixels. You should find that the X number is -1 times the Y number. For all your world files, these two X and Y extent values (the first and fourth lines) will be constants. The last two lines are the upper left X and Y coordinates of each tile. Your tiles will all have the same Y value across each row, and the same X value down each column. You know what the upper-left corner of the upper-left tile is, because you measured it. You know the number of X pixels in each tile and the number of Y pixels in each tile, and you now know the size in X and Y units of each pixel, so you know the extent of each image tile in X and Y units, so you can calculate the upper-left corner coordinate of the image to the right and the image below. Repeat until complete. The top left corner will have the minx and miny values, whereas the bottom right corner will have the maxx and maxy values. I had to figure out the x pixel dimension and the y pixel dimension of the entire image first, then apply those dimensions to each tile. For example: The entire image first: TL - lat = 40.117268, lon = -88.248281 (miny and minx) BL - lat = 40.082274, lon = -88.205980 (maxy and maxx) Width = 2602 = xpixels (The width and height of my image) Height = 2800 = ypixels x pixel dimension = (maxX - minX)/xpixels y pixel dimension = (maxY - minY)/ypixels For me, x pixel dimension =0.000016257 and the y pixel dimension = -0.000012497 Now, keep in mind it should be more like 0.000016257 and -0.000016257, but I had an unusual case, so the numbers didn't do that. Now that I have these 2 valuse, just apply this to the top left tile: TL - lat = 40.117268, lon = -88.248281 (miny and minx) BL - lat = ?, lon = ? (maxy and miny) Width = 548 (The width and height of my tiles) Height = 300 x pixel dimension = (maxX-minX)/xpixels 0.000016257 = (maxX - (-88.248281))/548 0.000016257 = (maxX + 88.24281)/548 0.008908836 = maxX + 88.24281 -88.239372164 = maxX (Bottom right x coordinate for first tile) y pixel dimension = (maxY-minY)/ypixels -0.000012497 = (maxY - 40.117268)/300 -0.0037491 = maxY - 40.117268 40.113519 = maxY (Bottom right y coordinate for first tile) X should typically be a negative number, while Y should typically be positive (if you're in North America). Ok, now that I have those I can figure out the other tiles. The tile that will be SouthEast of the first tile would have the bottom right coordinates that we just figured out as its top left coordinates. The tile East of the tile we just figured out would have the same y coordinate and the bottom left x coordinate we just figured out. And, the tile South of the tile we just figured out would have the same x coordinate and the bottom left y coordinate we just figured out. And so on, and so on..... So. One tile's bottom left coordinates should provide a coordinate for the next connecting tile. Hope this helps. It sounds like some calculation issues. - Chris Date: Mon, 1 Oct 2007 18:50:27 +0200 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [UMN_MAPSERVER-USERS] Weidr Output image with the esri tile index file -- GDALTINDEX CC: [email protected] Actually, the white lines only appears on this tile index file, all the others are fine. What I am worrying about is what you said - the gaps between image georeferencing, but I am not really sure. My images are just 400*^300 pixels, so if I get a image rendered by MapServer, i can see the white grids on the every output image. Am I the only one who gets the white lines on output image? Zhonghai On 10/1/07, Christopher Harris <[EMAIL PROTECTED]> wrote: Just throwing this out there, but I recently created a tile index using gdaltindex. I did not get the white lines you are talking about. It could be that there are gaps in between the tiles, which would point to the georefencing info for each tile being slightly off. Also, are you zoomed way out? Try zooming in close and see if they are still there. The tile-indexed image I have is huge (2602 X 2800), so it looks funny when zoomed all the way out when trying to view the entire image - still no lines though. Also, try using a .gif or .png instead of a .jpg and see what happens. Just some suggestions. That's all I really have. I'm just another Mapserver user - not an admin. - Chris Date: Mon, 1 Oct 2007 16:50:46 +0200 From: [EMAIL PROTECTED] Subject: [UMN_MAPSERVER-USERS] Weidr Output image with the esri tile index file -- GDALTINDEX To: [email protected] HI guys, I've created a tile index file with the GDALTINDEX utility for my small raster jpeg images, all things work well, but the end output jpeg image with MapServer is a little weird, there are some white grid lines on the output image. I don't know if there are some blank areas between the tile images when creating the tile index file, or the tile index grid are drawn by MapServer on the output jpeg image. attached is a small example output jpeg image. any clues are welcome. Best Regards Zhongahi Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it! _________________________________________________________________ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
