<!--
This example requires csv2geojson, which you can get on GitHub:
https://github.com/tmcw/csv2geojson
and jQuery to load the file with AJAX.
You can use another tool for AJAX, but if you want to use jQuery, add
these lines to the the page:
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
This pulls the file airports.csv, converts into into GeoJSON by autodetecting
the latitude and longitude columns, and adds it to the map. The full URL
of the file is
http://mapbox.com/mapbox.js/assets/airports.csv
Another CSV that you use will also need to contain latitude and longitude
columns, and they must be similarly named.
As with any other AJAX request, this technique is subject to the Same Origin Policy:
http://en.wikipedia.org/wiki/Same_origin_policy
So the CSV file must be on the same domain as the Javascript, or the server
delivering it should support CORS.
-->
<script src='/mapbox.js/assets/csv2geojson.js'></script>
<div id='map'></div>
<script>
var map = L.mapbox.map('map', 'examples.map-9ijuk24y')
.setView([38, -102.0], 5),
markerLayer = L.mapbox.markerLayer().addTo(map);
$.ajax({
// you will need to replace this URL with the URL to your CSV file.
url: '/mapbox.js/assets/airports.csv',
success: function csvLoad(csv) {
markerLayer.setGeoJSON(csv2geojson.csv2geojson(csv));
}
});
</script>