# GeometryPoint.From

Updated on

GeometryPoint.From is a Power Query M function that creates a record representing a geometric point from its constituent parts, such as X coordinate, Y coordinate, and optional Z coordinate and measure (M). The function returns the geometric point record.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

## Syntax

``````GeometryPoint.From(
x as number,
y as number,
optional z as nullable number,
optional m as nullable number,
optional srid as nullable number,
) as record``````

## Description

GeometryPoint.From constructs a record that delineates a geometric point from its basic coordinates: the X and Y values, and optionally, the Z (elevation) and M (measure) values. It also allows for the inclusion of an SRID to accommodate various spatial referencing systems, differing from the default SRID of 0.

The resulting output is a structured record that includes not only the `X` and `Y` coordinates but also the optional `Z` and `M` values, if provided.

## Examples

The `GeometryPoint.From` function helps creating geometric points. These points are primarily defined by two components: the `x` and `y` coordinates. Unlike geographic points that use longitude (east-west position) and latitude (north-south position), geometric points use `x` and `y` coordinates to represent positions in a plane, typically used in Cartesian coordinate systems.

### Creating a Basic Geographic Point

For example, to create a basic geometric point with an `x` coordinate of 4 and a `y` coordinate of 51 in Power Query, you would use the following code:

``````// Output: [ Kind = "POINT", X = 4, Y = 51 ]
GeometryPoint.From( 4, 51 )
``````

The output is a record that includes a `Kind` field, set to `"POINT"`, and fields for both the `X` and `Y` values. This structured record represents a specific point in a two-dimensional space, which is used for analysis involving spatial geometry. This function is particularly useful for feeding data into functions like Geometry.ToWellKnownText

### Optional Parameter

The `GeometryPoint.From` function also supports optional parameters to enrich the detail of the geometric data. These include elevation (`Z`), a measure value (`M`), and a Spatial Reference Identifier (SRID).

Elevation, when used, represents the height or depth of the point and is measured in meters. The measure value (`M`) offers flexibility to include additional information pertinent to the point, like a weight or a specific measurement. The SRID parameter defines the spatial reference system for the point, with a common system being WGS 84, denoted by SRID 4326.

Let’s look at a more complex example, creating a geometric point with additional details:

``````/* Output:
[ Kind = "POINT", X = -74.0060, Y = 40.7128, Z = 13.5, M = 10, SRID = 4326 ]
*/
GeometryPoint.From(
-74.0060,    // x coordinate
40.7128,     // y coordinate
13.5,        // elevation in meters
10,          // measure value
4326         // SRID for WGS 84
)``````

In this example, the function creates a geometric point representing a specific location, enriched with elevation and a measure value, all under the WGS 84 spatial reference system. This point could represent a location on a map or a point in a modeled space, adding depth and context to spatial analysis.