I need a function to convert from tile pixels (x, y) from the Web Mercator projection (aka EPSG::3857 or SRID 900913), to longitude and latitude.

I'd like the function to be written in pseudo-code or a language like C. I'm writing a C++ program.

I apologize if this is a duplicate question but I'm having trouble finding the algorithm.

I have found an algorithm that converts longitude and latitude to tile pixels. But I'm not confident that I can rewrite it to do the opposite.


you can find a lot of formulas with nice explanation in this wonderful page:


They are in python but code is quite simple. Have fun!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.