Reprojecting "Admin 0 – Countries" to Web Mercator

Home Forums Natural Earth Map Data Cultural Vectors Reprojecting "Admin 0 – Countries" to Web Mercator

This topic contains 1 reply, has 1 voice, and was last updated by  dmillz 4 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4710

    dmillz
    Participant

    Hi,

    I’m trying to reproject the 1:10m “Admin 0 – Countries” shapefile into a Web Mercator projection (EPSG:3857) using QGIS. However, the reprojection fails with the following message:

    Export to vector file failed.
    Error: Failed to transform a point while drawing a feature of type ‘ne_10m_admin_0_countries’. Writing stopped. (Exception: forward transform of
    (3.141593, -1.570796)
    PROJ.4: +proj=longlat +datum=WGS84 +no_defs +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
    Error: tolerance condition error)

    I receive this error for both “ne_10m_admin_0_countries” and “ne_10m_admin_0_countries_lakes”.

    A post on gis.stackexchange.com indicates that it might be a problem with points in Antarctica going to infinity during reprojection, but I’m not sure how to fix it if that is indeed the problem.

    The 1:50m “Admin 0 – Countries” shapefiles are able to be reprojected successfully using QGIS, which leads me to believe that the root of the problem may lie in the 1:10m shapefiles.

    Can anyone provide some assistance and/or confirm that there’s a problem with the 1:10m shapefiles?

    Thanks!

    Regards,
    Dave

    #4712

    dmillz
    Participant

    I received a small amount of assistance with this on StackExchange: http://gis.stackexchange.com/questions/63444/reprojecting-natural-earth-admin-0-countries-shapefile-to-web-mercator

    Short answer: The 1:50m shapefile has its southernmost line at approximately -89.9989, while the 1:10m is at -90.0. When attempting to reproject the portion of the feature at -90.0, the projected point goes to infinity and triggers the error.

    In order to work around the problem, I was able to trim off the bottom of Antarctica using the “Reshape Feature” tool in QGIS. There’s a decent description of how to use it here: http://gis.stackexchange.com/a/21651/1770. After removing the southernmost portion of Antarctica, I was able to successfully reproject the map.

    To save everyone some time, I’ve posted the files. These are the “_lakes” files that do NOT include boundary lakes:

    * Original file in WGS 84 (EPSG:4326), but with the bottom 0.4 degrees of Antarctica trimmed off. You should be able to reproject this file without issue: https://github.com/dmillz/misc/raw/master/shapefiles/ne_10m_admin_0_countries_lakes-trimmed_antarctica.zip

    * Same file, but reprojected into Web Mercator (EPSG:3857): https://github.com/dmillz/misc/raw/master/shapefiles/ne_10m_admin_0_countries_lakes-EPSG_3857.zip

    I hope this helps other folks who might run into the same issue :-)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.