Skip to main content

Question:
I need to generate a square georeferenced PNG where:

  • the interior of a geographic region is transparent,

  • the exterior is filled with a solid color (e.g., gray).

Currently, I have two geometries in EPSG:2056, which I merged using a junction node.

How can I produce a single georeferenced PNG with these properties?

I’ve attached my script and the two input files.

 

Hi ​@gbcfgeo2025 ,

I suppose that you are attempting to create a raster which draws a polygon read from CANTON onto a transparent rectangle read from Masque.

If I understand your requirement correctly, FeatureColorSetter and ImageRasterizer might help you.

The screenshot below illustrates a workflow example. X/Y Cell Spacing (100) and Background Color (1,1,1) are just examples, modify them preferably.

Alternatively, VectorOnRasterOverlayer coud also be helpful, as in:

Result : The red rectangle represents the extents of the resulting raster, originated from Masque.

Just be aware PNG format doesn't support coordinate system. If you need to create a truly georeferenced raster, consider using other raster format which supports coordinate system - e.g. GeoTIFF.

 


Oh, I misunderstood your requirement, interior of polygon should be transparent and background should be colored. Workflow would be simpler.