GeographyPoint.From

GeographyPoint.From

D

The M Code Behind the Power Query M function GeographyPoint.From

What is the GeographyPoint.From function?

The GeographyPoint.From function is used to create a point in the geography data type, which represents a single location on the Earth’s surface. The function takes two arguments: latitude and longitude, both of which are decimal values. The function returns a geography data type that contains the specified latitude and longitude coordinates.

How does the GeographyPoint.From function work?

The M code behind the GeographyPoint.From function is relatively simple. Here is an example of the M code:


let

lat = 47.6062,

lon = -122.3321,

point = GeographyPoint.From(lat, lon)

in

point


In this example, we define the latitude and longitude coordinates as decimal values. We then use the GeographyPoint.From function to create a point in the geography data type. Finally, we return the point as the output of the M code.

The GeographyPoint.From function works by creating a new instance of the geography data type and setting the Latitude and Longitude properties to the specified values. The resulting geography data type can be used in other Power Query transformations, such as spatial joins or distance calculations.

What are some use cases for the GeographyPoint.From function?

The GeographyPoint.From function is useful in a variety of scenarios where latitude and longitude coordinates need to be converted into a geography data type. Here are a few examples:

- Mapping data: If you have a dataset that contains latitude and longitude coordinates, you can use the GeographyPoint.From function to create a geography data type that can be plotted on a map.

- Distance calculations: If you need to calculate the distance between two locations, you can use the GeographyPoint.From function to create geography data types for each location and then use the STDistance function to calculate the distance between them.

- Spatial joins: If you have two datasets that contain geography data types, you can use the GeographyPoint.From function to create geography data types for each dataset and then perform a spatial join to combine the datasets based on their location.

The GeographyPoint.From function is a powerful tool in Power Query that allows you to convert latitude and longitude coordinates into a geography data type. By understanding the M code behind the function, you can customize it to meet your specific needs and use it in a variety of scenarios.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: