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
Argument | Attribute | Description |
---|---|---|
x | Specifies the east-west position on the Earth’s surface expressed in degrees. | |
y | Specifies the north-south position on the Earth’s surface expressed in degrees. | |
z | optional | Represents the height or depth of the point relative to sea level. |
m | optional | Can be used to store additional information about the point, such as a time stamp, temperature, or other relevant data. |
srid | optional | Determines the spatial reference system used for the geographic coordinates. The default system used is WGS 84, which is denoted by the SRID 4326. |
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.
Related articles
Learn more about GeometryPoint.From in the following articles:
- Power Query Geography And Geometry Functions In Power BI And Excel
The article delves into Power Query functions for handling geographic and geometric data in Power BI and Excel, offering practical examples of their use in converting and managing Well Known Text format. » Read more - Working with Geospatial Data in Power BI
The article provides a guide on using geospatial data in Power BI, including converting geospatial data for use in visualizations, extracting longitude and latitude from WKT data, and employing the icon-map visualization to render complex geospatial shapes. It covers the essentials from converting data types to extracting coordinates and using custom visuals for enhanced mapping capabilities. » Read more
Related functions
Other functions related to GeometryPoint.From are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy