call google maps api to get all zipcodes in radius of (lat,lon)

37 views
Skip to first unread message

Thomas Miller

unread,
Jan 17, 2016, 9:49:15 PM1/17/16
to Google Maps JavaScript API v3
I have programmed many "Great circle" query using SQL, Java, Python, C#, Perl etc. That is easy.

I have a unique problem... I am using a horrific product named Microsoft CRM 2013. This system (when run in Azure) does NOT let me access the SQL database directly. All I can do is store a list of 20,000 Offices and their Lat/Lon in Cache (RAM)... to compound the problem to do any kind of calculation I MUST iterate thru the 20k rows to calculate the Great Circle. This is mind boggling SLOW. 

Just like any geolocation lookup/calculation, an end user can enter a zipcode into the lookup screen. I can get the lat/lon of the zipcode in a few nanoseconds... not a problem. But now I must iterate thru 20k records and compare each one using C#.  

So to optimize performance I am praying there is a way in Google Maps API to get all zipcodes within distance of zipcodeX.  My C# can call the GoogleMaps webservice and get the "list of zipcodes".

Then my C# code can use LINQ to do a subquery on the list of offices in Cache RAM.... LINQ is similar to SQL but lives in the C# layer. So the LINQ query will be equvalent of:

SELECT ZipCode, OfficeName, Address, Phone FROM Offices  WHERE ZipCode IN (21801,22802,21303, 21824, 21105, 21115, 21106)

Then with that result set I can do my Great Circle calculation very fast with C#.

Please advise. Even if it is just a *hacky idea* it is probably better than the coding horror I am having to do now!

Thanks so much
Reply all
Reply to author
Forward
0 new messages