Point in Polygon

Drag the marker to see what state it is in
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Point in Polygon</title>
  <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
  <script src='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.js'></script>
  <link href='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
  <!--[if lte IE 8]>
    <link href='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'>
  <![endif]-->
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
<style>
#state {
    position:absolute;
    top:10px;
    right:10px;
    background:#fff;
    font-size:30px;
    padding:10px;
    z-index:999;
}
</style>

<!--
  This example requires leaflet-pip, which you can get on GitHub:
  https://github.com/tmcw/leaflet-pip
  and jQuery to load the file with AJAX. You can use another tool for AJAX.

  This pulls the file airports.csv, converts into into GeoJSON by autodetecting
  the latitude and longitude columns, and adds it to the map.

  Another CSV that you use will also need to contain latitude and longitude
  columns, and they must be similarly named.
-->

<script src="/mapbox.js/assets/leaflet-pip.js"></script>
<div id='map'></div>
<div id='state'></div>
<script type='text/javascript'>
var map = L.mapbox.map('map', 'examples.map-9ijuk24y')
    .setView([38, -102.0], 5);

$.ajax({
    url: '/mapbox.js/assets/data/us-states.geojson',
    dataType: 'json',
    success: function load(d) {
        var states = L.geoJson(d).addTo(map);
        L.marker([38, -102], {
            icon: L.mapbox.marker.icon({
                'marker-color': '#f22'
            }),
            draggable: true
        }).addTo(map)
        .on('dragend', function(e) {
            var layer = leafletPip.pointInLayer(this.getLatLng(), states, true);
            document.getElementById('state').innerHTML = layer.length ?
                layer[0].feature.properties.name : '';
        });
    }
});
</script>
The code and documentation to mapbox.js is hosted on GitHub where you can contribute changes and improvements.