5

I'm trying to export two layers based on the current view or "extent":

  1. A black and white "raster" derived from some vector data
  2. A map layer (Bing, Google, osm, etc)

The issue I'm having is that the raster layer (#1 above) has an aspect ratio that seems to be saved wrong, causing my data to not overlap correctly, and an obvious stretching (images below)

  1. Warped Image enter image description here
  2. Expected Image enter image description here
  3. Save Dialog settings enter image description here I'm exporting the extent by right clicking on the layer, selecting Export > Save As, then setting the extent to the map view and saving as GeoTIFF. I'm saving it as the same format it came in as (WGS 84 EPSG:4326), and everything is lined up perfectly in the map view.

When using: Project > Import/Export > Export Map to image, it works perfectly :shrug:

1 Answer 1

4

Welcome, Kevin. I don't have enough "reputation" to ask some clarifying questions as a comment first, but I'll hazard an answer.

Your issue is that your raster's grid is not actually square. When you Export Map as image, it accounts for it appropriately. But when you save the raster as a GeoTIFF, raw data, you see the horizontal and vertical resolutions are different. If you then view that GeoTIFF in a viewer that doesn't interpret it geospatially, but just as an image (my guess what you're doing?), the viewer assumes the pixels are square just like your screen, and that's why you get a stretch. It's also consistent with the black-white colour switch; I would guess your raster when displayed has had a styling applied that uses a reversed black-white colour map. Your raw data saved GeoTIFF is just a saved representation of the actual data, in its rectangular rather than square grid, with 0s and 1s.

You get around this with Export Map to Image, which says "what square pixel image needs to be shown on screen to represent this data in the chosen map projection and styling", and where sometimes one "row" of spatial data will be more or fewer rows of screen pixels to make it work. I think you should also be able to get around it by a) changing the horizontal and vertical resolution in the dialog to be the same, or b) choosing or defining a different map projection which is less distorted at your position (for Mercator projection, at your latitude). It may also get fixed if you c) select save as Rendered Image rather than Raw Data (but my QGIS is unhappy right now and so I can't test it...)

1
  • Thanks for the answer! Seems I can manually size it... maybe there's an easier way to accomplish what I want (or a plugin). All I want is to say "export each layer of map extent / boundary" separately. I was planning on doing it with python, but figured there'd be a nice GUI tool for this. Export Map to Image will at least get me started :D Commented Feb 17, 2019 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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