0

I am trying to plug in a projection name to my code, but I think the syntax/name is incorrect.

 arcpy.env.outputCoordinateSystem = arcpy.SpatialReference("US Albers Equal Area Conic")

When I run the above it throws:

RuntimeError: ERROR 999999: Error executing function. the input is not a geographic or projected coordinate system.

I cannot seem to find documentation on how the projection/coordinate system names should be given when using as parameters for arcpy.

Any suggestions?

  • 2
    I think the easiest it to use an existing fc or by providing the epsg code arcpy.SpatialReference(8075), dont know if it is the correct one. If you want to use name you can check it with: arcpy.SpatialReference(8075).name – BERA Nov 13 '18 at 18:32
  • 2
    When you run this code snippet what error does it give? – PolyGeo Nov 13 '18 at 19:24
  • When I ran that it threw: RuntimeError: ERROR 999999: Error executing function. the input is not a geographic or projected coordinate system. – gwydion93 Nov 13 '18 at 19:34
  • It appears that is not a viable EPSG factoryCode. 102008 is the correct one. So, arcpy.SpatialReference(102008).name returns 'North_America_Albers_Equal_Area_Conic'. But I am still not sure if I need to use that or "North America Albers Equal Area Conic". – gwydion93 Nov 13 '18 at 19:52
  • There are an infinite number of potential Albers Equal Area projections. If you want a specific one, you need to specify it, via file name, integer code, or well known string. Even "USA_Contiguous_Albers_Equal_Area_Conic" isn't unique at 10.4.1, because there's also "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version". Using integer codes is a whole lot more straight forward (102003 or 102039). – Vince Nov 13 '18 at 20:57
1

As commented by @Vince:

There are an infinite number of potential Albers Equal Area projections. If you want a specific one, you need to specify it, via file name, integer code, or well known string. Even "USA_Contiguous_Albers_Equal_Area_Conic" isn't unique at 10.4.1, because there's also "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version". Using integer codes is a whole lot more straight forward (102003 or 102039).

so, based on your comment that:

102008 is the correct one

I think you should use:

arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(102008)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.