arcpy.env.outputCoordinateSystem = "Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 18N.prj" Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 515, in set_ self[env] = val File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 567, in __setitem__ ret_ = setattr(self._gp, item, value) RuntimeError: Object: Error in accessing environment <outputCoordinateSystem>Am I totally missing something?
outCS = os.path.join(installDir,r"Coordinate Systems\Projected Coordinate Systems\National Grids\Canada\NAD 1983 CSRS UTM Zone 12N.prj") inCS = os.path.join(installDir,r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj") arcpy.Project_management(in_fc, out_feature, outCS, transform_method, inCS)
inCS = arcpy.SpatialReference() inCS.factoryCode = some_code1 inCS.create() outCS = arcpy.SpatialReference() outCS.factoryCode = some_code2 outCS.create() arcpy.Project_management(in_fc, out_feature, outCS, transform_method, inCS)
>>> arcpy.env.outputCoordinateSystem = r"C:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\State Plane\NAD 1983 HARN (US Feet)\NAD 1983 HARN StatePlane Washington South FIPS 4602 (US Feet).prj" >>> arcpy.env.outputCoordinateSystem.factoryCode 2927
arcpy.env.outputCoordinateSystem = 2927 #WA_SPS_NAD83HARN_USFEET
>>> arcpy.env.outputCoordinateSystem = arcpy.SpatialReference('NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet')Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 505, in set_ self[env] = val File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 557, in __setitem__ ret_ = setattr(self._gp, item, value) RuntimeError: <unprintable RuntimeError object>
>>> srList = arcpy.ListSpatialReferences("*washington*south*", "PCS") >>> for sr in srList: ... print sr Projected Coordinate Systems/State Plane/NAD 1927 (US Feet)/NAD 1927 StatePlane Washington South FIPS 4602 Projected Coordinate Systems/State Plane/NAD 1983 (CORS96) (Meters)/NAD 1983 (CORS96) StatePlane Washington South FIPS 4602 (Meters) Projected Coordinate Systems/State Plane/NAD 1983 (CORS96) (US Feet)/NAD 1983 (CORS96) StatePlane Washington South FIPS 4602 (US Feet) Projected Coordinate Systems/State Plane/NAD 1983 (Meters)/NAD 1983 StatePlane Washington South FIPS 4602 (Meters) Projected Coordinate Systems/State Plane/NAD 1983 (US Feet)/NAD 1983 StatePlane Washington South FIPS 4602 (US Feet) Projected Coordinate Systems/State Plane/NAD 1983 HARN (Meters)/NAD 1983 HARN StatePlane Washington South FIPS 4602 (Meters) Projected Coordinate Systems/State Plane/NAD 1983 HARN (US Feet)/NAD 1983 HARN StatePlane Washington South FIPS 4602 (US Feet) Projected Coordinate Systems/State Plane/NAD 1983 NSRS2007 (Meters)/NAD 1983 NSRS2007 StatePlane Washington South FIPS 4602 (Meters) Projected Coordinate Systems/State Plane/NAD 1983 NSRS2007 (US Feet)/NAD 1983 NSRS2007 StatePlane Washington South FIPS 4602 (US Feet) >>> arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(srList[6]) >>>
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference('NAD 1983 HARN StatePlane Washington South FIPS 4602 (US Feet)')
The old directory system of *.prj files worked and was quite flexible. ie It was easy to create a new prj for a particular project, say a custom crafted UTM like system (ie with a non-standard central meridian). Now what do you do?
It was also useful to browse the directories when searching for obscure projection info for certain regions.
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference('NAD 1983 HARN StatePlane Washington South FIPS 4602 (US Feet)')and this DOES NOT work:
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference('NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet')Perhaps my projection (WA SPS NAD83HARN USFEET) is the exception here, but it would be nice to have a SR property that would yield the correct sr token keyword.