leaflet-search icon indicating copy to clipboard operation
leaflet-search copied to clipboard

Search CSV atributes

Open joshdickerson92 opened this issue 10 years ago • 3 comments

I am using Leaflet GeoCSV to bring through a series of points. Would it be possible to use Leaflet Search to query attributes from multiple columns of this CSV? e.g. Search from a column with a Project Number and a column with a Project Name from the same search bar?

joshdickerson92 avatar Dec 08 '15 16:12 joshdickerson92

This question can be related to a my old issue #89 , i can't figured out a solution for solve that by myself (i don't try very hard to solve that XD). Anyway i solved (at least for me) with a brute force solution, building a function for convert the csv content to a geojson/json data content, (your csv file must have at least two columns for latitude and longitude for doing that), and create a search button with this other leaflet plugin leaflet-fusesearch for make a research on the markers of the map, a little more hard to implement maybe , but you can do your research on multiple field of the json data (which is equivalent to make a research to multiple field of the csv file you have converted to json attributes).

p4535992 avatar Dec 29 '15 17:12 p4535992

I am searching just fine with passing an omnivore.csv to L.geoJson. As far as multiple fields, one idea would be to create another field in the csv with all the search terms added to that field.

reyemtm avatar Dec 31 '15 02:12 reyemtm

yes, it's a good alternative solution use omnivore. Here a example of what you want: link to example, in my case I did not use omnivore for two reasons:

  • My project does'nt use Node.js. (although now I was allowed to use jspm that solves all problems related to the use of npm,amd,nodes packages).
  • I need to load the markers in different layers depending on the value of a particular field csv, this omnivore does not allow you to do it (I think).

p4535992 avatar Dec 31 '15 14:12 p4535992