Does RasterToPolygon not honour environmental settings?

456
1
05-03-2021 07:02 AM
TomGeo
by
Occasional Contributor III

I am running in some strange problems in ArcGIS Pro 2.7.2. Within a notebook  I started to define some environmental settings, setting addOutputsToMap to false and overwriteOutput to true, and I specify the outputCoordinateSystem via

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

I retrieve an iterator containing the path of a number of tif files and iterate over it.

Within the iteration I utilize RasterToPolygon

arcpy.conversion.RasterToPolygon(tif,out_fc,simplify="NO_SIMPLIFY",raster_field="Value")

Even though I set outputOverwrite = True I am getting ERROR 000528: Output Path/to/File already exists from RasterToPolygon. Does not happen all the time, but from time to time.

The other problem is the coordinate system defined for the notebook. In case I leave the environmental attribute addOutputsToMap at the default value I get the immediate response while running the RasterToPolygon cell. The feature classes created by the tool are missing the spatial reference!

I checked... all tif files are in EPSG 25832, the feature dataset I am writing the feature classes into is defined in EPSG 25832, and the notebook defines the coordinate system to EPSG 25832.

I was also running the RasterToPolygon in an with-statement, utilizing EnvManger... to no avail.

 

I wonder where RasterToPolygon drops the coordinate system.
In case it's not meant to honour neither environmental settings, nor inherit spatial references from input files then I wonder why there is no parameter, offering the possibility  to define the output coordinate system for the method.

 

The Python used here is in version 3.7.9 and I did not clone the environment... it's the default.

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

From...

Raster to Polygon (Conversion)—ArcGIS Pro | Documentation

these are the environment parameters that are supported

Auto Commit, Current Workspace, Default Output Z Value, Extent, Geographic Transformations, M Resolution, M Tolerance, Maintain Spatial Index, Output CONFIG Keyword, Output Coordinate System, Output has M values, Output has Z values, Output M Domain, Output XY Domain, Output Z Domain, Scratch Workspace, Snap Raster, XY Resolution, XY Tolerance, Z Resolution, Z Tolerance


... sort of retired...