I need to know if an arcpy geometry object has z values. I have tried without success to use the has_z attribute, since to create them you must use and I have also tried to verify if the first point of the entity has a z of None: , however I do not like this last solution since it does not seem very robust and I think there could be cases in which the first point coincidentally has a z that is None even though the entity has 3D values. How can I check if an object has z values?

  • We're a little different from other sites. We're a Q&A site, not a discussion forum. For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely.
    – PolyGeo
    Sep 13, 2021 at 0:29
  • Can you share a sample of data where you actually have NaN for a Z value within a polyline? I can't create such a dataset, If I try to insert None of NaN for a Z value for a polyline it turns it into a zero. What data format are you generating such data from?
    – Hornbydd
    Sep 13, 2021 at 13:39

1 Answer 1


I tested 3 lines: 2D, 3D with values and 3D with z values set to NULL. Espression


returned NULL for 2D line only:

enter image description here

So, it's Ok to use z value from first point.

  • Hi @FelixIP, I was interested in answering this question and have seen your response above. I tried to spoof up a test featureclass with polylines that had some Z values that were NaN. I can't reset existing Z values or create a polyline in ArcMap or ArcPro where a Z value is NaN, it always resets to zero. So how did you create your LINE_3D_NULLS layer to have polylines where 1 or more Z values are NaN and not zero? Step 4 here does not happen for me, it always goes to zero.
    – Hornbydd
    Sep 12, 2021 at 18:55
  • @Horbydd this is my point, no NULL values , it refers them to zero. I used feature to 3d by attribute and pointed to 2 fields with Nulls as from and to Z.
    – FelixIP
    Sep 12, 2021 at 19:16
  • First I tried has_z (property?) and also failed. Help system can be very misleading:(
    – FelixIP
    Sep 12, 2021 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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