├── .gitignore
├── README.md
├── config.js.template
├── css
├── MarkerCluster.Default.css
├── MarkerCluster.Default.ie.css
├── MarkerCluster.css
├── leaflet.label.css
└── screen.css
├── data
└── data.csv
├── img
└── screenshot1.png
├── index.html
└── js
├── app.js
├── leaflet.geocsv-src.js
├── leaflet.geocsv.js
├── leaflet.label.js
├── leaflet.markercluster-src.js
└── leaflet.markercluster.js
/.gitignore:
--------------------------------------------------------------------------------
1 | config.js
2 | data/*
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Simple Leaflet map template for putting points on a map.
2 |
3 |
4 |
5 | ### Features
6 | * Data is in tabular delimited-text (csv, etc.) with two required columns: `lat` and `lng`
7 | * Points are plotted on full-screen [Leaflet](https://github.com/Leaflet/Leaflet) map
8 | * Point markers are clustered dynamically based on zoom level.
9 | * Clicking on a point cluster will zoom into the extent of the underlying features.
10 | * Hovering on the point will display the name.
11 | * Clicking will display a popup with columns/properties displayed as an html table.
12 | * Full text filtering with typeahead
13 | * Completely client-side javascript with all dependencies included or linked via CDN
14 |
15 | ###
16 | ### Usage
17 | Download, copy the template and load index.html in a browser to confirm that everything works
18 |
19 | ```
20 | git clone https://github.com/perrygeo/leaflet-simple-csv.git
21 | cd leaflet-simple-csv
22 | cp config.js.template config.js
23 | open index.html
24 | ```
25 |
26 | Then modify `config.js` and `data/data.csv` according to your needs.
27 |
28 | Some browsers do not allow XMLHttpRequests with the `file://` protocol so you'll need to serve it with a web server. For local development, you can use python
29 |
30 | ```
31 | $ python -m SimpleHTTPServer
32 | Serving HTTP on 0.0.0.0 port 8000 ...
33 | ```
34 | Then navigate to `http://localhost:8000` instead.
35 |
36 | ### Thanks to...
37 |
38 | * [Leaflet](https://github.com/Leaflet/Leaflet)
39 | * [Leaflet.geoCSV](https://github.com/joker-x/Leaflet.geoCSV)
40 | * [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster)
41 | * [Twitter Boostrap](http://twitter.github.io/bootstrap/)
42 | * [jQuery](http://jquery.com/)
43 |
44 |
--------------------------------------------------------------------------------
/config.js.template:
--------------------------------------------------------------------------------
1 | var dataUrl = 'data/data.csv';
2 | var maxZoom = 9;
3 | var fieldSeparator = '|';
4 | var baseUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
5 | var baseAttribution = 'Data, imagery and map information provided by MapQuest, OpenStreetMap and contributors, CC-BY-SA';
6 | var subdomains = 'abc';
7 | var clusterOptions = {showCoverageOnHover: false, maxClusterRadius: 50};
8 | var labelColumn = "Name";
9 | var opacity = 1.0;
10 |
--------------------------------------------------------------------------------
/css/MarkerCluster.Default.css:
--------------------------------------------------------------------------------
1 | .marker-cluster-small {
2 | background-color: rgba(181, 226, 140, 0.6);
3 | }
4 | .marker-cluster-small div {
5 | background-color: rgba(110, 204, 57, 0.6);
6 | }
7 |
8 | .marker-cluster-medium {
9 | background-color: rgba(241, 211, 87, 0.6);
10 | }
11 | .marker-cluster-medium div {
12 | background-color: rgba(240, 194, 12, 0.6);
13 | }
14 |
15 | .marker-cluster-large {
16 | background-color: rgba(253, 156, 115, 0.6);
17 | }
18 | .marker-cluster-large div {
19 | background-color: rgba(241, 128, 23, 0.6);
20 | }
21 |
22 | .marker-cluster {
23 | background-clip: padding-box;
24 | border-radius: 20px;
25 | }
26 | .marker-cluster div {
27 | width: 30px;
28 | height: 30px;
29 | margin-left: 5px;
30 | margin-top: 5px;
31 |
32 | text-align: center;
33 | border-radius: 15px;
34 | font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
35 | }
36 | .marker-cluster span {
37 | line-height: 30px;
38 | }
--------------------------------------------------------------------------------
/css/MarkerCluster.Default.ie.css:
--------------------------------------------------------------------------------
1 | /* IE 6-8 fallback colors */
2 | .marker-cluster-small {
3 | background-color: rgb(181, 226, 140);
4 | }
5 | .marker-cluster-small div {
6 | background-color: rgb(110, 204, 57);
7 | }
8 |
9 | .marker-cluster-medium {
10 | background-color: rgb(241, 211, 87);
11 | }
12 | .marker-cluster-medium div {
13 | background-color: rgb(240, 194, 12);
14 | }
15 |
16 | .marker-cluster-large {
17 | background-color: rgb(253, 156, 115);
18 | }
19 | .marker-cluster-large div {
20 | background-color: rgb(241, 128, 23);
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/css/MarkerCluster.css:
--------------------------------------------------------------------------------
1 | .leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
2 | -webkit-transition: -webkit-transform 0.2s ease-out, opacity 0.2s ease-in;
3 | -moz-transition: -moz-transform 0.2s ease-out, opacity 0.2s ease-in;
4 | -o-transition: -o-transform 0.2s ease-out, opacity 0.2s ease-in;
5 | transition: transform 0.2s ease-out, opacity 0.2s ease-in;
6 | }
7 |
--------------------------------------------------------------------------------
/css/leaflet.label.css:
--------------------------------------------------------------------------------
1 | .leaflet-label {
2 | background: rgb(235, 235, 235);
3 | background: rgba(235, 235, 235, 0.81);
4 | background-clip: padding-box;
5 | border-color: #777;
6 | border-color: rgba(0,0,0,0.25);
7 | border-radius: 4px;
8 | border-style: solid;
9 | border-width: 4px;
10 | color: #111;
11 | display: block;
12 | font: 12px/20px "Helvetica Neue", Arial, Helvetica, sans-serif;
13 | font-weight: bold;
14 | padding: 1px 6px;
15 | position: absolute;
16 | -webkit-user-select: none;
17 | -moz-user-select: none;
18 | -ms-user-select: none;
19 | user-select: none;
20 | white-space: nowrap;
21 | z-index: 6;
22 | }
23 |
24 | .leaflet-label:before {
25 | border-right: 6px solid black;
26 | border-right-color: inherit;
27 | border-top: 6px solid transparent;
28 | border-bottom: 6px solid transparent;
29 | content: "";
30 | position: absolute;
31 | top: 5px;
32 | left: -10px;
33 | }
--------------------------------------------------------------------------------
/css/screen.css:
--------------------------------------------------------------------------------
1 | #map {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
6 | body {
7 | padding: 0;
8 | margin: 0;
9 | }
10 |
11 | html, body, #map {
12 | height: 100%;
13 | }
14 |
15 | #filter-container {
16 | position: absolute;
17 | right: 12px;
18 | top: 12px;
19 | z-index: 999;
20 | }
21 |
22 | .leaflet-control-attribution {
23 | font: 9px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif !important;
24 | }
25 |
26 | form {
27 | margin: 0 0 0;
28 | }
29 |
30 | .popup-content {
31 | height: 250px;
32 | overflow-y: scroll;
33 | }
34 |
35 | .map-label {
36 | z-index: 9000638;
37 | }
38 |
39 | #clear {
40 | display: inline-block;
41 | position: relative;
42 | right: -24px;
43 | z-index: 999999;
44 | top: 3px;
45 | font-size:14pt;
46 | text-decoration: none;
47 | color: #aaa;
48 | }
49 |
50 | input.search-query {
51 | padding-left: 24px;
52 | }
53 |
54 | .search-box {
55 | font-size: 10pt !important;
56 | padding-top: 3px !important;
57 | padding-bottom: 3px !important;
58 | }
--------------------------------------------------------------------------------
/data/data.csv:
--------------------------------------------------------------------------------
1 | Country|Name|lat|lng|Altitude
2 | United States|New York City|40.7142691|-74.0059738|2.0
3 | United States|Los Angeles|34.0522342|-118.2436829|115.0
4 | United States|Chicago|41.8500330|-87.6500549|181.0
5 | United States|Houston|29.7632836|-95.3632736|15.0
6 | United States|Philadelphia|39.9523350|-75.1637878|8.0
7 | United States|Phoenix|33.4483771|-112.0740356|0.0
8 | United States|San Antonio|29.4241219|-98.4936295|196.0
9 | United States|San Diego|32.7153292|-117.1572571|26.0
10 | United States|Dallas|32.7830556|-96.8066635|137.0
11 | United States|Detroit|42.3314270|-83.0457535|181.0
12 | United States|San Jose|37.3393857|-121.8949585|24.0
13 | United States|Jacksonville|30.3321838|-81.6556473|7.0
14 | United States|Indianapolis|39.7683765|-86.1580429|222.0
15 | United States|Columbus|39.9611755|-82.9987946|237.0
16 | United States|San Francisco|37.7749295|-122.4194183|60.0
17 | United States|Austin|30.2671530|-97.7430573|163.0
18 | United States|Memphis|35.1495343|-90.0489807|75.0
19 | United States|New South Memphis|35.0867579|-90.0567551|74.0
20 | United States|Fort Worth|32.7254090|-97.3208466|199.0
21 | United States|Baltimore|39.2903848|-76.6121902|2.0
22 | United States|Charlotte|35.2270869|-80.8431244|229.0
23 | United States|Boston|42.3584308|-71.0597763|11.0
24 | United States|Milwaukee|43.0389025|-87.9064713|195.0
25 | United States|South Boston|42.3334312|-71.0494919|10.0
26 | United States|Seattle|47.6062095|-122.3320694|60.0
27 | United States|El Paso|31.7587198|-106.4869308|1147.0
28 | United States|Denver|39.7391536|-104.9847031|1598.0
29 | United States|Washington|38.8951118|-77.0363693|11.0
30 | United States|Portland|45.5234515|-122.6762085|61.0
31 | United States|Oklahoma City|35.4675602|-97.5164261|364.0
32 | United States|Nashville|36.1658899|-86.7844467|151.0
33 | United States|Tucson|32.2217429|-110.9264755|751.0
34 | United States|Albuquerque|35.0844909|-106.6511383|1510.0
35 | United States|New Orleans|29.9546482|-90.0750732|0.0
36 | United States|Long Beach|33.7669623|-118.1892319|1.0
37 | United States|Las Vegas|36.1749705|-115.1372223|609.0
38 | United States|Sacramento|38.5815719|-121.4944000|5.0
39 | United States|Fresno|36.7477272|-119.7723694|91.0
40 | United States|Cleveland|41.4994954|-81.6954117|185.0
41 | United States|North Kansas City|39.1300040|-94.5621796|223.0
42 | United States|Kansas City|39.0997266|-94.5785675|271.0
43 | United States|Virginia Beach|36.8529263|-75.9779816|3.0
44 | United States|Atlanta|33.7489954|-84.3879852|305.0
45 | United States|Oakland|37.8043722|-122.2708054|0.0
46 | United States|Mesa|33.4222685|-111.8226395|386.0
47 | United States|Tulsa|36.1539816|-95.9927750|213.0
48 | United States|Omaha|41.2586096|-95.9377899|0.0
49 | United States|Miami|25.7742658|-80.1936569|2.0
50 | United States|Honolulu|21.3069444|-157.8583374|0.0
51 | United States|Minneapolis|44.9799654|-93.2638397|259.0
52 | United States|Colorado Springs|38.8338816|-104.8213654|1829.0
53 | United States|Wichita|37.6922361|-97.3375473|402.0
54 | United States|Santa Ana|33.7455731|-117.8678360|30.0
55 | United States|West Raleigh|35.7868182|-78.6638947|122.0
56 | United States|Arlington|32.7356870|-97.1080627|184.0
57 | United States|Anaheim|33.8352932|-117.9145050|40.0
58 | United States|Tampa|27.9475216|-82.4584274|1.0
59 | United States|Saint Louis|38.6272733|-90.1978912|135.0
60 | United States|Pittsburgh|40.4406248|-79.9958878|235.0
61 | United States|Toledo|41.6639383|-83.5552139|191.0
62 | United States|Cincinnati|39.1620036|-84.4568863|203.0
63 | United States|Riverside|33.9533487|-117.3961563|262.0
64 | United States|Bakersfield|35.3732921|-119.0187149|122.0
65 | United States|Stockton|37.9577016|-121.2907791|4.0
66 | United States|Newark|40.7356570|-74.1723633|16.0
67 | United States|Buffalo|42.8864468|-78.8783722|183.0
68 | United States|Corpus Christi|27.8005828|-97.3963776|6.0
69 | United States|Aurora|39.7294319|-104.8319168|1647.0
70 | United States|Raleigh|35.7720960|-78.6386108|91.0
71 | United States|Saint Paul|44.9444101|-93.0932770|235.0
72 | United States|Lexington-Fayette|38.0497996|-84.4585495|312.0
73 | United States|Anchorage|61.2180556|-149.9002838|0.0
74 | United States|Plano|33.0198431|-96.6988831|200.0
75 | United States|Saint Petersburg|27.7708606|-82.6792679|14.0
76 | United States|Louisville|38.2542376|-85.7594070|128.0
77 | United States|Lincoln|40.8000011|-96.6669617|382.0
78 | United States|Glendale|33.5386523|-112.1859894|336.0
79 | United States|Henderson|36.0396988|-114.9819336|580.0
80 | United States|Jersey City|40.7281575|-74.0776443|14.0
81 | United States|Norfolk|36.8468146|-76.2852173|3.0
82 | United States|Chandler|33.3061605|-111.8412476|380.0
83 | United States|Greensboro|36.0726355|-79.7919769|244.0
84 | United States|Birmingham|33.5206608|-86.8024902|173.0
85 | United States|Fort Wayne|41.1306041|-85.1288605|243.0
86 | United States|Lexington|37.9886892|-84.4777145|298.0
87 | United States|Hialeah|25.8575963|-80.2781067|2.0
88 | United States|Madison|43.0730517|-89.4012299|270.0
89 | United States|Baton Rouge|30.4507462|-91.1545486|0.0
90 | United States|Garland|32.9126240|-96.6388855|165.0
91 | United States|Modesto|37.6390972|-120.9968796|12.0
92 | United States|Paradise|36.0971945|-115.1466675|626.0
93 | United States|Chula Vista|32.6400541|-117.0841980|23.0
94 | United States|Lubbock|33.5778631|-101.8551636|976.0
95 | United States|Rochester|43.1547845|-77.6155548|155.0
96 | United States|Laredo|27.5064070|-99.5075455|115.0
97 | United States|Akron|41.0814447|-81.5190048|290.0
98 | United States|Orlando|28.5383355|-81.3792343|34.0
99 | United States|Durham|35.9940329|-78.8986206|122.0
100 | United States|North Glendale|34.1605626|-118.2645187|174.0
101 | United States|Scottsdale|33.5092103|-111.8990326|386.0
102 |
--------------------------------------------------------------------------------
/img/screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/perrygeo/leaflet-simple-csv/f08578e2687b4725dfaed0234e7efe0211220c46/img/screenshot1.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
'+title+' | '+ attr +' |
---|