[GIS] Convert X Y Pixels to Easting Northing

convertcoordinatesgeoreferencingimageordnance-survey

I'm trying to find out what the formula would be to convert the X, Y of an image to the Easting and Northing coordinates.

I've downloaded some of the raster maps from OS UK web site and I'm looking at adding the miniscale tif file to one of my applications. I've been given a number of coordinates in the easting northing format and I need to convert this to an x y of the image so I can place a label or image on top of the mini scale tif file.

I've been searching online quite a bit but everything seems to point towards applications like ArcGIS and other GIS software. However I'd quite like to make this a simple project, so I'd like to avoid embedding 3rd party sources within the application.

Does any body have any good starter guides or examples on this, or what the forumla would be to work out the x y from the easting and northing I have?

Best Answer

GIS file formats contain georeferencing information. This ties image pixel coordinates to grid references in a projection system, in this case British National Grid.

There are lots of ways this information can be stored depending on image format. A basic tool to get you started is gdalinfo which will query the extents of the image in British National Grid.

You can also look for an accompanying world file. The wikipedia page contains details for converting from pixel to projected coordinates.

Based on you example of Edinburgh at pixel coordinates x=3270 and y=6264 gives the following:

A = 100
D = 0
B = 0
E = -100
C = 50
F = 1299950

Northing

    F+(E*y)
    1299950+(-100*6264)=673550

Easting

    C+(A*x)  
    50+(100*3270)=327050
Related Question