Select to view content in your preferred language

Arcpy Export PNG shift result

1386
4
09-25-2016 01:20 AM
DEVAPP
by
Occasional Contributor

Hi at all,

on my python script i set the Coordinate System for Data Frame of mxd and after a Zoom To function on firsy layer into list i export mxd as PNG.

This is my code:

mxd = arcpy.mapping.MapDocument('current')
        df = arcpy.mapping.ListDataFrames(mxd)[0]
        df.spatialReference = prjFile
        add_layer = arcpy.mapping.Layer("costumers_" +str(j)+".tif")
        arcpy.mapping.AddLayer(df, add_layer, "TOP")
        reclass_raster_lyr = arcpy.mapping.ListLayers(mxd)[0]

        arcpy.ApplySymbologyFromLayer_management(reclass_raster_lyr, Temp_Symbology)
        if reclass_raster_lyr.symbologyType == "RASTER_CLASSIFIED":
            reclass_raster_lyr.symbology.excludedValues = excludedValues
            reclass_raster_lyr.symbology.reclassify()

        lyrPolygonj = arcpy.mapping.Layer("customerlyr"+str(j))
        df.extent = lyrPolygonj.getSelectedExtent()
        lyrPolygonj.visible = False

        strAux = listRow.split(" ")[1::]
        strOutput = date + " " + " ".join(x for x in strAux) + ".tif"
        world_file = True
        arcpy.mapping.ExportToPNG(mxd, strOutput,df, 10199, 7688,820,world_file = world_file, background_color = "255,255,255",transparent_color = "255,255,255")

but when i run this script on ArcMap 10.2 the result is correct.

When i run on ArcMap 10.1 the png result is not correct, i mean that if i add it into map this png have a shift respect the position of original file into mxd.

I have try to execute manually the export png into arcmap 10.1 and the result is correct.

So why in my script on 10.1 the result is shift?

Thanks

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

this could have been the result of an issue identify between versions.  You would have to examine the "Issues Addressed" or similar in the older help topics.

ArcGIS Help (10.2, 10.2.1, and 10.2.2) 

ArcGIS Help 10.1 

0 Kudos
DEVAPP
by
Occasional Contributor

Hi Dan,

i have seen "Issues Addresses" but this function is same in the 2 version

0 Kudos
DanPatterson_Retired
MVP Emeritus

good... so if it wasn't a bug between the versions that was fixed in 10.2, then there is something wrong 10.1 environments

0 Kudos
DEVAPP
by
Occasional Contributor

What in your opinion?

I have seen that this error show after insert into script a project raster, so i can project wgs84 utm 36 n to wgs84 geographic.

I remenber that 10.1 have some bugs about project coordinate.....i'm wrong?

0 Kudos