When it comes to certain tasks the usage of leaflet can be tricky. Of course it claims not to be the ultimate webmapping solution but one of the sleekest ones. But when it comes to csv files and reading data from them I always found it hard to implement given solutions listed in the plugins section of leaflet.

geoCSV or bit-by-bit

geoCSV is a plugin that handles CSV files but to me it was a little bit complicated to adjust the examples to my current needs. The second listed one is leaflet-omnivore. This might be a little bit easier but I haven’t tried as I also would love to have the markercluster strategy to the points and some other functionality. So the original task was to search the plugins together and connect all the samples to an ugly code. This is not a funny thing to do… But then I’ve seen Matthew’s blog . And this kicks ass!

simple-CSV

Simple CSV combines most needed functionality in one simple webmapp. You can use your own CSV file, all they need is a lat and lng column. Furthermore Matt added a config file which defines most needed parameters like the background tile provider, the column to be used for the labelling, cluster radius and many more.

With simple-CSV you can visualize the CSV content as points with a cluster strategy and with implied search bar that works on all the columns of your CSV. Furthermore search results are presented on the map only and the bounds of the map are restricted to the search results as well. In my opinion it is one of the best solutions I have seen so far. I would love to see it in action with geoJSON as input…

Find the official Repo here: Link

See how it performs here:

background: leaflet is js-library for webmapping which is a nice alternative to openlayers. You can find more tutorials here.