Point¶
A Point represents a single coordinate in 2D or 3D space. It is the simplest geometry type, inheriting from GeometryObj.
Creating a Point¶
2D¶
3D¶
Accessors¶
x()¶
Returns the X coordinate.
y()¶
Returns the Y coordinate.
z()¶
Returns the Z coordinate. Returns NaN if the point has no Z dimension (i.e. it is 2D).
String representation¶
Full example¶
import nimgeos
var ctx = initGeosContext()
# 2D point
let p = ctx.createPoint(12.34, 56.78)
echo "X: ", p.x() # 12.34
echo "Y: ", p.y() # 56.78
echo "Z: ", p.z() # NaN
echo p # Point (12.34 56.78)
# 3D point
let p3d = ctx.createPoint(1.0, 2.0, 3.0)
echo "X: ", p3d.x() # 1.0
echo "Y: ", p3d.y() # 2.0
echo "Z: ", p3d.z() # 3.0
echo p3d # Point (1.0 2.0 3.0)