1

Thanks for dropping in here. I'm currently working on a project, and I'm not that strong with python yet. So I was hoping for some constructive feedback on this question.

I have a dataset containing core samples, all stored with sample id, latitude, longitude, content and other data irrelevant for this question.

Now I've imported this dataset and sliced it as I want it to be. For the images I'm using the rasterio module to open 2 satellite images that covers the region. I'm using the utm module to convert back and forth between latlong->UTM->Pixel values (Which also seems to be throwing me strange coordinates at some points). Annoyingly enough, the two Sentinel-2 images are cut right across the center of the map. As I'm doing bounding boxes on top of where the samples are taken, this is a problem as I need to extract 10x10 pixel cut outs of that region. This leads to a lot of the samples not getting a proper cut out.

So I thought why not merge the two images together into one large rectangular bit. But I still need to retain the meta data with the UTM coordinates.

How would you suggest I proceed. Can it be done in an easy way? Is there another angle on this I've overlooked?

Thank you for your time.

enter image description here enter image description here

Mars
  • 341
  • 1
  • 3
  • 12

1 Answers1

1

I'm not sure I completely understand the question, but if you are simply trying to merge 2 images, have you looked at the command line tool gdal_merge.py?

A very simple example:

gdal_merge.py -o merged_image.tif image1.tif image2.tif

Ben DeVries
  • 506
  • 3
  • 6
  • Hi Ben, Thank you for your answer. I had not stumbled upon this option yet. I'll try it out asap and get back to you ( Which may not be until tomorrow if this SSH connection straightens itself out very soon!!) – Mars Sep 05 '18 at 15:44
  • Ben you are a goddamn hero. – Mars Sep 05 '18 at 16:34