Version 2 (modified by benj, 16 years ago) (diff)


Converting lat/long to BNG

The point of writing this code was to have a fast way to scan all the eagle/hawk header files for a project and use the co-ordinates from them to determine the UK OS grid squares they covered. To do this, run in the base project directory and it'll go do it for you. The steps it goes through are below and can be used for other conversions.

  1. Use Proj to convert lat/long to BNG co-ordinates:
    proj +proj=tmerc +ellps=airy +lat_0=49 +lon_0=-2 +x_0=400000 +y_0=-100000 +k=0.9996012717

Then once that's running you enter the lat/long to be converted at the prompt in x y format (ie long then lat) and it will return transverse mercator co-ordinates in the BNG co-ordinate system (still have to convert to the right OS grid square though).

  1. Run to convert this to grid squares:
    python eastings northings

(Note this requires runs steps 1 and 2 on a specific set of coordinates: latitude longitude

This accepts any Proj.4 format lat/lon

Attachments (4)

Download all attachments as: .zip