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

Martin Häggström cjmhaggstrom at gmail.com
Fri Apr 14 09:15:28 PDT 2023


Hi,

Yes, I have ordered an ESP32 board (Inkplate 6plus) which I am planning to
use as a portable selfcontained map-viewer (solar charged). My initial plan
was to try using as close to "raw" data from sources as possible, to
minimize hazzle with updating the maps. This would mean doing all
processing on the device and send the image directly to the screen, but
after playing around with gdal/qgis I have realised that plan might have
been a bit too ambitious.

Thanks for your suggestions, I realise I have focused too much on the
GeoPackage-part (a search that led me to gdal in the first place). I think
the ideal for my usecase is some sort of vector format which I can
dynamically filter on the device during rendering to cram as much info as
possible into the 16 shades available on screen. I will research other
vector formats and what suitable (C/C++) libraries and utilities are
available.

As a last case fallback I guess X/Y/Z raster tiles rendered in a compressed
4bpp form would suffice, if vector processing is too much for the device.


On 14 April 2023 10:35:56 UTC, "Cainã K. Campos" <rupestre.campos at gmail.com>
wrote:
>
> Hi Martin,
>
> there are a few options but using gdal directly may not be so easy,
> I'd love to hear how to do it using gdal only.
> Just to understand better, some information on your setup would help,
> like how do you plan to access those black n white tiles, over network or
> local only?
> Machine and setup specifications, is it a rpi4, 3 0 or ESP32 or what?
> Spare parts to create a server and a client or just a single board?
> I ask it because the process to read a vector and produce a tile may
> require some processing power.
> As you said you are using Qgis, try it on server mode, where you can
> publish the maps you create on the local network. This way you setup styles
> as you create a map in qgis.
> Other options out there for publishing vector data :
> Spin a geoserver and set the style of the map layers, also you may combine
> two or more in order to make a single request, create cache and more.
> Using Postgres/postgis and pg_tileserv you may create vector tiles and
> render it on the client, or on a custom server middleware.
> If you are going offline and your machine has lots of processing power,
> like a rpi4, just self-host those services on the machine and point
> services to localhost:port_number.
>
> On Thu, Apr 13, 2023 at 6:16 PM Martin Häggström <cjmhaggstrom at gmail.com>
> wrote:
>
>> 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
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230414/1f126469/attachment.htm>


More information about the gdal-dev mailing list