LJ Archive

Precision Farming and Linux: An Expose

Gordon Haverland

Issue #63, July 1999

Farming is not a place one would expect to fine Linux, but there it is. Mr. Haverland tells us how Linux is used in this unusual area.

Ideally, precision farming is a process where one manages the production of a crop on a plant-by-plant basis. Practically speaking, we are not yet at that level of resolution, but we are beyond treating an entire field as one homogeneous unit.

Modern electronics, global positioning satellites, signal processing and a host of other technologies make precision farming possible. The driving forces for development and acceptance are the possibility of increased profitability and the realization of improved stewardship of the land (less pollution, optimal use of chemical inputs, etc.).


Precision farming is evolving around three technologies: global positioning (GPS), geostatistics (GIS) and remote sensing. Other developed technologies such as sampling, soil analysis and others are also playing a role.

Alberta Agriculture, Food and Rural Development has been in the Precision Farming business since 1993. We work with selected farmers across the province who grow a variety of crops: wheat, barley, canola, peas, potatoes, etc. Our objectives are the following:

  • Help develop a workable system that interested farmers can implement on their farms.

  • Transfer this technology to private industry.

Global Positioning

Global positioning satellites and receivers were the technologies that started this revolution in agriculture (see Resources). Before then, positioning via radio was possible, but not very accessible to the researcher, or ultimately the farmer.

Two families of global positioning satellites are in orbit around the earth: Navstar (U.S. system) and Glonass (Russian). The Navstar system is capable of better positioning than the Glonass system. However, the US military uses something called “selective availability” to decrease precision to something on the order of 100 meters (unless one is using military GPS receivers). Agricultural applications require positioning at sub-meter precisions, most often in real time.

Some enterprising person realized if a GPS receiver were put over some known position, a correction to the position as determined by GPS could be calculated. This correction factor could then be applied to nearby (in space and time) GPS positions. How good the correction is depends on how close the roving receiver is to the fixed known station, and how long ago the correction was calculated. The best precision I am familiar with is typically on the order of 10cm. However, due to the changing “constellation” of GPS satellites, we can't always get precision this good.

For most people, it is not practical to own two GPS receivers plus radio-modems to gather positioning information. For 20cm precision, this type of setup costs on the order of $20,000 US. Fortunately, it is possible for many people to obtain usable differential corrections without going to the trouble of owning a differential base station. There are a number of sources of differential corrections and means of receiving them. Some corrections are broadcast over FM radio, some on other frequencies and some from satellite. The Coast Guard has a number of DGPS (differential GPS) beacons along navigable waterways and coastlines. This includes locations such as the Mississippi and Missouri River basins and the Great Lakes.


One of the most important factors in precision farming, is the ability to store, display and manipulate geo-referenced information. On a local scale, geostatistical packages can look something like a spreadsheet (raster) or a CAD (vector) package. Some types of information access work better in the raster model, some in the vector model.

Agriculture is one of the smaller users of GIS packages; therefore, it is necessary to bend the analytical techniques to methods developed for other applications. The unavailability of theoretical models also affects what can be done with an analysis.

