Output extent blowout from warp from file

1149
4
11-14-2016 01:34 AM
JM5
by
New Contributor

Hi

I want to register a set of images (epsg4326) to a projected reference image epsg32755.  I have already tried Reproject in ArcMap 10.4, but the features do not line up well, so I think a Warp will be needed.  As there is a set of files, I wanted to use python to process them.

I have 21 gcp pairs for the files, saved to a text file from the Georeferencing tool.  Example of the python script given below.

The warp does seem to work OK in aligning the features, but my columns and rows blow out from the original 680, 765 to a massive 19615, 30096, i.e. the result image contains a lot of no data pixels.

I've tried changing the transformation, setting extent, but can not figure out how to fix the problem.

Any suggestions?

Thanks

#--------------------------------------------------------------

def warp_file(inFile,outFile,GCPfile):

    print "\nStarting process"

    try:

        # layer extent taken from T3 p030 image
        #arcpy.env.extent = arcpy.Extent(145.5059494, -17.0246642, 145.6570454, -17.1946472)

        arcpy.env.extent = arcpy.Extent(341121.25, 8117106.25, 357061.25, 8098416.25)

        arcpy.WarpFromFile_management(inFile,outFile,GCPfile,"POLYORDER2","NEAREST")

##        arcpy.Warp_management(inFile,outFile,GCPfile,"POLYORDER3","NEAREST")        

    except Exception as e:
        print "Unknown Error {0}".format(str(e))

    return

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

You need to define the extent and cell size in the Environments.  Is suspect that the cell size defaulted to 1.  The extent needs to be the new extent that you want

Warp From File—Help | ArcGIS for Desktop 

it is in the fine print

0 Kudos
JM5
by
New Contributor

Thanks for your suggestion Dan.  I've tried adding the cell size.  There is still some issue.  I will recheck the other parameters.

0 Kudos
NeilAyres
MVP Alum

You said...

"I want to register a set of images (epsg4326)"

That's GCS_WGS84. Firstly, you should always try to geo-reference a map / image into the coordinate system it is actually IN. So, why are you not geo-referencing these directly into Lat/Long.

And, are you actually sure that the imagery is in fact in this coordinate system?

You also seem to have the extent well established (to 8 decimals)? So, are these images already geo-referenced?

If so, you just need to Project_management to UTM.

And both sides are WGS84 based so you should not need any transformation.

0 Kudos
NeilAyres
MVP Alum

If the imagery has got a meaningful extent, which it seems to have, but no spatial referencing information, then it probably has a world file, but the spatial reference is not set. So simply define it.

0 Kudos