This is the current state of the Point and PointGeometry .... not the best....
pt2 = arcpy.Point()
pt2
<Point (0.0, 0.0, #, #)> # ---- make a point
pg2 = arcpy.PointGeometry(pt2) # ---- make a point geometry
pg2.WKT # ---- why does it have valid X, Y values????
'POINT (0 0)'
So there is no such thing as a 'null' point (but a 'nominal' point as one of our esteemed participants noted).
'None' isn't good enough. You can create an 'empty' geometry recognized by other representations with a little trickery.
import arcpy
n = np.nan
a = np.array([n, n, n, n])
pt = arcpy.Point()
pt.X, pt.Y, pt.Z, pt.M = a
pg = arcpy.PointGeometry(pt)
pg
<PointGeometry object at 0x200c6ed6ac8[0x200bf9a39e0]>
pg.WKT
'POINT EMPTY'
pt
<Point (nan, nan, nan, nan)>
And when you look at the PointGeometry, you decide which is best\.
# ---- by using NaN (not a number) for point properties ----
pt # <Point (nan, nan, nan, nan)>
pg = arcpy.PointGeometry(pt)
pg.JSON # '{"x":"NaN","y":"NaN","spatialReference":{"wkid":null}}'
pg.WKT # 'POINT EMPTY'
# ---- The current state of affairs ----
pt2 # <Point (0.0, 0.0, #, #)>
pg2 = arcpy.PointGeometry(pt2)
pg2.JSON # '{"x":0,"y":0,"spatialReference":{"wkid":null}}'
pg2.WKT # 'POINT (0 0)'
I should point out that you can use math.nan inplace of np.nan
m = math.nan
b = np.array([m, m, m, m])
pt3 = arcpy.Point()
pt3.X, pt3.Y, pt3.Z, pt3.M = b
pt3 # ---- <Point (nan, nan, nan, nan)>
pg3 = arcpy.PointGeometry(pt3)
pg3.JSON # ---- '{"x":"NaN","y":"NaN","spatialReference":{"wkid":null}}'
pg3.WKT # ---- 'POINT EMPTY'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.