Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I have a list of public places, for example store names, hospital names, government buildings.
I would like to get the latitude and longitude from these names. I have tried this tutorial https://www.youtube.com/watch?v=YxwU5UubWjI but instead of addresses I put in the store names + city + country but the longitude and latitude that comes out is incorrect.
I tried to input the same store names + city + country into Bing Maps itself and it works just fine:
Is this possible to achieve?
Thank you beforehands 🙂
did you ever find a solution?
Hi @Anonymous
I think the first way is the workaround. Is your issue that when you invoke custom function, you will get incorrect result? There may be some differencet locations with same name in same country and city. You can add more details in your location.
If you still want to get data by Way 2, please refer to the post as below and try this code.
let
FindLatLong = (location) =>
let
Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/"&location&"?o=xml&key=XXX",
[ManualStatusHandling={404}])),
GetMetadata = Value.Metadata(Source),
GetResponseStatus = GetMetadata[Response.Status],
Output = if GetResponseStatus=404 then "Error!" else Source,
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
ResourceSets = #"Changed Type"{0}[ResourceSets],
ResourceSet = ResourceSets{0}[ResourceSet],
#"Changed Type1" = Table.TransformColumnTypes(ResourceSet,{{"EstimatedTotal", Int64.Type}}),
Resources = #"Changed Type1"{0}[Resources],
Location = Resources{0}[Location],
#"Changed Type2" = Table.TransformColumnTypes(Location,{{"Name", type text}, {"EntityType", type text}, {"Confidence", type text}, {"MatchCode", type text}}),
Point = #"Changed Type2"{0}[Point],
#"Changed Type3" = Table.TransformColumnTypes(Point,{{"Latitude", type number}, {"Longitude", type number}})
in
#"Changed Type3"
in
FindLatLong
For reference: Power Query Function Error Bing Maps API Token Literal Expected Error when 404 is returned
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I have found the Bing Maps API also offers the finding of such places using LocalSearch.
Source = Json.Document(Web.Contents("https://dev.virtualearth.net/REST/v1/LocalSearch/",[RelativePath=NameOfLocation,
The error is 404 Not Found
DataSource.Error: Web.Contents failed to get contents from 'https://dev.virtualearth.net/REST/v1/LocalSearch/Name%20Of%20Place?userMapView=xxxx%2Cyyyy%2Czzzz%2w...' (404): Not Found
How can I fix this issue?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
8 | |
7 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |