# ArcMAP / R: Convert raster pixels to Long and Lat

``````Item    Data
Date    2015-01-03 00:00:00
Product cold partial sst
Satellite   NOAA-18
Direction   Unknown
Dimension   1596 x 1617
BPP 8
Latitude range  47 — 62.999108
Longditude range    -15 — 13
Real → DN   dn = (rw - -3) / 0.1
DN → real   rw = 0.1 * dn + -3
DN range    0 — 255
Pixel dimensions    1.100149 x 1.100149
``````

On Arcmap it shows the pixel X/Y co-ordinates. How can I convert this to Long and Lat?

From the FAQ of the site that I downloaded the raster from the following information is provided. link

How do I convert image coordinates to latitude/longitude? For converting from x/y pixel co-ordinates on a Mercator projection image to latitude/longitude (lat/lon) positions use:

``````rows - number of rows in image
cols - number of columns in image
minlon/maxlon - minimum/maximum longitude of image (in decimal degrees)
minlat/maxlat - minimum/maximum latitude of image (in decimal degrees)
Note that these are the coordinates of the CENTRE of the corner pixels.
ln - natural log
Calculate longitude.

lonfract = x / (cols - 1)
lon = minlon + (lonfract * (maxlon - minlon))
Calculate latitude.

latfract = 1.0 - (y / (rows - 1))
Ymin = ln (tan (DEGTORAD * (45.0 + (minlat / 2.0))))
Ymax = ln (tan (DEGTORAD * (45.0 + (maxlat / 2.0))))
Yint = Ymin + (latfract * (Ymax - Ymin))
lat = 2.0 * (RADTODEG * (arctan (exp (Yint))) - 45.0)
``````

The maximum/minimum latitude/longitude values and sizes are given when the images are viewed.

Would it possible to run the above code in ArcMAP or R (raster package)?

• Use the `Define Projection` tool to define the projections of the image. Use `WGS 1984 Web Mercator (auxiliary sphere)` as the coordinate system.
• Use the `Project Raster` tool to project the image into WGS-84 coordinates (lat/lon). For that, specify the Output Coordinate System to be `WGS 1984`.