A couple of “free” GIS packages are available, but by far the most comprehensive is the Geographical Resources Analysis Support System (GRASS) (http://www.baylor.edu/grass/). This package was originally developed by the U.S. Army Corps of Engineers Construction Engineering Research Laboratory (CERL) and extended by other government and university researchers and users over the years. Active support by CERL has been abandoned, but was recently taken up by Baylor University.

GRASS is now advertised as an “Open GIS”. Among the new developments is an interface based on Tcl. An OpenGIS Consortium (http://www.OpenGIS.org/) also exists.

Remote Sensing

Commercial satellite remote sensing (see Resources) typically has a resolution on the order of 10m, each pixel covering an area on the order of 100m (far worse than the (rumored?) 10cm resolution the CIA has with some of its satellites). In order to statistically detect some change in an image, many pixels in close proximity must be significantly different than expected. With 10m pixels, this means that many hundreds of square meters of land must be affected before the change can be detected from space. For things like disease or pests, this is not very useful, but it is acceptable for crop maturity. To detect disease or pests, aircraft-based remote sensing is presently required. In the near future, high-resolution satellite imagery is expected to become commonplace.

Adventures in Analysis

Precision farming is filled with analytical adventure. Conventionally, precision farming starts with a map of crop yield from the field. To acquire this map, we put a DGPS receiver on some known location on the combine harvester, and a yield monitor somewhere in the path grain takes from entering the header to the clean grain tank. (The closer this is to the threshing part of the combine, the shorter the throughput delay time.)

Position Information

The DGPS antenna is fixed on some point on the combine harvester, usually the cab roof. The grain is removed from the field along the leading edge of the header, i.e., a line segment remote from the point where the GPS antenna is. If we are interested in only coarse resolutions, the difference between the GPS receiver location on the leading edge of the combine header is not important. At fine resolutions, we do need to make this correction, and in order to make it, we need to know the orientation of the vehicle in 3-D space. This information is not currently collected—it must be calculated later.

Velocity Information

Combine harvesters typically move at about two meters per second. With high accuracy DGPS equipment, errors are typically on the order of 10cm. This results in velocities having errors on the order of 10%. GPS position errors are highly correlated in time. Events called “blunders” can occur, which result in relatively huge position errors. Once a blunder has occurred, its presence may live on for several seconds. This results in two huge velocity errors on either end of a “short” track of biased position estimates.

Combine harvesters usually operate under the conditions of constant mass and wheel power traveling in straight lines. (This means the position as a function of time must be twice continuously differentiable. The only places where third and higher order derivatives can exist are on corners. This information can be used to help smooth the position information.) Therefore, we should be able to use low-order polynomials or splines to smooth the position as a function of time data.

Digital Elevation Models (DEMs)

If one assumes the vehicle is always traveling in a forward direction and there is no side slip of the wheels, it is possible to calculate the orientation of the vehicle in space. However, if one has an available model of the elevation as a function of position in the field, they can obtain a much better estimate of the surface normal to the ground.

Stereo photography is one way to obtain a DEM. Another is to start from GPS position information and correct it for the GPS receiver mounting position and the vehicle's geometry and orientation in space.

The DEM is quite useful, as landscape is one of the contributing factors in crop yields. For example, during a wet year, low-lying concave parts of the field are typically too wet to produce good crops. Another example is lower yields on high-elevation convex hilltops during dry years. The DEM is most useful when it is interpreted with terrain analysis and combined with crop yield and other data sets in a GIS. Sometimes (more often than desired) precision farming requires new and specialized procedures.

Yield Time Lags

Basically, the time it takes for the crop to travel from the leading edge of the combine header to the yield sensor is not a single, unique value. Some of the crop takes a relatively short time, and some takes longer. This process smears and averages crop yield over a period which is typically 25 seconds long.

Linux and Open Source Software

Linux is a good platform for doing this research-oriented work. Much of the analysis can be translated into such mainstream topics as signal processing or multi-dimensional statistics. Some of the best software for exploring software in these topics is the product of government and university research and is “free”--an important quality in tight budgets. GRASS, xldlas and Santis are three packages which have helped in precision farming.

Perl has also proven itself to be quite useful. Our participation in precision farming has lasted six years now. Several kinds of GPS equipment and yield monitors have been used, even updates of individual systems. Of course, everybody has to have his own “standard” data format. Our method of analyzing the data evolves, which for us means re-analyzing the previous year's data with the current best method. This results in many format changes in data—an area where Perl excels. The ability to use pseudo-ttys in Perl has been useful when it was necessary to change coordinate systems on thousands of data points using GRASS programs.

One area which has not seen a lot of development is the safe storage of data. A farmer does not want to discover that the data is not “on the card” after he has harvested a crop—this has been known to happen. Using radio modems to transmit the data to a home computer would be one way of avoiding this situation.


Precision farming is here to stay. However, the data storage and analysis needs of precision farming are beyond the resources of most farmers. Procedures and analytical processes are not always available in “canned” packages (certainly not in any one package), so a powerful, open development environment is needed.

If you are a person who understands the philosophy of statistics and are academically inclined, precision farming might be a very interesting topic/career in which to get involved.


Gordon Haverland works for the Precision Farming Project of Alberta Agriculture, Food and Rural Development. He can be reached via e-mail at haverlan@agric.gov.ab.ca.

LJ Archive