Skip to main content
Question

How to create a georeferenced PNG with transparent interior and colored exterior?

  • September 9, 2025
  • 2 replies
  • 55 views

gbcfgeo2025
Contributor
Forum|alt.badge.img+3

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.

 

2 replies

takashi
Celebrity
  • September 9, 2025

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.

 


takashi
Celebrity
  • September 10, 2025

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