Is it possible to convert a list of pixel locations (txt file) into lat long?

What I have is:

  1. (left_x: 137 top_y: 146)
  2. (left_x: 175 top_y: 236)
  3. (left_x: 182 top_y: 153)
  4. (left_x: 185 top_y: 166)

What I would like is to convert them to lat long so I can generate a points layer.

Currently using QGIS, and am new to Python.

  • Do you have anything that ties the pixels to a location? What are those pixel locations from? – TeddyTedTed Oct 31 '19 at 13:40
  • Not exactly, except for the image size itself, if that makes scenes. There a machine learning out put, that identifies the presence of a feature. It doesn't take into account any form of coordinate system, so I was hoping to bring the GeoTIFF back into QGIS (or something similar) and relate them back to the image? – Mícheál Oct 31 '19 at 13:48
  • So is the GeoTIFF a georeferenced aerial image or something similar? Or if it's not georeferenced and you know the approximate location you might be able to georeference it yourself. Can add the image or a screenshot to your question? – TeddyTedTed Oct 31 '19 at 13:52
  • Yes the GeoTIFF is georeferenced (29902, Irish Grid). Unfortunately I can't add an image or a screenshot right now, which obviously is ideal for this conversation! – Mícheál Oct 31 '19 at 14:01
  • And just to make sure, is it pixels on that GeoTIFF that you are trying to find coordinates for? Or is it an image that has been process from the GeoTIFF? If it has been processed from the GeoTIFF does it have the same extents, resolution, etc as the original? Also FYI if possible you should be using epsg 2157 ITM but that's neither here nor there for this. – TeddyTedTed Oct 31 '19 at 15:32

NOTE: Parts of this answer are specific to this user's case and probably cannot be generalised to others trying to do the same thing.

Create a new QGIS Project, set the CRS to epsg 29902 ING.

Add the GeoTIFF and if it asks you for a CRS then set it to the same as above.

If you can see which pixels you want coordinates for then you can use the Coordinate Capture (built-in core plugin, you may need to go to "Plugins > Manage and Install Plugins > Installed" and enable it) to get coordinates underlying the pixels. It should display to coordinates in both ING and Lat Long.

  • Hey TeddyTedTed, Thanks very much for that! That's a great help for now, I really appreciate the help! Do you think it would be possible to write a scrip to do this based on the pixel location and the image dimensions? Have you ever came across something like that? – Mícheál Oct 31 '19 at 16:30
  • I imagine it's possible but I wouldn't know how to myself. I imagine you would do something like find the location of pixel 0,0 using the extents of the projected image, then calculate pixel coordinates based on the resolution of the image. – TeddyTedTed Nov 1 '19 at 9:12
  • 1
    Yea, that's kinda what I was thinking! Think I need to head down that route, for efficiency sake, but thanks again for your help! – Mícheál Nov 1 '19 at 9:59

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.