Technology, Social Media, Travel
RSS icon Email icon Home icon
  • Google Maps Now Has Thailand Street Maps in English

    Posted on February 21st, 2008 John Berns 1 comment

    Google Maps now has Thailand street maps in English. COOL! Check it out: http://tinyurl.com/27vlo6

  • Google Maps – Finding if a Point is on the Map

    Posted on September 29th, 2005 John Berns No comments

    Here is a quick function to check to see if a point is within the bounds of the current map in Google Maps:

    function pointInMapBounds (map, point) {
        var bounds = map.getBoundsLatLng();
        if( point.x < bounds.minX || point.y < bounds.minY ||
             point.x > bounds.maxX || point.y > bounds.maxY ) {
            return false;
        } else {
            return true;
        }
    }
    

    The two parameters passed to the function are:

    If you just want to test whether a Lat/Lon is inside the bounds of a map:

    function latLonInMapBounds (map, lat, lon) {
        var bounds = map.getBoundsLatLng();
        if( lat < bounds.minY || lat > bounds.maxY ||
             lon < bounds.minX || lon > bounds.maxX ) {
            return false;
        } else {
            return true;
        }
    }
    

    The three parameters passed to the function are:

    • map a GMap object and
    • lat in decimal degrees
    • lon in decimal degrees