I have hundreds of old aerial photographs in JPG format and a separate dbf file containing xmin, ymin, xmax, ymax. So far I have been unable to associate these geo-reference to the respective image.

1695
15
06-27-2017 03:55 AM
MohammedHaq
New Contributor II

I have hundreds of old aerial photographs in JPG format and a separate dbf file containg xmin, ymin, xmax, ymax. So far I have been unable to associate these geo-reference  to the respective image. Any suggestions on how to add this to the image would be greatly appreciated. Thank you.

0 Kudos
15 Replies
GünterDörffel
Occasional Contributor III

Hi Mohammed,

that should be fairly easy. See the documentation on former raster catalogs here. All you have to do is add another column for the file path of each image - load it as a raster catalog and then please load the raster catalog into a MosaicDataset!

Regards
Guenter

curtvprice
MVP Esteemed Contributor

Günter Dörffel are you sure this would work? I am not sure the bounding box will be used except for selecting images and drawing the catalog wireframe.

Mohammed Haq Unfortunately there is no tool that can batch-generate the world file from your corner points, but you could build a Python script that could do this by calculating the six numbers needed in the world file and writing them to a file named the same as the raster with a .jgw extension. I am assuming your corner coordinates are center-of-cell. You could even do this in Model Builder using the code below in a Calculate Value python function.

If you just had a few images, I'd recommend using the georeferencing toolbar to set up your transformation, but if you have hundreds of images, you're going to need to do something like the script below.

Your extents and dbf table can give you the world file parameters with some easy arithmetic in Python.

import os

jpeg_file = "filename.jpg"
x0, y0, x1, y1 = 99,99,99,99 # values from your dbf file 

ncols = arcpy.Describe(jpeg_file).width # number of cells wide
wfile = os.path.splitext(jpeg_file)[0] + ".jgw")
xyscale = (x1 - x0) / ncols # scale pixels to xy units
# x0, y1 is center of upper left pixel
world =[xyscale, 0, 0, -1 * xyscale, x0, y1]
with open(wfile, "w") as f:
    for w in world:
        f.write("{:.3f}\n".format(w))‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Fundamentals of georeferencing a raster dataset—Help | ArcGIS for Desktop 

World files for raster datasets—Help | ArcGIS for Desktop 

GünterDörffel
Occasional Contributor III

Hi Curtis,

yes, it would/will work. Thats the old form of a raster catalog and it basically does a projective transformation. No wonders to expect - usually used when tiled data was present. It can then be used but abilities are limited. If world files are present or you manage to generate them (and know the coordinate system) your way will immediately allow to load the data into a Mosaic - sounds good!

Regards Guenter

0 Kudos
curtvprice
MVP Esteemed Contributor

That IS a lot easier! Nothing like "the old way to do it" sometimes. 

I miss the little things like the Arc LLSFIT command, RESELECT with KEYFILE, INFO ALTER.

MohammedHaq
New Contributor II

Thank you guys for kind suggestions. I am trying to follow the Guenter suggestion first then to Curtis (i.e. I am not good at python..) as ultimately dataset will be saved in SDE as a mosaic.

Guenter your suggestion is straight forward. My .dbf (it already has the raster file path) file is displaying as wire frame in arcmap but struggling to load it as a raster catalog and view the raster itself!!

0 Kudos
CodyBenkelman
Esri Regular Contributor
0 Kudos
MohammedHaq
New Contributor II

Hi Cody,

Thank you. But there is nothing in the page!

Mohammed

0 Kudos
CodyBenkelman
Esri Regular Contributor

Sorry, I am not sure what is wrong.  Can you see this item in ArcGIS Online?

http://www.arcgis.com/home/item.html?id=d1b4e3afeda7405fb34578207f0ad256  

Cody B

GünterDörffel
Occasional Contributor III

If it shows as a wire-frame, it used to already have loaded successfully. Previously there were several reasons you did not see the data (in order of likeliness 🙂

  • You had to zoom in: By default a raster catalog will not show more than 9 images - so if your extent is too big, you wont see anything
  • The path to your data was not correct?
    (Right-click in TOC and use "Repair datasource")
  • The projection of the data frame was not the same as the coordinates of the data.

BUT BUT BUT

I just created dataset and added to ArcMap (we are taling ArcMap, right?) - data looks like this:

TOC with data (zoomed out a lot) looks like this:

Zooming in further displays wireframe with Raster-Names displayed ...

Open the properties of the layer in TOC (right-click) allows you to change the number of rasters displayed ...

 

 
BUT BUT BUT  - also with my ArcMap 10.5.1 (distributor pre-copy) the Catalog will not display. So I guess we came across something here. Cody - can you check???

I still think for your workflow a maybe slightly extended/modified table should do. There is the table raster type. I think I had a python script somewhere to extend your type of table to the one requested there. Let me check within the next days. 

Regards Guenter 

0 Kudos