def load_locations(infile, index=None):
    """Load locations from input file.
    infile: file pointer, an file kind object.
    index: (loc, lantitude, longititude) index in line,
        default index=(0,1,2)
    usage:
     >>> import StringIO
     >>> s = StringIO.StringIO("0 1.0 2.0\\n1 1.0 3.0\\n")
     >>> print load_locations(s)
     {0: (1.0, 2.0), 1: (1.0, 3.0)}
    """
    if index is None:
        index = (0, 1, 2)
    locations = {}
    for line in infile:
        params = line.strip().split()
        item = int(params[index[0]])
        lat = float(params[index[1]])
        lon = float(params[index[2]])
        locations[item] = (lat, lon)
    return locations