AnsweredAssumed Answered

Issues in projection while defining data frame extent by coordinates

Question asked by bauman312 on Feb 5, 2015
Latest reply on Mar 1, 2015 by bixb0012

I'm trying to set the following coordinates to a dataframe:

 

 

    custom_extent = {1:-87.678956, 2: -87.611652, 3:41.867129, 4:41.954932}

 

 

where `1` is key for `XMin`, `2` is key for `XMax`, `3` is key for `YMin`, and `4` is key for `YMax`

 

 

However, when I try to set the new extent up, the coordinates are not the results I expect. Here's a code snippet:

 

 

            print data_frame.extent.XMin                                        # prints 480718.855003

            original_spatial_reference = data_frame.spatialReference

            newExtent = data_frame.extent

            data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")

            print data_frame.extent.XMin                                        # prints -87.6986700746

            newExtent.XMin, newExtent.XMax = custom_extent[1], custom_extent[2]

            newExtent.YMin, newExtent.YMax = custom_extent[3], custom_extent[4]

            data_frame.extent = newExtent                                    

            print data_frame.extent.XMin                                        # prints -93.500018925

            data_frame.spatialReference = original_spatial_reference

            print data_frame.extent.XMin                                        # prints -2.38749449402

 

 

Every printout does not match the desired `XMin`: `-87.678956`. Any thoughts?

Outcomes