I am about to begin writing a program in c# that will read Addresses from a source file create a Geocoding request, sent it to Google Maps API, get the response choose the coordinates from the xml and then store them in a database.
My question is what is the proper type of source file considering performance and easy implementation.
I have the option to supply the source addresses as txt file or xml file.
The number of addresses need to get geolocated is about 100.000 which is a big number so what is the proper approach to handling this kind of requests?
Should i provide the addresses source file as txt or xml or something else?
Question: I have the option to supply the source addresses as TXT
file or XML
file.
Answer: I would use an XML
file because it’s a standard document type and you can serialize it inside any language or database.
When you get an address file as a XML
you might have something like this.
<addresses>
<address></address>
<address></address>
</addresses>
So when you have an XML
file like that you could serialize it into a C#
object as a list of addresses and loop though that list and get he info from Google. That can be stored into a database.
The only bottleneck would be your looping algorithm. A standard for
loop you will have a worst case of O (n) in this case O(100). However there are other algorithms out there which could decrease that to a O(log n).
Hope this helps?