I'm attempting to build an online service, aimed at mobile devices that have GPS or GPS like capabilities. The service would take a users location, and show them locations nearby of interest along with some information, such as a historic landmark and some facts or a restaurant with reviews from other users of the service.
I was planning on using HTML5's Geolocation feature alongside OpenStreetMap tile data. Everything is working fine up until the point where I try and translate a latitude and longitude to a pixel so that I can draw a little marker onto the map.
This is what I have so far:
Sorry about the formatting, I use a fair amount of indentation to line up my comments which works fine on my screen however in Daniweb, it is squeezed because of the post dimensions.
The code above shall take the coordinates of the person fine, and it shall display the relevant map piece which uses the standard OSM Naming Schema. The problem is, how do I take the latitude and longitude and turn it into a pixel on the 256px square so that I can add a marker. I've read about Mercator Projection, and I've found a lot of formulas but to be honest... it is all going over my head.
I've spent the past two days trying to work this out but with no success, so I am hoping one of you shall be able to help!
Thanks in Advance!