Despite this, the code libraries are capable of doing much more! Today's post will focus on importing and using point data in spreadsheet form, specifically comma separated value files or *.csv. (In the next post, we will look at other data types and formats.) l will use the Leaflet Simple CSV Plugin that contains many different features, which I will describe later.
The data set contains locations of homicides (417) in Chicago during 2013. It also contains attribute data for incident, type, circumstances, arrests, date, and, location. It is available through Chicago's large open data portal.
If you want to skip to see the end result, click this link: http://webmapexamples.net/leaflet-simple-csv-master/index.html. The screenshot below shows the map on an iPad Mini (Gen 1). Click for a closer vew.
|On iPad Mini: A Leaflet Map of Homicides in Chicago, 2013|
There are several Leaflet plugins to import *.csv files. On the web, I found the Leaflet Simple CSV Plugin by Matthew Perry that incorporates several different plugins, including a bonus one for clustering/collecting markers, into one set of code. Furthermore, it contains code for allowing attribute data from the *.csv file to be displayed when a marker is clicked.
|Pop-up displaying attribute data from the *.csv about the homicide|
Resources for Learning Leaflet
Leaflet.js Essentials (Published August 2014)