# Calculating distortion on Equirectangular Projection

I am trying to calculate distortion so I can distort overlaying text and forms to precisely match an image of an equirectangular projection.

How does one calculate the distortion at a given latitude on an equirectangular projection 1:45,000,000 (say, 2000 pixels wide x 1000 pixels high)?

I've been trying to figure out this post and its links to no avail: How to create an accurate Tissot Indicatrix?

I am not a professional, just a very interested amateur.

Here's the long story.

I am visualizing/mapping data using the Processing programming language and would like to have the 2D mapped data (different sized fonts and circles) appear undistorted when wrapped to a 3D globe. The data is mapped using equirectangular x, y's and the maps I want to use as backdrops are all this projection, so I'm assuming I want to "match" this distortion (e.g. by calculating distortion via latitude using Tissot equations?). Using the programming language I can precisely distort both the text and the circles. I think all I need are the equations to do it correctly.

Here is the original 2D data map:

When wrapped it looks distorted, like this:

How can I make my 2D image look undistorted when wrapped to the 3D sphere?

For reference, here's the same question asked differently on the Processing forum.

I'm not sure I want to reproject to an orthographic projection. I want my 2D data map to wrap to a 3D sphere model that can be interacted with (i.e. spun).

I am using a 3D modeling program (Cinema 4D) to wrap a sphere with a 2MB "Blue Marble" image (equirectangular projection) from NASA.

When wrapped it appears undistorted from all hemispheres (not just one hemisphere, as an orthographic projection would be?), see: still from 3D model above. (The modeling program is doing the orthographic projection for me as I rotate the object, I suppose.) Therefore, I think that if I distort my 2D data map in a similar way it too will appear undistorted on the 3D sphere. Here's a shot I took with an equation that approximates equirectangular distortion. You'll notice the egg shaped ellipses from the 2D image look like a circle when wrapped to the 3D sphere. Similarly, the Tissot ellipses also appear as circles on the 3D sphere.

This is why I was looking at the Tissot equations...to more precisely figure out the distortion of the equirectangular projection at different latitudes so I could distort my overlay accordingly.

Perhaps I should use a GIS program. I just downloaded Cartographica and will see if I can figure it out.

Any Mac software suggestions for someone new undertaking this task?

• Do you really mean calculating the distortion or do you really want to know how to calculate the projection itself? Perhaps you could make an image available on the Web to illustrate what you're trying to accomplish. Your use of "match" suggests you would like to determine how to transform one image to another, indicating you need to specify what you're starting with as well as what you want to end up with. Commented Jun 27, 2012 at 22:27
• We understand it is hard to describe what you want to do without knowing the jargon, but it sounds like you're trying to describe the process rather than the result. Try starting with a problem you want to solve, then the results you would like, and we'll try to fill in the gaps :) Commented Jun 27, 2012 at 23:37
• In technical terms: you want to reproject from the equirectangular projection to an orthographic ("world from space") projection. What software can you use? If you have GIS software or are willing to code against a projection library, the work is basically done for you. Otherwise, you need to implement the equations for unprojecting the equirectangular projection (easy) and projecting the orthographic projection (not too hard, but requires some skills in coding numerical routines). Commented Jun 28, 2012 at 14:07
• I saw this post and I'm trying to basically do the exact same thing. I want to draw 2D circles that distort correctly when projected onto a 3D sphere. I was wondering if you would be willing to share the algorithm you used for the distortion of the 2D circles? Should really have been a comment not an answer, but I wrote it in the wrong spot. Sorry. Commented Jul 25, 2012 at 3:37
• You should draw your data in 3D space then project it back to the sphere. Commented Nov 19, 2012 at 8:59

## 4 Answers

How can I make my 2D image look undistorted when wrapped to the 3D sphere?

The image coordinates are latitude and longitude, so you either

(a) Unproject it and reproject it using an orthographic or vertical near-side projection (that is, projections that look like the world from space) or

(b) Texture-map it onto a 3D model of a sphere using lat-lon as the texture coordinates and display that sphere with a 3D graphics rendering device.

Most GISes do (a) routinely. To illustrate (b), here is a set of images derived from the "flat" map in the question taken from a viewpoint orbiting the texture-mapped sphere:

