Converting raster XY co-ordinates to lat/long

6151
14
08-29-2016 01:35 AM
LamaZip
New Contributor

I have downloaded a SST image of the United Kingdom. It is in PNG format with no coordinate system.

 

I know the dimensions of my image and its lat/long range. However, i'm not sure what approach to take in Arcmap to set the co-ordinate system.

 

There is a web-page describing how to convert image co-ordinates to latitude/longitude but it is beyond my scope link

 

The image is apparently produced in Mercator projection

 

Note, this will need to be carried out on multiple rasters, so a automated/batch approach, which isn't interactive or manual, is required

1. is there anyway to automatically convert the XY pixel co-ordinates to lat and long, by knowing the lat/long range of the image and the dimensions?
2. If not, how would one do this calculation to convert image XY co-ordinates to lat/long in Arcmap / Python? 

 

Details of Image

Dimension   1596 x 1617 
BPP 8 
Latitude range  47 — 62.999108
Longditude range    -15 — 13
Pixel dimensions    1.100149 x 1.100149
0 Kudos
14 Replies
ChrisDonohue__GISP
MVP Alum

I saw this in the documentation, which may resolve part of the puzzle.  As for the rest, though....not sure.

  • What datum and ellipsoid do you use to map the data?

Panorama uses a sphere of diameter 6370718 meters to approximate the Earth's surface. This is used as the datum baseline for all mapped processing. The regional Molodensky offsets between the sphere and a WGS 84 ellipsoid based datum are available on request.

https://www.neodaas.ac.uk/faq/#datum 

Adding Melita Kennedy 

Chris Donohue, GISP

0 Kudos
DarrenWiens2
MVP Honored Contributor

You can place the raster semi-manually by creating a world file. For your example file (janW1.png), the world file name would be janW1.pngw.

Here is an example using the following world file (lines 5 & 6 should be adjusted by half a pixel to move to the pixel center):

0.017543859
0.0
0.0
-0.009894315
-15.0
62.999108

...and here is the result, although it doesn't match exactly. This may be due to cdspatial‌'s note about a funky ellipsoid (this is over WGS84):

LamaZip
New Contributor

Hi Chris. 

I manually converted the XY coordinates to lat and long using the calculation provided on the webpage. 

I assumed I had done the calculation wrong, but luckily this world file shows that it is correct as we have got the same result.

Could you explain how to `(lines 5 & 6 should be adjusted by half a pixel to move to the pixel center):`

and why it would be necessary? 

Also do you have any tips for the aligning the offset? Thanks. 

0 Kudos
ChrisDonohue__GISP
MVP Alum

Punting this back to one of the experts:    Darren Wiens 

Chris Donohue, GISP

0 Kudos
DarrenWiens2
MVP Honored Contributor
(lines 5 & 6 should be adjusted by half a pixel to move to the pixel center)

Lines 5 and 6 in the world file are supposed to reference the coordinates of the upper left pixel center, but I was lazy and just used the upper left coordinates of the raster (so, the coordinates correspond to the upper left corner of the upper left pixel). Because the raster is shifted by much more than a pixel, being off by half a pixel doesn't really matter, for now.

0 Kudos
LamaZip
New Contributor

I see. Thanks for the explanation! 

Any idea on what I can do to shift the PNG into the correct co-ordinates? It's so close, yet so far.

0 Kudos
MelitaKennedy
Esri Notable Contributor

Even though they say it's in Mercator, there's a bunch of north-south distortion at those latitudes. The Y range is almost 3 times the X range in Mercator (approximately--I didn't use the sphere values) so as Darren demonstrated, it looks like the raster is really in lat/lon (geographic CRS).

I'm also attaching a Panorama prj file. You would script in a call to Define_Projection to set this coordinate system.

You may need to also define a transformation to pick up the difference between the sphere and WGS84. You can use the Create Custom Geographic Transformation tool. Use the geocentric translation method and leave the parameter values set to zeroes.

You might also query the data provider for the "regional molodenky transformation values." If the sphere model is earth-centered, the Molodensky parameters should be zeroes unless they're making some other kind of adjustment.

Melita

LamaZip
New Contributor

Hi Melita. 

I'm not sure if i'm doing this correctly but I selected my image, then went to raster -> define projection ->. Selected my PNG as the input and imported GCS_panorama as the coordinate system. 

However, this is the resulting image. Not sure what's happened but it's very different from the original. 

0 Kudos
MelitaKennedy
Esri Notable Contributor

What's the data frame's coordinate system? And the raster's extent after the define projection?

Thanks!

Melita

0 Kudos