THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Rob Farley

- Owner/Principal with LobsterPot Solutions (a MS Gold Partner consulting firm), Microsoft Certified Master, Microsoft MVP (SQL Server), and leader of the SQL User Group in Adelaide, Australia. Rob is a former director of PASS, and provides consulting and training courses around the world in SQL Server and BI topics.

Fetching Latitude and Longitude Co-ordinates for Addresses using PowerShell

Hi! - Great that you've found this page, but it's no longer here! You can find the content over at:

Published Sunday, May 23, 2010 6:59 PM by Rob Farley



Jacques Willemen said:

Hi Rob,

I try to imitate what you do because it seems very nice,

but I am not sure about the line:

$wsgr.Credentials = $wsgrb

because the variable $wsgrb is not defined before.

I guess that is why I get an error message:

'Exception calling "Geocode" with "1" argument(s): "Credentials are either invalid or unspecified."'


Greetings from Breda, Netherlands

May 23, 2010 8:55 AM

Rob Farley said:

Ah - thanks Jacques. That was a typo. Fixed now. Should've been $wsgrc


May 23, 2010 7:09 PM

Matt Penner said:

Hey Rob,

Great article.  I used to do this in my last job a few years ago with the Google Maps API before Bing Maps was around.

I don't know about now, but back then the Google API limited geocoding to one about every couple of seconds.  This way they weren't flooded with users trying to geocode a thousand person mailing list through their API.

Does Bing not have any sort of limit on the amount or frequency of addresses you can geocode?


Matt Penner

June 1, 2010 3:39 PM

Rob Farley said:

Displaying information on an interactive map really isn’t that hard to do. My friends John & Bronwen

June 28, 2010 1:11 AM

Pushkar said:

Hello Rob,

I am using spatial database to create tiles over Bing maps and plot all restaurants/gas stations etc. in a specific area.

Can we have something on DB side(StoredProc or something) to locate places of interest in specific radius of a specified lat/long?


June 7, 2011 6:47 AM

Rob Farley said:

Yes, absolutely. Use the geography type in SQL, and put a spatial index on the field. Then you can easily use the functions such as STDistance to work out the closest, and so on.

June 7, 2011 6:54 AM

Pushkar said:

Thanks a lot. :)

June 8, 2011 7:37 AM

srinivas said:


Fetching Latitude and Longitude Co-ordinates for Addresses using php.

September 13, 2011 2:42 AM

Rob Farley said:


If php lets you call web services, you should be able to translate the code easily enough. It's been too long since I did php for me to be able to help you.


September 13, 2011 4:17 AM

Brian Livingston said:

Great post.  I am trying to update the latitude/longitude via powershell but can't get it to work.  I am basically hitting the bing service with an address retrieving the longitude/latitude then trying to assign those values to the geocode for the list object I am working with.

Here is a small snippet of my code I am testing with.

$LIST_ITEM_TO_UPDATE['Geo Location'].Latitude = 10

$LIST_ITEM_TO_UPDATE['Geo Location'].Longitude = 10


March 12, 2014 4:31 PM

Carl Williams said:

Haha, pretty slick Rob. Good job.

January 2, 2015 5:55 PM
Anonymous comments are disabled

This Blog



No tags have been created or used yet.


News? Haven't you read my blog?

My Company

Can't find something?

Contact Me

Twitter: @rob_farley
Skype: rob_farley

MVP (SQL Server)


Adelaide SQL UG


Privacy Statement