Qgis has this amazing Create Grid function. Is there an alternative for python / unix command line?
I've found Gdal_grid but it is not the same. The goal is to eventually create a hexbin heatmap.
gdalogr
Qgis has this amazing Create Grid function. Is there an alternative for python / unix command line?
I've found Gdal_grid but it is not the same. The goal is to eventually create a hexbin heatmap.
Best Answer
Use GDAL with the SQLite/Spatialite dialect. Then you can utilize the ST_HexagonalGrid function that is documented in http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html.
The result is naturally collection of hexagons, not squares. Obviously manual text is copied from ST_SquareGrid function.
Usage example with ogrinfo follows. For ogrinfo there must be some bogus datasource, I used a shapefile "temp.shp".
The result as WKT:
And this is how it looks. The input geometry that was to be covered by the grid is shown as a yellow rectangle.