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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Bing API Geocode by Country only gives multiple results

Hi,

I am using Bing API to get Latitude and Longitude of Country only and It seems to loop through every possible region. I based my  api call off https://sqldusty.com/2016/04/26/power-bi-and-the-bing-maps-api/

The Country column is from my table, I don't understand why I am getting multiple results?

If anyone could kindly assist that would be most helpful.

Example:
fred65_0-1705019757436.png

The only parameter "country" so I figured that I could use "countryRegion" in my code. Here is the code:

 

 

let PointLookup = (country as text) =>

let
    Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/countryRegion="&country&"?o=xml&key=2D7Fw69q3CPBOs815sRV~")),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
    #"Expanded ResourceSets" = Table.ExpandTableColumn(#"Changed Type", "ResourceSets", {"ResourceSet"}, {"ResourceSets.ResourceSet"}),
    #"Expanded ResourceSets.ResourceSet" = Table.ExpandTableColumn(#"Expanded ResourceSets", "ResourceSets.ResourceSet", {"EstimatedTotal", "Resources"}, {"ResourceSets.ResourceSet.EstimatedTotal", "ResourceSets.ResourceSet.Resources"}),
    #"Expanded ResourceSets.ResourceSet.Resources" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet", "ResourceSets.ResourceSet.Resources", {"Location"}, {"ResourceSets.ResourceSet.Resources.Location"}),
    #"Expanded ResourceSets.ResourceSet.Resources.Location" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet.Resources", "ResourceSets.ResourceSet.Resources.Location", {"Name", "Point", "BoundingBox", "EntityType", "Address", "Confidence", "MatchCode", "GeocodePoint"}, {"ResourceSets.ResourceSet.Resources.Location.Name", "ResourceSets.ResourceSet.Resources.Location.Point", "ResourceSets.ResourceSet.Resources.Location.BoundingBox", "ResourceSets.ResourceSet.Resources.Location.EntityType", "ResourceSets.ResourceSet.Resources.Location.Address", "ResourceSets.ResourceSet.Resources.Location.Confidence", "ResourceSets.ResourceSet.Resources.Location.MatchCode", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint"}),
    #"Expanded ResourceSets.ResourceSet.Resources.Location.GeocodePoint" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet.Resources.Location", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint", {"Latitude", "Longitude", "CalculationMethod", "UsageType"}, {"ResourceSets.ResourceSet.Resources.Location.GeocodePoint.Latitude", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.Longitude", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.CalculationMethod", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.UsageType"})
in
    #"Expanded ResourceSets.ResourceSet.Resources.Location.GeocodePoint"

in PointLookup

 

 

 

2 REPLIES 2
lbendlin
Super User
Super User

The other entries are cities/towns/villages that happen to have the same name as a country.

Anonymous
Not applicable

I understand, I thought "CountryRegion" would just bring the country name but it looks like it's finding more than that. I tried the google api but now you need a subsciption so now trying with Bing.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors