# Compute the difference between two maps

### Description

Compute the difference between two maps.

If the map of the standard deviation is given, the difference is divided by the standard deviation.

### Usage

1 |

### Arguments

`mapin` |
raster map |

`mapref` |
raster map 2 (the reference) |

`mapsd` |
raster map conaining the standard deviation values. |

`outfile` |
file where the difference map is saved.
If |

### Details

If mapsd is defined :

*diff = \frac{mapin - mapref}{mapsd}*

else :

*diff = mapin - mapref*

### Value

Returns the difference map

### Author(s)

Romain Frelat and Bruno Gerard

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
ndvidirectory=paste(system.file("extdata/VITO_Mzimba",
package="ndvits"), "/", sep="")
region="Mzimba"
filein=timetoMap(ndvidirectory,region, 2004,1,1)
filein2=timetoMap(ndvidirectory,region, 2005,1,1)
#load the maps
map04=readpartGDAL(filein)
map05=readpartGDAL(filein2)
#computing the difference of the 2 maps
diff=mapdiff(map04, map05)
#plot the difference map :
savemap(diff)
``` |