2

I have the image such as this:

enter image description here

everything would be fine, but I cannot really use the normal georeference method explained here:

https://www.qgistutorials.com/en/docs/georeferencing_basics.html

because I can't see the boundaries at all. I tried to set up the georeference points manually, although even there I have to put them in the map and alternatively provide the coordinates manually. My situation is somewhat upside down, because I can't see the image borders, but I know roughly the coordinates of its corners and the middle point. The problem is, that I don't know how to find it with the Georeferencer plugin.

I found some hints, which say, that the process is possible with GDAL:

How to geo-reference a tif image knowing corner coordinates

Georeference image using center point and size?

but the problem is, that I don't know how to run the GDAL console and where to put these values in.

The links beneath:

https://gdal.org/programs/gdalinfo.html

How to edit the GDAL/OGR console call in QGIS 3.0?

weren't helpful enough for me.

I am asking then about the possibility to georeference the PNG raster image in the situation, where borders aren't visible (the image includes transparent white background, so any styling couldn't work) but the coordinates of the corners and the middle point are known. Alternatively, is there an opportunity to see the image bounds in the GDAL georeferencer plugin?

UPDATE:

After typing in the OSGEO console

     gdal_translate -of GTiff -a_srs 'EPSG:<4326>' -a_ullr <-3> <52> <-2> <51> <C:\Users\k\Desktop\elrrachidia - fez\Viewshed\Heywhatsthat\BHX\cloakpN52W003.png> <C:\Users\k\Desktop\elrrachidia - fez\Viewshed\Heywhatsthat\BHX\cloakpN52W003.tif>

I am getting an error:

< was unexpected at this time

How I did wrong here?

9
  • 1
    You could create the pgw file, if you know the coordinate of the corner and the resolution!
    – katagena
    Nov 1, 2021 at 11:11
  • Where can I create this type of file?
    – MKR
    Nov 1, 2021 at 11:12
  • Just create it in a text app, and change the extension! en.wikipedia.org/wiki/World_file
    – katagena
    Nov 1, 2021 at 12:24
  • yes, but how to include the .png image within it? In the text app I can only provide the coordinates and that's it
    – MKR
    Nov 1, 2021 at 15:13
  • 1
    I had my comment as a answer cause it's a bit long...
    – katagena
    Nov 1, 2021 at 15:58

2 Answers 2

4
+50

Yes, just say that you work in meter, and the resolution of your png is 25 cm, and your png has no rotation. So your pgw file looks like that:

0.25

0.00

0.00

-0.25

2539000.049999999813735

1153999.949999999953434

Save it as name_of_your_png.rtf and change the extension to pgw. So it means:

  • Line 1: resolution in x (25 cm)
  • Line 2: no rotation in y
  • Line 3: no rotation in x
  • Line 4: resolution in y (25 cm)
  • Line 5: coordinate in x for the center of the upper left pixel (change it for fitting your case)
  • Line 6: coordinate in y for the center of the upper left pixel (change it for fitting your case)

When you load your PNG, no need to have GDAL.

3
  • OK, It seems to work, although is there some way to put the coordinates the same as WGS 84? Your example coordinates 1153999.94999999953434 correspond to Latitude 10.3250N and 2539000.04999999813735 to Longitude 22.84924E. How to make it suitable i.e. with WGS84? I have an error: CRS not defined - defaulting to WGS84. Is there any way to set the CRS in the PGW file?
    – MKR
    Nov 3, 2021 at 16:42
  • from what I understand world files never have CRS stored in them, you need to define the CRS manually when loading it into a GIS, see this answer gis.stackexchange.com/a/349278/98784 (note it also suggests the option of using a .prj file but this hasn't worked for me).
    – she_weeds
    Nov 4, 2021 at 22:56
  • Correct. Don’t need to set a CRS. Once the PNG loaded, you can give it the correct CRS.
    – katagena
    Nov 5, 2021 at 11:04
2

You can use gdal_translate (https://gdal.org/programs/gdal_translate.html) with parameter -a_ullr to georeference your image. In the example below I'm georeferencing a PDF file:

gdal_translate --config GDAL_PDF_BANDS 4 --config GDAL_CACHEMAX 1024 -co NUM_THREADS=ALL_CPUS -co COMPRESS=DEFLATE -co ZLEVEL=9 -co PREDICTOR=2 -co TILED=YES -a_srs EPSG:31255 -a_ullr 9623.23 326346.38 9933.23 326090.63 file.pdf file.tif 
6
  • yes I think I know it. The problem is, that I have no knowledge of where to put these expressions in.
    – MKR
    Nov 1, 2021 at 11:25
  • You have to enter the command in the OSGeo4W Shell.
    – christoph
    Nov 1, 2021 at 11:27
  • I am getting an error: < was unexpected at this time. See my question update
    – MKR
    Nov 1, 2021 at 15:19
  • If you remove all < and > it should work.
    – christoph
    Nov 1, 2021 at 17:37
  • Now I have: ERROR 6: Unknown option name '-'
    – MKR
    Nov 8, 2021 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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