Select to view content in your preferred language

arcpy.SmoothPolygon_cartography not working as expected

1393
6
Jump to solution
11-21-2018 04:53 PM
ChengCheng
Emerging Contributor

Hi guys, 

I'm having some troubles with smoothing polygons in arcpy. It works well in ArcMap with exactly the same settings but when I use "arcpy.SmoothPolygon_cartography", the polygons are not smoothed, as shown in the images below:

Original:

Result from arcpy:

Result from ArcMap:

I have attached my code, the original shapefile, the result from ArcMap, and the result from arcpy below. The result from ArcMap is exactly what I want but as I have over 1000 shapefiles to process it's not practical to do it manually in ArcMap. 

Also I found this bug: BUG-000117346: The Smooth Polygon tool does not smooth the polygons.. 

However, I was using the PEAK method. 

Any help would be much appreciated. 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

I couldn't find the polygon that you were using for your example.  What is the 90 meters tolerance relative to an example polygon perimeter?  Maybe it is too coarse, even if it was fine in ArcMap, I know some parameters have changed in ArcGIS Pro Smooth Polygon—ArcGIS Pro | ArcGIS Desktop 

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

Your coordinates are in decimal degrees and you need to specify smoothing tolerance value for the paek method... what did you specify?

I also got this warning

 WARNING 000269: The cartographic spatial reference does not have a projected coordinate system

which makes sense because if you are trying to smooth with a planar (aka meters/feet) it won't do any smoothing if you chose too large a value

0 Kudos
ChengCheng
Emerging Contributor

Hi Dan, 

This is what I specified in the code:

arcpy.SmoothPolygon_cartography(in_features=filename, out_feature_class=output,
algorithm="PAEK", tolerance="90 Meters", endpoint_option="NO_FIXED", error_option="NO_CHECK")

The tolerance is set to be 90 meters, the same value used in the ArcMap. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

I couldn't find the polygon that you were using for your example.  What is the 90 meters tolerance relative to an example polygon perimeter?  Maybe it is too coarse, even if it was fine in ArcMap, I know some parameters have changed in ArcGIS Pro Smooth Polygon—ArcGIS Pro | ArcGIS Desktop 

ChengCheng
Emerging Contributor

Hi Dan, 

Yes!!! That's exactly where the problem is. The endpoint_option and the error_option are no longer used in ArcGIS Pro. It works perfectly when I use the arcpy in the ArcMap 10.5 package instead. Thank you for pointing that out! It helps a lot!

Cheers, 

Cheng 

0 Kudos
DanPatterson_Retired
MVP Emeritus

Glad it worked out

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

If someone's reply answers your question, or was the most helpful in answering your question, please mark it Correct to close the question out.

0 Kudos