The problem
This problem has been acknowledged by Wolfram Technical Support [CASE:3913717] (July 2017)
"[...] at this point in time, they haven't optimized interpreter to handle these inputs [in Mathematica 11.1]. As such it isn't surprising that some may work, but we are unable to guarantee that they all will.[...] Further conversion of these postal codes to GeoPositions would require a custom interpreter. "
A solution
There is a Mathematica package by Arnoud Buzing that uses a web API from api.postcodes.io. The packages is available at github.com/arnoudbuzing/postcode.
A representative function of the package (with some modifications) is
postcodes[codes : List[_String ..]] := Module[
{request, response},
request = HTTPRequest[
"http://api.postcodes.io/postcodes"
, <|
Method -> "POST"
, "Body" -> {"postcodes" -> codes}
, "Headers" -> {"content-type" -> "application/x-www-form-urlencoded;charset=UTF-8",
"user-agent" -> "Wolfram HTTPClient 11.1"}
|>
];
response = URLRead[request];
ImportString[response["Body"], {"RawJSON"}]["result"]]
The API allows list of only 100 code per query, so this needs to be modified to divide longer lists in smaller chunks. Several other related functionalities are also available.
Example
Interpreter["Location"] /@ {"NW65AR", "OX49 5NU"}
{GeoPosition[{51.5313, -0.195886}], GeoPosition[{51.6595, -1.07229}]}
Query[All, "result", GeoPosition[#["latitude"], #["longitude"]] &][
postcodes[{"NW65AR", "OX49 5NU"}]]
{GeoPosition[51.6559, -1.06977], GeoPosition[51.533, -0.197077]}
Warning
Beware that the GeoPosition
obtained by different methods are not identical. Interpreter["Location"]
provides incorrect coordinates.