2

I am trying to make a simple flag map of the world. I use raster fill and import an image of the flag, which is a PNG file, and that fills up the polygon of the country.

While I can increase and decrease the size of the image, I am not able to move it.

In this example I want the blue centre wheel of the indian flag to be in the centre of the country.

enter image description here

When I offset the image, the whole country seems to move but the flag position remains the same enter image description here

When I use draw effect to translate the image even a bit, the whole image disappears

Is there any way to move the raster image?

I use QGIS 2.18

1

The issue is that the image left-aligned rather than center-aligned. Unfortunately this isn't a setting you can change. You can work around this by editing the image.

The Indian flag is wider that it's tall, whereas India is taller than it is wide. So you want to edit the image by cropping off the left side. It will take some trial and error to get the proportions correct.

enter image description here

Note: I tested this using this image file of the Indian flag. When I tried to edit this image, I wasn't able to save the edited version. I guess there's some kind of protection built into the file. I got around that by taking a screenshot of the image, and editing the screenshot.

  • Ok. This is unfortunate. Many countries, like Germany, Belgium and Russia will be easy because of simple stripes. But for countries like Croatia, Angola, etc that have specific symbols, I will have to edit their flags. I will wait for a few more days to see if anyone else has answers. Thanks – Dhaval Shukla Jul 7 '18 at 6:47
  • 1
    There might be a python-based solution that would crop the images based on each country's height to width ratio. That's not something I know how to do, but it seems like it would be possible. – csk Jul 8 '18 at 18:58
  • Or you could see if adding a small polygon part west of India results in the image being shifted to the west. (I haven't tested this, so I'm not sure if the raster fill method starts the image over for each part of a multipart polygon.) – csk Jul 8 '18 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.