2

I'm developing a python script to turn Sentinel-1 satellite images in .SAFE-format into easy-to-read jpeg images. The calibration and projection works fine using gdal, but I am having trouble with the last part.

I want the generated image to have a graticule overlay, making it possible to reference geographical spots on the image. I feel that such a normal problem would have a built-in function or some library to solve, but I can't seem to find any. Does anyone have any ideas or tips on this matter?

Since the tif-file have the coordinates of each pixel it would be possible to make a transparent copy of the image, drawing the lat/long lines "by hand" using PIL and then placing this image on top of the other, but this seems like an awful lot of work.

I'm fairly new with gdal.


Sentinel-1 test image from Barents Sea

Using mkgraticule.py i've managed to make the grid lines I wanted. However, they won't help that much if they're not numbered (lat/long for each line). From what I can see mkgraticule don't have this option so I suppose I'll have to find another way.

7
  • Welcome to GIS StackExchange. I don't have any first-hand experience using this, but have you checked out Frank Warmerdam's mkgraticule.py? (see github.com/postmates/gdal/blob/master/scripts/mkgraticule.py). I believe it makes a shapefile you could then combine with your images using other gdal functions.
    – cm1
    Dec 20, 2017 at 16:04
  • Thanks a lot, this seems to be exactly what I need, I will look into it right away.
    – PederBG
    Dec 20, 2017 at 16:11
  • 2
    Prepare the graticule as vectors and burn it into image with gdal_rasterize. Rather similar task in gis.stackexchange.com/questions/247052/…
    – user30184
    Dec 20, 2017 at 17:11
  • Burning the shp file into the image seems easy enough since the functions are pretty well documented, but I can't seem to find any documentation for the mkgraticule.py-script. python mkgraticule.py --help just shows the syntax. When I run python mkgraticule.py outfile.tif it returns an error saying outfile.tif does not exist. And if I use a existing tif-file it overwrites it. Thanks again for the response.
    – PederBG
    Dec 20, 2017 at 17:44
  • 1
    Yea, I got confused since the script throws an error, but it's just to ignore it. Everything works fine and the files are created.
    – PederBG
    Dec 20, 2017 at 19:40

1 Answer 1

1

Welcome to GIS StackExchange. I don't have any first-hand experience using this, but have you checked out Frank Warmerdam's mkgraticule.py? (see github.com/postmates/gdal/blob/master/scripts/mkgraticule.py‌​). I believe it makes a shapefile you could then combine with your images using other gdal functions.

Found another goodie you might want to take a look at here (https://lists.osgeo.org/pipermail/gdal-dev/2015-June/041999.html) links to https://lists.osgeo.org/pipermail/gdal-dev/2015-June/041999.html

1
  • Thanks again, I'm working with it now, i'll comment later on how it goes :)
    – PederBG
    Dec 20, 2017 at 16:36

Your Answer

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

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