I am trying to calculate map of Europe in Lambert projection. I am using formula from Wikipedia (Lambert wiki), but calculation is very slow in comparison with Mercator. I know, there are sin, cos, cotg and pow to calculate (Mercator has only one tan and ln), but the difference is almost 30 minutes (Mercator is done in about 3 minutes).

Is there some kind of speed up, or similar projection, that can be used ? I also need to put result into image with width and hight. For Mercator, I am using this: https://stackoverflow.com/questions/5983099/converting-longitude-latitude-to-x-y-coordinate. Can it be altered to Lambert (or Lambert similar) projection ? Because if I use same approach only witch changed formulas for projection, Lambert is moved to upper part of image and I can see only part of Europe)

EDIT: Added code

double longitude = lon * (MPI / 180.0);
double latitude = lat * (MPI / 180.0);

double lambertPhi = this->lambertF * pow(cot(0.25 * MPI + 0.5 * latitude), this->lambertN);

lonOut = lambertPhi * sinf(this->lambertN * longitude);
latOut = this->lambertPhi0 - lambertPhi * cosf(this->lambertN * longitude);

All this-> variables are precomputed only once

  • 1
    (1) What software are you using? (2) Are you concerned about the moon "Europa" or the earth continent "Europe"? – whuber Jan 2 '14 at 15:36
  • n, rho0 and F are all constants for a particular projected CRS. Are you calculating them outside the main loop and reusing the results? – mkennedy Jan 2 '14 at 16:47
  • @whuber I am not using any SW, I am writing code myself in C++. I am concerner about the continent "Europe". – Martin Perry Jan 2 '14 at 16:51
  • @mkennedy Yes.. all of those are calculated in Init function. Then those values are reused – Martin Perry Jan 2 '14 at 16:52
  • 2
    Thanks. How many points are you projecting? During three minutes with one core you should be able to project at least 10^9 points with the Mercator projection, but no map really needs that many points. (If you are transforming an image you shouldn't be computing the projection of every pixel and if you are transforming vector data you would be processing invisible details.) Perhaps the issue to address concerns how to simplify the map features rather than how to speed up the calculation of the Lambert conformal conic projection. – whuber Jan 2 '14 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.