  A linear code with parameters $[n,k,n-k]$ is said to be almost maximum
distance separable (AMDS for short). An AMDS code whose dual is also AMDS is
referred to as an near maximum distance separable (NMDS for short) code. NMDS
codes have nice applications in finite geometry, combinatorics, cryptography
and data storage. In this paper, we first present several constructions of NMDS
codes and determine their weight enumerators. In particular, some constructions
produce NMDS codes with the same parameters but different weight enumerators.
Then we determine the locality of the NMDS codes and obtain many families of
distance-optimal and dimension-optimal locally repairable codes.
