Here’s an interesting example using GDAL:
You can also try to use Snapista
Perhaps you can find some of the examples useful.