Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KNO
Helper I
Helper I

How to extract latitudes and longitude?

Hi, 

 

This is proberply a simple quest, but how would to extract coordinates that reside in the same column?

Udklip.PNG

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@KNO 

I created a sample:

Fowmy_0-1622977096643.png


You can paste the code given below on a new blank query in the advanced editor and check the steps.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdC7CoAwDIXhd+lcQm+J7Vu4i7OL6OzbmyEROboVfr4eyLKE+dyv7TxCDIMy18KizxTW+E4s1IWl/qRBJZnKqCYSU5hU+VZB1amZwjSo+lZFpT+awqTKtxokSZRMYRrUfIu/yq+BSZVvCar8XEPTegM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [geometry.type = _t, geometry.coordinates = _t, Indeks = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"geometry.type", type text}, {"geometry.coordinates", type number}, {"Indeks", Int64.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Inserted Modulo" = Table.AddColumn(#"Added Index", "Modulo", each Number.Mod([Index], 2), type number),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Modulo",{"Index"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Modulo", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Modulo", type text}}, "en-US")[Modulo]), "Modulo", "geometry.coordinates"),
    #"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"1", "Lat"}, {"0", "Log"}})
in
    #"Renamed Columns"

 

Result:

Fowmy_3-1622977232228.png

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@KNO 

I created a sample:

Fowmy_0-1622977096643.png


You can paste the code given below on a new blank query in the advanced editor and check the steps.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdC7CoAwDIXhd+lcQm+J7Vu4i7OL6OzbmyEROboVfr4eyLKE+dyv7TxCDIMy18KizxTW+E4s1IWl/qRBJZnKqCYSU5hU+VZB1amZwjSo+lZFpT+awqTKtxokSZRMYRrUfIu/yq+BSZVvCar8XEPTegM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [geometry.type = _t, geometry.coordinates = _t, Indeks = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"geometry.type", type text}, {"geometry.coordinates", type number}, {"Indeks", Int64.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Inserted Modulo" = Table.AddColumn(#"Added Index", "Modulo", each Number.Mod([Index], 2), type number),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Modulo",{"Index"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Modulo", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Modulo", type text}}, "en-US")[Modulo]), "Modulo", "geometry.coordinates"),
    #"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"1", "Lat"}, {"0", "Log"}})
in
    #"Renamed Columns"

 

Result:

Fowmy_3-1622977232228.png

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors