title: Find a specific location lies inside a polygon/edge using mapbox/leaftlet
body: <p>I have done the below code to create a layer and then found the coordinates which shows in the side div.
  But when i click on the button i need to check whether the point(6,79) lies inside the polygon or on the edge of it.</p>
  
  <p>I have used(mapbox/leaflet) to do all these.</p>
  
  <p>So please do help me to get this done.</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=utf-8 /&gt;
  &lt;title&gt;Show drawn polygon area&lt;/title&gt;
  &lt;meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /&gt;
  &lt;script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js'&gt;&lt;/script&gt;
  &lt;link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css' rel='stylesheet' /&gt;
  &lt;style&gt;
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:75%; height: 75%; border: 1px solid black;}
    #details { width:200px ; height: 200px; border: 1px solid black; float:right;}
    #details2 { width:80px ; height: 200px; border: 1px solid black; float:right}
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body onload="load();"&gt;
  &lt;link href='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-draw/v0.2.2/leaflet.draw.css' rel='stylesheet' /&gt;
  &lt;script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-draw/v0.2.2/leaflet.draw.js'&gt;&lt;/script&gt;
  &lt;script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-geodesy/v0.1.0/leaflet-geodesy.js'&gt;&lt;/script&gt;
  &lt;script src='https://code.jquery.com/jquery-1.11.0.min.js'&gt;&lt;/script&gt;
  &lt;script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-pip/v0.0.2/leaflet-pip.js'&gt;&lt;/script&gt;
  &lt;div id='map'&gt;&lt;/div&gt;
  &lt;script&gt;
  L.mapbox.accessToken = 'pk.eyJ1IjoiYXNoYW4iLCJhIjoiQzQySHN1QSJ9.K4xoMZqrVsWBgYTp70CYNg';
  var map = L.mapbox.map('map', 'examples.map-i86l3621')//examples.map-i86nkdio')
      .setView([6.9344,79.8428], 10); 
  var featureGroup = L.featureGroup().addTo(map);
  var drawControl = new L.Control.Draw({
    edit: {
      featureGroup: featureGroup
    },
    draw: {
      polygon: true,
      polyline: true,
      rectangle: true,
      circle: true,
      marker: true
    }
  }).addTo(map);
  map.on('draw:created', showPolygonArea);
  map.on('draw:edited', showPolygonAreaEdited);
  function showPolygonAreaEdited(e) {
    e.layers.eachLayer(function(layer) {
      showPolygonArea({ layer: layer });
    });
  }
  function showPolygonArea(e) {
    featureGroup.clearLayers();
    featureGroup.addLayer(e.layer);
    e.layer.bindPopup((LGeo.area(e.layer) / 1000000).toFixed(2) + ' km&lt;sup&gt;2&lt;/sup&gt;');
    e.layer.openPopup();
  }
  var drawnItems = new L.featureGroup();
  map.addLayer(drawnItems);
  map.on('draw:created', function (e) {
      var type = e.layerType,
          layer = e.layer;
      drawnItems.addLayer(layer);
      var shapes = getShapes(drawnItems);
      document.getElementById('details').innerHTML = shapes ;
  });
  var getShapes = function(drawnItems) {
      var shapes = [];
      drawnItems.eachLayer(function(layer) {
          if (layer instanceof L.Polyline) {
              shapes.push(layer.getLatLngs())
          }
          if (layer instanceof L.Circle) {
              shapes.push([layer.getLatLng()])
          }
          if (layer instanceof L.Marker) {
              shapes.push([layer.getLatLng()]);
          }
      });
     return shapes;
  };
  function checkfunction(e) {
      shapes = getShapes(drawnItems);
      var bounds= drawnItems.getBounds();         
      for (var i = 0; i &lt; latlong.length; i++){
          var hello =new google.maps.LatLng(6.9344, 79.8428);
          if(bounds.contains(hello)) {
                  alert("Red");
              } else {
                alert("Green");
              }
      }
  }
  &lt;/script&gt;
  &lt;div id="details" &gt;
  &lt;/div&gt;
  &lt;div id="details2" &gt;
      &lt;input type="button" value="Check" id="check" onclick="checkfunction();" /&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks,
  Ashan.</p>