Multimap Open API V1.2 JavaScript Example
Many of the more widely-used online mapping APIs, including the Multimap Open API and the Microsoft Bing Maps API, do not support the Ordnance Survey National Grid (OSNG) coordinate system or Mercator coordinates internally but do support latitude and longitude. The commonly-available algorithmic conversion methods from OSNG eastings and northings or Mercator to World Geodetic System 84 (WGS84) latitude and longitude are too inaccurate to use for street-level placement of locations (and are often out of alignment by more than 100 meters).
Multimap now provides Open API V1.2 JavaScript and Web Service features that enable high-quality conversion between OSNG eastings and northings and WGS84 coordinates, based on the National Grid Transformation OSTN97 model.
This document explains the conversion from OSNG coordinates and Mercator to WGS84 via the Multimap API. You can also convert from OSNG coordinates and Mercator coordinates to WGS84 coordinates via the REST API. For details, please see the Multimap Open API V1.2 Web Services Coordinate Transformation documentation.
The Coordinate Transformation parameters, description and values are as follows:
| Parameter | Description | Valid values | Example | Mandatory |
|---|---|---|---|---|
locs | This parameter refers to the array of locations that are to be converted between the OSNG or Mercator coordinates and WGS84 coordinates of lat & lon. | Array of points of type MMPoint and MMLatLon | new MMPoint(523000,212324); | Yes |
system | This parameter refers to the system to or from which the coordinates are being converted which can be either mercator or osng. | String | system=osng | Yes |
The Open API JavaScript layer provides a convenient client-side wrapper to the REST API. The MMConverter object takes an array of MMPoint objects and returns an array of MMLocation objects via a 'callback method'.
var locations = new Array();
var xy1 = new MMPoint(523000,212324); // OSTN97 OS National Grid
var xy2 = new MMPoint(323000,212324);
var xy3 = new MMPoint(423000,212324);
locations.push(xy1);
locations.push(xy2);
locations.push(xy3);
var funcRef = convertResultsLoaded;
var converter = new MMConverter( funcRef );
converter.convert(locations, 'osng');
function convertResultsLoaded() {
console.log(converter.result_set);
};
If you require further help with your Multimap Open API implementation, please visit the Multimap Developer Forums.
For Open API news, announcements and other information, please see our blog.
For enquiries about further Multimap services, please contact the Multimap Sales team:
| Great Britain, London | +44 (0)20 7632 7800 |
| email: | sales@multimap.com |