Output Coordinate System breaks clipping

938
8
Jump to solution
08-23-2021 07:03 PM
IanHamilton2
New Contributor III

I have a working Arc Pro python script in a toolbox which works just fine.

I would now like to set the outputcoordinatesystem to project (and eventually transform) my clipping output.

Whenever I set my env outputcordinatesystem to something, I get no features output. No errors from the clipping process, feature classes created, but no features. All input data is GDA94 Lat, Long (4238). The clipping polygon is created from a map extent, the map and clipping polygon are both in 4238 

e.g. arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(28356)  #this is GDA94 MGA56

I have tried various outputcoordinatesystems - same result

I have just tried setting the outputcoordinatesystem to 4238  - the same as the input and everything works fine!

 

I am at a bit of a loss. I thought this would be a one line change.

 

Any help would be appreciated,

Ian Hamilton

0 Kudos
1 Solution

Accepted Solutions
IanHamilton2
New Contributor III

Sorry for the delayed response. I tried the memory method but unfortunately it is not possible project from a memory dataset to a physical one in a gdb. Only ESRI knows why.

I have created a temp feature class then projected it and deleted it.

The initial error when I was experiencing when projecting was an extent issue. I should have been using the camera to get the extent of the map frame.

 

View solution in original post

0 Kudos
8 Replies
DanPatterson
MVP Esteemed Contributor

is a transformation required as well?

Output Coordinate System (Environment setting)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
IanHamilton2
New Contributor III

Hi Dan, I don't think in this case as  the datum is GDA94 for both the input data and the projected. I did try putting in "" or   []  for the transformation and that broke it completely.

0 Kudos
IanHamilton2
New Contributor III

Could it be an extent issue? should I be setting an extent suitable for the output coordinate system?

0 Kudos
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Try using Project method on the clipped results and skip setting the outputCoordinateSystem.

project 

0 Kudos
IanHamilton2
New Contributor III

I can certainly do that. Though I was hoping to to have so much clean up after at then end of the script.

Is there someone I can raise this with to see if there is a related bug. I thought this would be a one line change to my code.

0 Kudos
JeffK
by MVP Regular Contributor
MVP Regular Contributor

You can also share the code and it could be something else that is causing it to fail. 

One way to keep things clean(er) is to use the memory workspace.  Output the clip results to it and then project it from there.  At the end of the script the memory workspace (and any temp geoprocessing results written to it) is garbage collected. 

There are links in the documentation  ("Feedback on this topic") at the bottom to send feedback to ESRI.

0 Kudos
IanHamilton2
New Contributor III

Thanks for that Jeff, I had thought that was only for ArcMap. I shall give. It a go.

0 Kudos
IanHamilton2
New Contributor III

Sorry for the delayed response. I tried the memory method but unfortunately it is not possible project from a memory dataset to a physical one in a gdb. Only ESRI knows why.

I have created a temp feature class then projected it and deleted it.

The initial error when I was experiencing when projecting was an extent issue. I should have been using the camera to get the extent of the map frame.

 

0 Kudos