AnsweredAssumed Answered

arcpy.Warp_management not performing as expected

Question asked by leftieant76 on Jul 3, 2016
Latest reply on Jul 4, 2016 by leftieant76

Hi - I'm unsure whether this is a Python question or a geoprocessing question. I'll post it here and see how we go.

I am trying to use the 'warp' function in a rather novel way. I have a heap of (~800) individual QR codes, which I'd like to georeference so that they can be displayed as map features.

The QR codes are all the same size and I can use the same reference points, whereas the location to georeference the features 'to' (ie where I want them to sit on the map) will change from code to code. This location is determined by the location of a given point.

I've cobbled together a script to iterate through the codes, and the script runs correctly, but the output features aren't georeferenced at all.

I've also tried georeferencing a single feature via the Toolbox, but that doesn't perform as expected either.

The script (snippet of) I'm using is below:

 

ls_inputs = os.listdir(ws_inputs)

for i in ls_inputs:

    if i[0:-4] in dict_mapcentroid:

        print "Working on", i

        input = os.path.join(ws_inputs, i)

        cent_x = dict_mapcentroid[i[0:-4]][0]

        cent_y = dict_mapcentroid[i[0:-4]][1]

        target_pt = "'11.5 -158.5';'158.5 -11.5'"

        source_pt = "'%s %s';'%s %s'" % (cent_x - 1750, cent_y - 1750, cent_x + 1750, cent_y + 1750)

        output = os.path.join(ws_outputs, "georef_%s" % i)

        arcpy.Warp_management(input, source_pt, target_pt, output, "POLYORDER1")

    else:

        print "Fail on", i

(dict_mapcentroid refers to a dictionary with the feature name as key, and the coordinates of the centroid as a [x,y] list)

(the reference points are bottom left and top right, the +/- 1750 allow for the scaling of the feature to appear 3 x 3cm at 1:250K)

 

Can anyone shed any light on why this wouldn't be working - or am I simply trying to use a tool in a manner in which it was not intended?

 

Thanks

Outcomes