Monday, October 10, 2011

Google Maps API for Small Businesses

The ability to search for nearby businesses using Google Maps APIs are very interesting. Using Google Places webservices API (one of Google Maps API), you can:

1. search for additional delivery and backhaul opportunities along your delivery routes
2. explore partnership opportunities in delivery and backhaul to share resources and reduce carbon footprint
3. Know who your competitors or complementary businesses are in a particular location
4. Location new store near a certain profile of stores

Explore Google Maps API more at http://code.google.com/apis/maps/documentation/webservices/

Below are the codes I use. What do you think? elegance in simplicity? :)

import socket # for connecting to googlemaps api
import urllib #retrieve web pages
# initialize namelist as adict()
nameslist=dict()
#for each line in the file, pick put the latitudes and longtitudes, print it

fhandopenstorefile=open('storelocationslatlongall.csv')
for line in fhandopenstorefile:
        line=line.rstrip()
        print line
#put latitudes and longtitudes in the http
        http='https://maps.googleapis.com/maps/api/place/search/xml?location='+line+'&radius=805&sensor=false&key=AIzaSyAJzHX3bW7PiB8T5xRlmp1LpBvFtXgChkc'
        print http
#sent it to google and get the xml file
        fhandopenhttp=urllib.urlopen(http)
        for line in fhandopenhttp:
                print line.strip()
fout=open('output.txt','w')
fout.write(str(nameslist))
fout.close()

No comments:

Post a Comment