title: Scale geometry to real world
body: <p>I'm trying to scale my geometry to fit a real world scaling onto my 3D scene.<br/>
  I get the top left corner of my map and the top right corner of my map.<br/>
  I then convert those to points using the Google maps projection and then subtract those points from each other to get the delta of the map.<br/>
  Then I use that number and divide it by my geometries bounding box deltaX.<br/>
  The problem is that the code doesn't produce a right scaling.<br/>
  The more I zoom into the map, the smaller the scaling gets and the more I zoom out, the larger to scaling gets. It should be the opposite.<br/>
  I also don't know if this is actually scaling it correctly as it would be in real life.</p>
  
  <p>Right now I do this:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>var bounds = MAP3D.map.getBounds();
  var projection = MAP3D.map.getProjection();
  
  var x1Length = projection.fromLatLngToPoint(new google.maps.LatLng(
      bounds.getNorthEast().lat(),
      bounds.getSouthWest().lng()
  ));
  var x2Length = projection.fromLatLngToPoint(new google.maps.LatLng(
      bounds.getNorthEast().lat(),
      bounds.getNorthEast().lng()
  ));
  var ThreeUnitsX = Math.abs(x2Length.x - x1Length.x);
  
  
  if (
      MAP3D.ObjectManager.WellList[i].LOD.objects[0]
          .object.geometry.boundingBox == null
  ) {
      MAP3D.ObjectManager.WellList[i].LOD.objects[0]
          .object.geometry.computeBoundingBox();
  }
  
  var boundingBox = MAP3D.ObjectManager.WellList[i].LOD.objects[0]
      .object.geometry.boundingBox;
  
  var deltaX = boundingBox.max.x - boundingBox.min.x;
  var scaleX = ThreeUnitsX / deltaX;
  
  me.WellList[i].LOD.scale.set(scaleX, scaleX, scaleX);
  </code></pre>
  
  <p><sub>I want to thank <code>chandlerp</code> from the <code>#THREE.JS</code> irc for helping me a lot.</sub></p>