Thursday, 22 September 2016

qgis - Why do I get "Failed to transform" when reprojecting from WGS84 to Google Mercator?


I am attempting to re-project a vector shapefile from Natural Earth, following a qgis tutorial. Another user reported this error, but a solution has not yet been reported.


Given this post, and the last line of the error, I suspect that there is something wrong with the CRS setting, etc. Though, I have not been able to identify it.


   Export to vector file failed.
Error: Failed to transform a point while drawing a feature of type 'ne_10m_admin_0_map_units'. Writing stopped. (Exception: forward transform of
(3.141593, -1.570796)

PROJ.4: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +to +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
Error: tolerance condition error)

I am using qgis 1.8.0 on Ubuntu 12.05. Thanks for the help!



Answer



If you look at the extent of the layer, you get:


xMin,yMin -180;-90 : xMax,yMax 180;83.6341

Google Mercator projection is only valid between +/- 85.0511 degrees North/South, but the dataset contains also the south pole.


EDIT: The value of yMin=-90 forces the error in projecting to Google Mercator. The tutorial has a dataset that ends at -89.9998, which is nearly the same, but does not compute to inifity.



So you have to delete the objects around the south pole, to save the layer in Google Mercator projection.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...