In order to view this page you need JavaScript and Flash Player 9+ support!

Google Geo Coder + Papervision 3D

This is a simple try of Google Geo Coder and Papervision 3D.
Using Google Geo Coder you can get latittude and longitute of a city, country or Address.

var geocoder = new GClientGeocoder();
if (geocoder) geocoder.getLatLng(address, gatLanLngHandler);
function gatLanLngHandler(point) {
  if (!point) 
    alert("Unable to localise");
  else
    alert (point.x + ' , ' + point.y);
}	


In order to work in a 3D environement like Papervision 3D you need to transform latitude / longitude to X Y Z coordinate.

 var _radius:Number = 3963;
 var _latitude:Number = latitude * pi/180; 	
 var _longitude:Number = longitude * pi / 180;
 var _point:Point3D = new Point3D();
 _point.x = _radius * Math.cos(_latitude) * Math.cos(_longitude);
 _point.y = _radius * Math.sin(_latitude);
 _point.z = _radius * Math.cos(_latitude) * Math.sin(_longitude);


Links

Enjoy
Maxime Montegnies