Geocoding with power query in excel and bing

bbrimberry

New Member
Joined
Mar 23, 2016
Messages
34
Hello fellow Excel lovers,


I am working on a custom power query function that will geocode addresses using bing maps. It works great with one exception. Bing is returning more than 1 match at times.

I only need 1 match. I'm not sure my URL is quite right.

Can someone advise?






let



findlatlong =(myLocation) =>



let

Source = Xml.Tables(Web.Contents(http://dev.virtualearth.net/REST/v1/Locations/&myLocation&"?o=xml&maxResults=1&key=mykey")),

#"Changed Type" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),

#"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"ResourceSets"}),

#"Expanded ResourceSets" = Table.ExpandTableColumn(#"Removed Other Columns", "ResourceSets", {"ResourceSet"}, {"ResourceSet"}),

ResourceSet = #"Expanded ResourceSets"{0}[ResourceSet],

#"Changed Type1" = Table.TransformColumnTypes(ResourceSet,{{"EstimatedTotal", Int64.Type}}),

Resources = #"Changed Type1"{0}[Resources],

#"Expanded Location" = Table.ExpandTableColumn(Resources, "Location", {"Confidence", "GeocodePoint"}, {"Confidence", "GeocodePoint"}),

#"Expanded GeocodePoint" = Table.ExpandTableColumn(#"Expanded Location", "GeocodePoint", {"Latitude", "Longitude", "UsageType"}, {"Latitude", "Longitude", "UsageType"}),

#"Removed Columns" = Table.RemoveColumns(#"Expanded GeocodePoint",{"UsageType"})

in

#"Removed Columns"



in findlatlong
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
When applied to a single column with addresses, returns a "Table" value in column. Rather than expanding, create a Custom Column and use Table.First formula to extract the first value only.
 
Upvote 0
thanks for the reply!

I'm happy with the number of columns that are being returned, I only want bing maps to return one row per address.

the maxResults=1 part of the URL string doesn't seem to be working
 
Upvote 0

Forum statistics

Threads
1,223,701
Messages
6,173,920
Members
452,539
Latest member
deeme

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top