Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.52 KB

About First Quetion.md

File metadata and controls

39 lines (28 loc) · 1.52 KB

The First Problem

The situation is that a user reached out to notify us that there are several plant records missing farm data. Data about the plants themselves were collected in the field, but information about the distance to the correct farms was not collected. The plant table includes coordinates of the plants.

We have a farm table that includes the coordinates of the farms and the supported crops. Create a table that displays the plant data and the farm name of the closest farm that supports the plant type.

Input data

There will be 2 text files:

  1. Plant table - This is the plant data collected in the field, including coordinates.
  2. Farm table - This is the farm data, including farm coordinates and supported crops

Sample Input

Plant Table

 Latitude | Longitude | crop 
 ---|----------|-----------|----------- 
 38.513253 | -90.145310 | corn 
 38.512092 | -90.143185 | soy 
 38.516561 | -90.138432 | wheat

Farm Table

 Latitude | Longitude | crop 
 ----------|-----------|----------- | ---
 38.520671 | -90.157317 | corn
 38.520671 | -90.157317 | canola
 38.520671 | -90.157317 | wheat
 38.508210 | -90.142351 | corn
 38.508210 | -90.142351 | cotton
 38.515713 | -90.115004 | soybean
 38.515713 | -90.115004 | wheat

Output Format

 Plant LatLong | Closest Farm Lat Long | DistanceBetween | Available Crops
 --------|----------|-----------|--------
 38.513253, -90.14531 | 38.50821, -90.142351 | 0.6170355801223573KM | ['corn', 'cotton']