[GIS] Losing polygons after projecting map in QGIS

coordinate systemqgisshapefile

I'm fairly new at GIS, but I've run into a problem with a projection of a world map. I have a shapefile of all countries I downloaded from Natural Earth. After projecting it into a orthographic as suggested in How do I project a Azimuthal Equidistant global map into a circle in QGIS?, I changed the lat/long so that the Atlantic would be somewhat in the center.

However, after changing it, the United States, Mexico and Canada disappear from the map, as you can see here:
enter image description here

When I reproject the map to a long over the US, the polygons appear again.

Any suggestions?

Best Answer

The simple reason why QGIS can not draw these polygons is because some of the vertices are on the backside of the globe, and QGIS can not draw a closed polygon with the rest. The GDAL ogr2ogr function in the background is programmed to kick off the whole feature when such an error occurs.

So you have two solutions:


Solution 1: Clip your polygons to the hemisphere

You need Numerical Digitize and CAD Tools plugin for that.

  • Set the project CRS to ortho projection
  • create a new point layer in the same projection
  • with the Numerical Digitize plugin, create the following points:
x y
6370000 0
0 6370000
-6370000 0
0 -6370000

(should also work with Add delimited text layer)

  • enable snapping on the point layer
  • with CAD Tools, select the first three points and create an arc from them
  • do the same for points 3 - 4 - 1 for the southern hemisphere
  • change project CRS to WGS84
  • Save the CAD layer as WGS84 and add that to the canvas
  • Save your boundary layer also as WGS84 and add it to the canvas
  • convert the CAD lines to a new polygon layer
  • remove all except the polygon layers
  • clip the world boundaries to the CAD polygon layer
  • set project CRS back to ortho

You should get this picture: world vector in ortho projection


Solution 2: Convert your vector data to raster

  • in Settings, disable on-the-fly-reprojection
  • Save your boundary layer as WGS84 and add that to the canvas
  • Use Raster -> Convert -> Rasterize on the WGS84 layer select x=360 and y=170 as dimensions for the raster (or n*360 and n*170)
  • Use Raster -> Projection -> Reproject to the ortho projection under another name and add it to the canvas. You will get some errors, but the rest of the raster will do. Don't bother that you see a grey rectangle
  • Rightclick on the raster layer -> Properties, Style tab
  • choose pseudo colours
  • in transparency tab, choose 0 for 100% transparency
  • Remove the first raster
  • set project CRS to ortho

you should see the follwing picture: enter image description here

The same method works with rasters, as you can see in my avatar picture ;-)


EDIT

To get a nice ortho projection centered on a point not on the equator, do the clipping in an aeqd projection with the same parameters as the ortho. You will get this result:

enter image description here

Related Question