GeographyPoint.From

Updated on

GeographyPoint.From is a Power Query M function that creates a record representing a geographic point from its constituent parts, such as longitude, latitude, and optional elevation (Z) and measure (M). The function returns the geographic point record.

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

Syntax

GeographyPoint.From(
   longitude as number,
   latitude as number,
   optional z as nullable number,
   optional m as nullable number,
   optional srid as nullable number,
) as record
ArgumentAttributeDescription
longitudeSpecifies the east-west position on the Earth’s surface expressed in degrees.
latitudeSpecifies the north-south position on the Earth’s surface expressed in degrees.
zoptionalRepresents the height or depth of the point relative to sea level.
moptionalCan be used to store additional information about the point, such as a time stamp, temperature, or other relevant data.
sridoptionalDetermines the spatial reference system used for the geographic coordinates. The default system used is WGS 84, which is denoted by the SRID 4326.

Description

GeographyPoint.From assembles a record representing a geographic point using its individual components: longitude, latitude, and optionally, elevation (Z) and measure (M). You can also specify a Spatial Reference Identifier (SRID) to align with different geospatial reference systems, the default being SRID 4326.

The output of this function is a structured record in Power Query. This record includes fields for the provided longitude, latitude, optional elevation, and optional measure value.

Examples

To start with, let’s consider the creation of a simple geographic point. Geographic points are defined by two main components: longitude and latitude. Longitude refers to the east-west position on the Earth’s surface, while latitude refers to the north-south position.

Creating a Basic Geographic Point

For instance, to create a basic geographic point with a longitude of 4 and a latitude of 51, you would use the following code in Power Query:

// Output: [ Kind = "POINT", Longitude = 4, Latitude = 51 ]
GeographyPoint.From( 4, 51 )

The output of this function is a record that includes a Kind field, set to "POINT", and fields for both the Longitude and Latitude values. This record represents a specific location on the Earth’s surface. It’s helpful to use this function to provide data points to functions like Geography.ToWellKnownText.

Optional Parameter

The GeographyPoint.From function also allows for optional arguments, enabling the representation of more detailed geographic data. These optional arguments include elevation (denoted as Z), a measure value (M), and a Spatial Reference Identifier (SRID).

Elevation, measured in meters, adds a vertical dimension to the point, indicating how high above sea level the location is. The measure value (M) is a flexible parameter that can be used to store additional information relevant to the point, like a temperature reading or time stamp. The SRID specifies the spatial reference system used for the geographic coordinates; a common choice is WGS 84, represented by the SRID number 4326.

Consider the following example, which creates a more detailed geographic point in New York City:

// Output: [ Kind = "POINT", Longitude = -74.0060, Latitude = 40.7128, Z = 13.5, M = 10 ]
GeographyPoint.From(
   -74.0060,    // longitude
   40.7128,     // latitude
   13.5,        // elevation in meters
   10,          // measure value
   4326         // SRID for WGS 84
)

In this example, the function creates a geographic point representing a location in New York City. It includes an elevation of 13.5 meters above sea level and a measure value of 10, using the WGS 84 spatial reference system.

Using GeographyPoint.From with Optional Parameters in Power Query M

Learn more about GeographyPoint.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

Other functions related to GeographyPoint.From are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/geographypoint-from

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy