menuMENU    UK Free TV logo Archive (2002-)



Click to see updates

Google co-ordinate system ... PHP code

There's little documentation to convert Google Maps 3 co-ordinates to WGS84 latitude/longitude, here's my handy little function...

There's little documentation to convert Google Maps 3 co-ordina
published on UK Free TV

Just spent a few annoying hours working this function out.

Google Maps 3 API, the one I'm using to upgrade this site, has a fantastic overlay system, but I was left with Google Maps "x,y,zoom" data in PHP, and I wanted LatLng format to quiz the database. You can do this using the Projection.fromPointToLatLng() Javascript function, but you don't have access to these in the PHP server encironment. So here's the replacement:

function fromPointToLatLng($intX, $intY, $intZoom)
$fpLat= (2.0*atan(exp($y /180*M_PI))-M_PI/2.0)*180/M_PI;
return array( $fpLat, $fpLong);

Such that:

list($fpLat, $fpLong)=fromPointToLatLng($intX, $intY, $intZoom);

For more, see Maps API V3 Overlays - Google Maps JavaScript API V3 - Google Code

All questions
Are there any plans to add Living TV to freeview?1
Can I recieve tv on my computer by connecting to my digital roof aeriel. 2
My Freeview box has ITV and BBC channels on 898, 855 and 8993
How come ITV (on Freeview at least) is not running subtitles on most of the prog4
Do all freeview set top boxes have the same problems - they freeze up get stuck 5
In this section
Seeing something different? We are doing A/B testing on a new Material Design1
Please share your thoughts about UK FREE TV2
The next 50 things on UK FREE TV. What would you like to see? 3
UK Free TV now uses friendly web addresses4
Best ever emails and improved menus on UK FREE TV5
Use the Knowledge base to find answers to your technical problems6


Your comment please
Please post a question, answer or commentUK Free TV is here to help people. If you are rude or disrespectful all of your posts will be deleted and you will be banned.

Privacy policy: UK Free Privacy policy.