Select to view content in your preferred language

How to load a directory of rasters into a geodatabase using Python?

4181
12
Jump to solution
11-15-2016 04:50 PM
DaveBranson
Deactivated User

I am trying to use Python in ArcGIS 10.4 to load a directory of JP2 images into a raster catalog.

I can load individual files but can figure out how to load all of the file at the same time.

this will load individual files ....

>>> import arcpy
>>> from arcpy import env
>>> env.workspace = "d:/data"

>>> arcpy.RasterToGeodatabase_conversion("Image1.jp2;Image2.jp2","d:/data/Database.gdb/Orthos")

I tried creating a list of the rasters with arcpy.ListRasters and replace the Input_Rasters with the list name and this works if there is only one item in the list.

Txs.

12 Replies
ModyBuchbinder
Esri Regular Contributor

I think all this should be in the Python area...

The first question is why do you want to put your images "in" the FGDB. It just make them bigger.

I think you want to build a Mosaic Dataset inside the FGDB that point to the rasters on disk and look like one raster in ArcMap.

Check this: What is a mosaic dataset?—Help | ArcGIS for Desktop 

Have fun

Mody

RebeccaStrauch__GISP
MVP Emeritus

I agree, that is a better option.

0 Kudos
NeilAyres
MVP Alum

Definitely. The current esri "Pattern" is to leave rasters in whatever format you got them in. Then create a mosaic dataset referencing the original images.