I have a North Polar Stereographic image over the UK. The top left and bottom right coordinates are: (-17.644 E, 59.683 N) (9.231 E, 45.25 N).
I want to reproject this to UKNG (aka BNG) projection.
This is my code. First I using gdal_translate to append georeferencing data to my png, output as tif.
PROJ="+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs"
gdal_translate -of GTiff -a_ullr -17.644 59.683 9.231 45.25 -a_srs "$PROJ" the_image.png test.tif
Alright, so now I have geotiff with the appropriate bounds, I want to warp it to the UKNG projection
UKNGPROJ="+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"
gdalwarp -s_srs "$PROJ" -t_srs "$UKNGPROJ" test.tif plswork.tif
I then convert back to png so I can overlay on my OpenLayers map:
convert plswork.tif ohwhydoesntthiswork.png
And I get dodgy output. The image is diagonal and doesn't overlay onto the map correctly at all.
Both NP Stere and UKNG proj definitons come from the EPSG site, https://epsg.io/27700 , https://epsg.io/3411