title: How to find the nearest point among list of GPS coordinates
body: <p>I have 2 sets of data. One with coordinates points of different vehicles (<code>vehicledata</code>) and another one with coordinate points that are each assigned a region (<code>sublap</code> data). I want to classify the vehicles by region. However, there are some vehicle coordinates that are not on the region data. I would like to still be able to classify those points by assigning the region associated with the next closest lat/lon value to those coordinates. 
  Any ideas for how to do this with my existing python script?</p>
  
  <pre><code>vehicledata = pd.read_csv('ParkingChargingBlocks.csv')
  
  sublapdata = pd.read_csv('location_to_pnode_sublap.csv')
  
  VID = vehicledata['VID'].values #j
  lat_v = vehicledata['lat'].values
  lon_v = vehicledata['lon'].values
  
  sublap = sublapdata['sublap'].values #i
  lat_s = sublapdata['latitude'].values
  lon_s = sublapdata['longitude'].values
  
  with open('locations_with_sublap.csv', 'w') as csvfile:
      fieldnames = ['VID', 'lat', 'lon', 'sublap'] 
      writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
      writer.writeheader()
  
  for j in range (0, len(lat_v)): 
      for i in range(0, len(lat_s)):
          if lat_v[j] == lat_s[i] and lon_v[j] == lon_s[i]: 
              print (lat_v[j], lon_v[j], sublap[i])
              writer.writerow({"VID": VID[j], "lat": lat_v[j], "lon": lon_v[i], "sublap": sublap[i]})
  </code></pre>