(If you look closely at the rightmost image you can see a prominent meridian through the Pacific Ocean: this is the "seam" formed by wrapping the left and right sides of the map together.)

The basic Mathematica command to produce one of these is

``````SphericalPlot3D[1, {a, 0, \[Pi]}, {b, 0, 2 \[Pi]}, Mesh -> None,
PlotStyle -> {Texture[i]}, TextureCoordinateFunction -> ({#5, -#4} &),
Lighting -> {{"Ambient", White}},
Boxed -> False, Axes -> False, Background -> Black]
``````

This reduces the original problem (of drawing "data maps" on a sphere) to generating a map that shows circles correctly. The best projection for this is the Stereographic, because it projects all circles on the sphere--no matter what their size--to circles on the map. Thus one procedure to draw large circles correctly in an Equirectangular projection, as shown in the question, is to create them in a Stereographic projection and then unproject them to geographical coordinates (lat, lon). Using (lon, lat) as (x,y) Cartesian coordinates to make the map is tantamount to the Equirectangular projection and so is suitable for texture-mapping onto the sphere or for applying an Orthographic projection.

Note that Tissot indicatrices are not suitable as a solution: they only represent local distortions of infinitesimal circles. Circles large enough to see at a global scale will no longer even appear circular in most projections: witness their blobby appearance in the map in the question. That's why playing games with projections, as shown here, is essential to a good solution.

• Thanks for the very informative post! I am taking (b) as my approach and have a correctly generated equirectangular map at hand, but get ugly pole distortions while mapping the map to 3D sphere. Would you very kindly help? gis.stackexchange.com/questions/245315/… Commented Jun 25, 2017 at 21:36

Assuming the shapes being drawn cover a small portion of the sphere, you should be able to get by with scaling the width by 1/cos(lat) and leaving height alone.

The larger the shape and the closer you get to the poles, the less well this will work though.

• Could you please explain why this would work? It looks like it would fail dramatically even at small portions of the sphere near the edge of its rendering in the example images. Commented Dec 17, 2012 at 22:00
• Thank you for the edit; I have accordingly removed the downvote because your answer looks correct to me and might be of use to somebody in the future. In reviewing the question, though, it seems unlikely anybody would be wrapping such small shapes around the sphere--and when they do, they're going to need to deal with the poles and everywhere else, too, I imagine. Commented Jan 28, 2014 at 20:37

See, your first 2D map does not have geographic features drawn. Add them to this map (say Africa contour), and apply the distortion that you are thinking of to everything at once. The geography would become also modified, and when you put it on the sphere, it would be wrong. Therefore, I believe this idea to have some distortion applied would not work.

You may get by in 2D, by drawing graphics in small 2D maps that have limited area and acceptable distortion. You may cut you 2D map into tiles and for each tile use it's own "best" projection.

From the other hand it is easy to create points on a geodesic circle of given radius on the 2D map. For that you'd need to find a function that calculates lat/long of a point at a given distance and azimuth from another point (search for "direct problem Vincenty"). Once you got that, you can generate bunch of equidistant points at a given distance from the point by changing the azimuth from 0 to 360. Making a polygon out of those points in 2D requires more work when the geodesic circle contains a pole, or intersects left or right boundary of the map. Check out how geodesic circles may look like on a flat map here.

I can't figure out how to add a comment so I will put this in the solution and let the moderators scramble to figure out why I can't comment.

My first impression when reading your question was "Why are you not designing your circles in a conformal projection like Mercator". You could project this map into a Mercator projection and see your circle and text distortion, fix everything to look nice and when you project it to your globe, the shapes should stay correct (that is the definition of a conformal projection).

• This reads like an answer to me, so I'll leave it. But it's incorrect, being based on a misunderstanding: conformal projections do not project all circles to circles. They do so only infinitesimally. The distinction is huge: consider what the Mercator does to any circle that goes around the Earth's axis, for instance. It cannot possibly map it as a circle--it must break it somewhere. For more discussion of this, please search our site for Tissot. Commented Jun 18, 2013 at 17:46
• "They do so only infinitesimally." --> "They do so only for infinitesimally small ones." Commented Jul 16, 2013 at 20:14