Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello, I use this customed function to get the adress from my latitude and longitude using the BING API map.
But in the resourceSet, I get many results.
How can I get only the most accurate ?
Here is my function :
let
FindLoc= (lat, lon) =>
let
Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/"&Text.From(lat)&"'" &Text.From(lon)&"?o=xml&key=AqXbM3RmYA05LA89D0jBdRSYxgrYNUOwSNEsDS2G9aXaYBqFDOIYDT8IPoHKhJRp")),
#"Type modifié" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
#"ResourceSets développé" = Table.ExpandTableColumn(#"Type modifié", "ResourceSets", {"ResourceSet"}, {"ResourceSets.ResourceSet"}),
#"ResourceSets ResourceSet" = #"ResourceSets développé"{0}[ResourceSets.ResourceSet],
#"Type modifié1" = Table.TransformColumnTypes(#"ResourceSets ResourceSet",{{"EstimatedTotal", Int64.Type}}),
Resources = #"Type modifié1"{0}[Resources],
Location = Resources{0}[Location]
in
#"Location"
in
FindLoc
Thanks for your help,
Jérôme
Solved! Go to Solution.
Here is the solution :
let
FindLoc= (lat, lon) =>
let
Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/"&Replacer.ReplaceText(Text.From(lat),",",".")&","&Replacer.ReplaceText(Text.From(lon),",",".")&"?o=xml&key=AqXbM3RmYA05LA89D0jBdRSYxgrYNUOwSNEsDS2G9aXaYBqFDOIYDT8IPoHKhJRp")),
#"Type modifié" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
#"ResourceSets développé" = Table.ExpandTableColumn(#"Type modifié", "ResourceSets", {"ResourceSet"}, {"ResourceSets.ResourceSet"}),
#"ResourceSets ResourceSet" = #"ResourceSets développé"{0}[ResourceSets.ResourceSet],
#"Type modifié1" = Table.TransformColumnTypes(#"ResourceSets ResourceSet",{{"EstimatedTotal", Int64.Type}}),
Resources = #"Type modifié1"{0}[Resources],
Location = Resources{0}[Location]
in
#"Location"
in
FindLoc
Hi, @jsteffe ;
You can check if these related post can is useful to you.
Using the Bing Maps API to return Latitude and Longitude in Power Query – Wise Data Decisions
Locations API - Bing Maps | Microsoft Learn
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
When I write the URL directly, I use a comma between lat and lon parameters but if I write my function like this, it doesn't work :
Text.From(lat)&"," &Text.From(lon)
Here is the solution :
let
FindLoc= (lat, lon) =>
let
Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/"&Replacer.ReplaceText(Text.From(lat),",",".")&","&Replacer.ReplaceText(Text.From(lon),",",".")&"?o=xml&key=AqXbM3RmYA05LA89D0jBdRSYxgrYNUOwSNEsDS2G9aXaYBqFDOIYDT8IPoHKhJRp")),
#"Type modifié" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
#"ResourceSets développé" = Table.ExpandTableColumn(#"Type modifié", "ResourceSets", {"ResourceSet"}, {"ResourceSets.ResourceSet"}),
#"ResourceSets ResourceSet" = #"ResourceSets développé"{0}[ResourceSets.ResourceSet],
#"Type modifié1" = Table.TransformColumnTypes(#"ResourceSets ResourceSet",{{"EstimatedTotal", Int64.Type}}),
Resources = #"Type modifié1"{0}[Resources],
Location = Resources{0}[Location]
in
#"Location"
in
FindLoc
User | Count |
---|---|
123 | |
70 | |
67 | |
58 | |
53 |
User | Count |
---|---|
183 | |
92 | |
67 | |
62 | |
52 |