TransWikia.com

Is there a way to rasterize polygon with hatch pattern with GDAL CLI or in a Python script?

Geographic Information Systems Asked by walkingpendulum on April 6, 2021

I am trying to automate some work previously done in QGIS. Target platform is AWS Lambda so there is no way to use QGIS or any other standalone GIS-specific application.

QGIS provide a way to draw polygon on GeoTIFF, fill polygon with hatch pattern, and then export result as a PNG picture. I am trying to re-create this behavior with Python and GDAL only.

Polygon is stored as feature with single polygon in GeoJSON format. Currently I am able to render polygon with gdal_rasterize and then combine result with original GeoTIFF with gdal_merge.

What’s the problem?

I couldn’t find a way to programmatically fill (originally stored in GeoJSON format, rasterized, saved in GeoTIFF format) polygon with hatch pattern.

What I tried?

Not much.

First of all, there is a Feature Style Specification page that defines the way feature style information (i.e. colors, line width, symbols, etc.) should be handled at the various levels in GDAL’s vector drivers (OGR). And there is no GeoJSON among vector drivers that provides support of feature style information.

On the other hand, on the same page I found few other vector drivers, that claimed to support feature style information and support georeferencing at the same time: LIBKML, DGN, PDF, JML, MITAB, CAD. None of them is familiar to me.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP