2

I have a database of postcodes with Eastings/ Northings, is there a php script that can convert these values so I can use them on google maps?

Can I loop through the database and change each value?

Many thanks

Bomber
  • 10,195
  • 24
  • 90
  • 167

1 Answers1

1

Here is an API I wrote to do exactly this:

https://www.getthedata.com/bng2latlong

Syntax:

https://api.getthedata.com/bng2latlong/[easting]/[northing]

Example:

https://api.getthedata.com/bng2latlong/529090/179645

Some very basic PHP code might look like this:

$easting = 529090;
$northing = 179645;

$json = file_get_contents("https://api.getthedata.com/bng2latlong/$easting/$northing");

$arr = json_decode($json, true);

$latitude = $arr['latitude'];
$longitude = $arr['longitude'];
Dan Winchester
  • 324
  • 1
  • 7