[gdal-dev] Rendering/rasterizing GeoPackage vector to grayscale

Martin Häggström cjmhaggstrom at gmail.com
Thu Apr 13 14:15:16 PDT 2023


Hello all,

I am trying to read vector GeoPackage files in order to render a custom map
suitable to display on a 3bpp e-ink screen (8 grayscales per pixel). I am a
complete noob in anything related to GIS and mapping and all terminology,
but I have managed to use GDALRasterizeLayers to burn (almost) all features
of the vector layers into a raster GTiff. However, I have no idea how or if
I can apply any sort of styling while using this procedure.

Using GDALRasterizeLayers I get an image containing all the different
features on the map as specific pixel values, which I could color
differently as a post process, but I can not change _how_ the features are
renderad in the first place (different brush, stroke width etc). I have
tried using OGRFeature::SetStyleString() on the source layers, but it does
not seem to have any effect.

Using QGIS I can read the GeoPackages together with a .qlr file to get a
map that looks as it originally should, and from there I can "Export map to
image" and generate XYZ tiles (I haven't gotten these to look exactly
correct though), but I would primarily like to find a way to
programmatically render tiles on the fly directly to my custom screen.

Am I using the correct approach for creating a bitmap image from vector, or
is rasterize meant for other use cases? It seems most examples focus on
data processing rather than map rendering. I am unfamiliar with the
terminology so I worry I might be going the wrong direction entirely when
searching for the solution.

Best Regard,
Martin Häggström
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230413/5a4c0ec3/attachment.htm>


More information about the gdal-dev mailing list