2

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

1 Answer 1

3

That site is actually not EPSG site. It is maintained by the MapTiler team but it tries to mirror the original data from https://epsg.org. Proj strings are probably OK even 3411 is deprecated (see 3413). But please pay attention to units in EPSG:3411 +units=m

Next have another look at your command

gdal_translate -of GTiff -a_ullr -17.644 59.683 9.231 45.25 -a_srs "$PROJ" the_image.png test.tif

You must convert the ullr coordinates from EPSG:4326 into EPSG:3411. I am not sure is georeferencing with two corners gives good result in this case but have a try.

You can safely use EPSG codes instead of proj strings, and when you have attached the projection into GeoTIFF with -a_srs you do not need to use -s_srs because GDAL will find it anyway from the image metadata.

3
  • Thank you for your reply. I've converted the ullr coords from epsg:4326 -> 3411. They come out as: -a_ullr 1543965.24 -2984217.75 4138243.37 -2981192.93. Even with that, the final output (omitting the -a_srs) is even weirder!
    – dwright
    Commented Oct 30, 2020 at 15:15
  • 1
    You can use -t_srs epsg:27700 for avoiding copy-paste errors. Using OpenLayers as a viewer adds more possible sources for errors. I recommend to check the result with QGIS instead.
    – user30184
    Commented Oct 30, 2020 at 15:42
  • Hi, it does appear georeferncing with two corner only gives bad results. Do I have any other options?
    – dwright
    Commented Nov 4, 2020 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.