title: How to join two datasets "lat/lon log data" and "hexagonal cells grid data" SQL or python
body: <p>I have two datasets as below.</p>
  
  <p>data 1：lat/lon log</p>
  
  <pre><code>#log_id, lat, lon
  0001 , 31.30272 , 103.66426
  0002 , 31.23483 , 103.12323
  ：
  </code></pre>
  
  <p>data 2：hexagonal cells grid infomation</p>
  
  <pre><code>#grid_id, point1_lat , point1_lon , ・・・　, point6_lat , point6_lon
  000001, 31.30272 , 103.66426 , 31.30272 , 103.66426 ,　・・・　, 31.30242 , 103.65676
  ：
  </code></pre>
  
  <p>How can　I extract the grid ID in data 2 corresponding to the log ID in data 1 as below.</p>
  
  <pre><code>log_id , grid_id
  0001 , 000324
  0002 , 002341
  ：
  </code></pre>
  
  <p>I'm using PostgreSQL or python</p>