SHAPELY_POINT
Creates a 2D point geometry from numeric x and y coordinates.
A point is a zero-dimensional geometry represented as:
P = (x, y)
The function returns an Excel data type with the point WKT as the primary value and coordinate properties for direct access.
Excel Usage
=SHAPELY_POINT(x, y)
x(float, required): X coordinate.y(float, required): Y coordinate.
Returns (dict): Excel Entity representing the point (WKT).
Example 1: Basic Point
Inputs:
| x | y |
|---|---|
| 10 | 20 |
Excel formula:
=SHAPELY_POINT(10, 20)
Expected output:
{"type":"String","basicValue":"POINT (10 20)","properties":{"X":{"type":"Double","basicValue":10},"Y":{"type":"Double","basicValue":20},"WKT":{"type":"String","basicValue":"POINT (10 20)"}}}
Example 2: Floating Point Coordinates
Inputs:
| x | y |
|---|---|
| 1.5 | -3.2 |
Excel formula:
=SHAPELY_POINT(1.5, -3.2)
Expected output:
{"type":"String","basicValue":"POINT (1.5 -3.2)","properties":{"X":{"type":"Double","basicValue":1.5},"Y":{"type":"Double","basicValue":-3.2},"WKT":{"type":"String","basicValue":"POINT (1.5 -3.2)"}}}
Example 3: Point at the origin
Inputs:
| x | y |
|---|---|
| 0 | 0 |
Excel formula:
=SHAPELY_POINT(0, 0)
Expected output:
{"type":"String","basicValue":"POINT (0 0)","properties":{"X":{"type":"Double","basicValue":0},"Y":{"type":"Double","basicValue":0},"WKT":{"type":"String","basicValue":"POINT (0 0)"}}}
Example 4: Point with negative coordinates
Inputs:
| x | y |
|---|---|
| -12.75 | -4.25 |
Excel formula:
=SHAPELY_POINT(-12.75, -4.25)
Expected output:
{"type":"String","basicValue":"POINT (-12.75 -4.25)","properties":{"X":{"type":"Double","basicValue":-12.75},"Y":{"type":"Double","basicValue":-4.25},"WKT":{"type":"String","basicValue":"POINT (-12.75 -4.25)"}}}
Python Code
from shapely import Point
def shapely_point(x, y):
"""
Create a geometric point.
See: https://shapely.readthedocs.io/en/stable/reference/shapely.Point.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): X coordinate.
y (float): Y coordinate.
Returns:
dict: Excel Entity representing the point (WKT).
"""
try:
pt = Point(x, y)
wkt_str = pt.wkt
return {
"type": "String",
"basicValue": wkt_str,
"properties": {
"X": {"type": "Double", "basicValue": float(x)},
"Y": {"type": "Double", "basicValue": float(y)},
"WKT": {"type": "String", "basicValue": wkt_str}
}
}
except Exception as e:
return f"Error: {str(e)}"