You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

672 lines
29 KiB

  1. <html><head>
  2. <meta charset="utf-8">
  3. <meta http-equiv="x-ua-compatible" content="ie=edge">
  4. <title>Independent Bookstores in New York City - Best Community Bookstores in NYC</title>
  5. <meta name="google-site-verification" content="hEfog9h0E3JQW91ZUZM5ayPb6DND0WbUa2_W8yTIuVw">
  6. <link rel="icon" type="image/png" href="/img/favicon.png">
  7. <link rel="apple-touch-icon" href="/img/social.jpg">
  8. <script type="text/javascript" src="js/jquery.js"></script>
  9. <script type="text/javascript" src="js/mustache.js"></script>
  10. <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.0/jquery.scrollTo.min.js"></script>
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12. <script src="https://api.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.js"></script>
  13. <link href="https://api.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.css" rel="stylesheet">
  14. <link href="https://fonts.googleapis.com/css?family=Acme|Lato" rel="stylesheet">
  15. <link media="screen" rel="stylesheet" type="text/css" href="css/site.css">
  16. <meta property="title" name="title" content="Independent Bookstores in New York City - Best Community Bookstores in NYC">
  17. <meta property="description" name="description" content="A guide to and map of every independent bookstore in New York City. We have a full list of community bookstores in NYC with locations and descriptions.">
  18. <meta name="twitter:card" content="summary">
  19. <meta name="twitter:site" content="www.nycbookstores.org">
  20. <meta name="twitter:title" content="NYC Bookstores">
  21. <meta name="twitter:description" content="A Guide To The Many Independent Bookstores Of New York City">
  22. <meta name="twitter:image" content="https://www.nycbookstores.org/img/social.jpg">
  23. <meta property="og:url" content="https://www.nycbookstores.org/">
  24. <meta property="og:title" content="NYC Bookstores">
  25. <meta property="og:description" content="A Guide To The Many Independent Bookstores Of New York City">
  26. <meta property="og:image" content="https://www.nycbookstores.org/img/social.jpg">
  27. </head>
  28. <body>
  29. <div id="wrapper">
  30. <h1>NYC Bookstores</h1>
  31. <div>
  32. <ul class="nav">
  33. <li><h2>The Many Independent Bookstores of New York City</h2></li>
  34. <li><a id="viewInfo">info</a></li>
  35. <li><a href="https://git.yetaga.in/alazyreader/nyc-bookstores/" target="_blank">git</a></li>
  36. <li><a href="https://www.twitter.com/alazyreader" target="_blank">@alazyreader</a></li>
  37. </ul>
  38. </div>
  39. <div class="container">
  40. <div id="map"></div>
  41. <div id="info">
  42. <p>New York City loves its independent bookstores. It <a href="https://www.nytimes.com/2006/10/15/nyregion/thecity/15book.html" target="_blank">eulogizes those that have faded</a> and celebrates when new ventures are launched. And while the historic <a href="https://untappedcities.com/2015/08/26/4th-avenue-the-history-of-nycs-book-row/" target="_blank">Book Row may have passed away in the 80s</a>, there are still many indie bookstores dotting the map. Here, I have attempted to collect all of the currently-open general-interest independent booksellers in NYC. Any store with regular-ish hours (excluding religious booksellers and appointment-only rare book sellers) is included.</p>
  43. <p>The listings here are kept up-to-date to the best of my ability; however, I make no promises about either the accuracy or reliability of the information. If you spot an error, or I&apos;ve missed a shop, please let me know by <a href="mailto:delta.mu.alpha@gmail.com" target="_blank">email</a> or <a href="https://www.twitter.com/alazyreader" target="_blank">twitter</a>. Based on the &quot;<a href="https://github.com/jlord/hack-spots" target="_blank">Hack Spots</a>&quot; website by <a href="https://www.twitter.com/jllord" target="_blank">@jllord</a>.</p>
  44. <p>There are currently <span id="storeCount"></span> stores indexed on this page.</p>
  45. </div>
  46. <div id="selected"></div>
  47. </div>
  48. <div class="clearfix"></div>
  49. <div class="container">
  50. <div id="Stores">
  51. <table>
  52. <tbody><tr><th class="tHeader">Name</th><th class="tHeader">Address</th></tr>
  53. <tr id class="spotRow">
  54. <td class="name">192 Books</td>
  55. <td>192 10th Ave, New York</td>
  56. </tr>
  57. <tr id class="spotRow">
  58. <td class="name">Aeon Bookstore</td>
  59. <td>151 East Broadway, New York</td>
  60. </tr>
  61. <tr id class="spotRow">
  62. <td class="name">Alabaster Bookshop</td>
  63. <td>122 4th Ave, New York</td>
  64. </tr>
  65. <tr id class="spotRow">
  66. <td class="name">Albertine Books</td>
  67. <td>972 Fifth Ave, New York</td>
  68. </tr>
  69. <tr id class="spotRow">
  70. <td class="name">Archestratus</td>
  71. <td>160 Huron St, Brooklyn</td>
  72. </tr>
  73. <tr id class="spotRow">
  74. <td class="name">Argosy Books</td>
  75. <td>116 East 59th St, New York</td>
  76. </tr>
  77. <tr id class="spotRow">
  78. <td class="name">Astoria Bookshop</td>
  79. <td>31-29 31st St, Astoria</td>
  80. </tr>
  81. <tr id class="spotRow">
  82. <td class="name">Avoid The Day Bookstore &amp; Cafe</td>
  83. <td>99-04 A Rockaway Beach Blvd, Rockaway Park</td>
  84. </tr>
  85. <tr id class="spotRow">
  86. <td class="name">Bankstreet Bookstore</td>
  87. <td>2780 Broadway, New York</td>
  88. </tr>
  89. <tr id class="spotRow">
  90. <td class="name">Ben&apos;s Books</td>
  91. <td>145 Ainslie St, Brooklyn</td>
  92. </tr>
  93. <tr id class="spotRow">
  94. <td class="name">Berl&apos;s Brooklyn Poetry Shop</td>
  95. <td>126A Front St, Brooklyn</td>
  96. </tr>
  97. <tr id class="spotRow">
  98. <td class="name">Better Read Than Dead</td>
  99. <td>867 Broadway, Brooklyn</td>
  100. </tr>
  101. <tr id class="spotRow">
  102. <td class="name">Bluestockings</td>
  103. <td>172 Allen Street, New York</td>
  104. </tr>
  105. <tr id class="spotRow">
  106. <td class="name">Bonnie Slotnick Cookbooks</td>
  107. <td>28 East 2nd St, New York</td>
  108. </tr>
  109. <tr id class="spotRow">
  110. <td class="name">Book Culture</td>
  111. <td>536 W 112th St, New York</td>
  112. </tr>
  113. <tr id class="spotRow">
  114. <td class="name">Book Culture LIC</td>
  115. <td>26-09 Jackson Ave, Queens</td>
  116. </tr>
  117. <tr id class="spotRow">
  118. <td class="name">Book Culture on Broadway</td>
  119. <td>2915 Broadway, New York</td>
  120. </tr>
  121. <tr id class="spotRow">
  122. <td class="name">Book Thug Nation</td>
  123. <td>100 North 3rd St, Brooklyn</td>
  124. </tr>
  125. <tr id class="spotRow">
  126. <td class="name">Bookmarc</td>
  127. <td>400 Bleecker St, New York</td>
  128. </tr>
  129. <tr id class="spotRow">
  130. <td class="name">BookMark Shoppe</td>
  131. <td>8415 3rd Avenue, Brooklyn</td>
  132. </tr>
  133. <tr id class="spotRow">
  134. <td class="name">Bookoff</td>
  135. <td>49 W 45nd St, New York</td>
  136. </tr>
  137. <tr id class="spotRow">
  138. <td class="name">Books Are Magic</td>
  139. <td>225 Smith St, Brooklyn</td>
  140. </tr>
  141. <tr id class="spotRow">
  142. <td class="name">Books Of Wonder</td>
  143. <td>18 West 18th St, New York</td>
  144. </tr>
  145. <tr id class="spotRow">
  146. <td class="name">Books Of Wonder (Upper West Side)</td>
  147. <td>217 West 84th St, New York</td>
  148. </tr>
  149. <tr id class="spotRow">
  150. <td class="name">Boulevard Books</td>
  151. <td>7518 13th Ave, Brooklyn</td>
  152. </tr>
  153. <tr id class="spotRow">
  154. <td class="name">Bravo&apos;s Book Nook</td>
  155. <td>115 MacDougal St, New York</td>
  156. </tr>
  157. <tr id class="spotRow">
  158. <td class="name">Cafe con Libros</td>
  159. <td>724 Prospect Place, Brooklyn</td>
  160. </tr>
  161. <tr id class="spotRow">
  162. <td class="name">Catland</td>
  163. <td>987 Flushing Ave, Brooklyn</td>
  164. </tr>
  165. <tr id class="spotRow">
  166. <td class="name">Chartwell Booksellers</td>
  167. <td>55 E 52nd St, New York</td>
  168. </tr>
  169. <tr id class="spotRow">
  170. <td class="name">Civil Service Book Shop</td>
  171. <td>34 Carmine St, New York</td>
  172. </tr>
  173. <tr id class="spotRow">
  174. <td class="name">Codex Books</td>
  175. <td>1 Bleecker St, New York</td>
  176. </tr>
  177. <tr id class="spotRow">
  178. <td class="name">Community Bookstore</td>
  179. <td>143 7th Ave, Brooklyn</td>
  180. </tr>
  181. <tr id class="spotRow">
  182. <td class="name">Dashwood Books</td>
  183. <td>33 Bond St, New York</td>
  184. </tr>
  185. <tr id class="spotRow">
  186. <td class="name">Desert Island Comics</td>
  187. <td>540 Metropolitan Ave, Brooklyn</td>
  188. </tr>
  189. <tr id class="spotRow">
  190. <td class="name">East Village Books</td>
  191. <td>99 St. Mark&apos;s Place, New York</td>
  192. </tr>
  193. <tr id class="spotRow">
  194. <td class="name">Every Thing Goes Book Cafe and Neighborhood Stage</td>
  195. <td>208 Bay St, Staten Island</td>
  196. </tr>
  197. <tr id class="spotRow">
  198. <td class="name">Freebird Books</td>
  199. <td>123 Columbia St, Brooklyn</td>
  200. </tr>
  201. <tr id class="spotRow">
  202. <td class="name">Greenlight Bookstore</td>
  203. <td>686 Fulton St, Brooklyn</td>
  204. </tr>
  205. <tr id class="spotRow">
  206. <td class="name">Greenlight Bookstore (Prospect Lefferts Gardens)</td>
  207. <td>632 Flatbush Ave, Brooklyn</td>
  208. </tr>
  209. <tr id class="spotRow">
  210. <td class="name">Here&apos;s A Book Store</td>
  211. <td>1964 Coney Island Ave, Brooklyn</td>
  212. </tr>
  213. <tr id class="spotRow">
  214. <td class="name">Housing Works Bookstore Caf&#xE9;</td>
  215. <td>126 Crosby St, New York</td>
  216. </tr>
  217. <tr id class="spotRow">
  218. <td class="name">Human Relations Books</td>
  219. <td>1067 Flushing Ave, Brooklyn</td>
  220. </tr>
  221. <tr id class="spotRow">
  222. <td class="name">Idlewild Books</td>
  223. <td>170 7th Avenue S, New York</td>
  224. </tr>
  225. <tr id class="spotRow">
  226. <td class="name">James Cummins Bookseller</td>
  227. <td>699 Madison Ave, 7th Floor, New York</td>
  228. </tr>
  229. <tr id class="spotRow">
  230. <td class="name">Jewel City Books</td>
  231. <td>658 Franklin Ave, Brooklyn</td>
  232. </tr>
  233. <tr id class="spotRow">
  234. <td class="name">Joanne Hendricks Cookbooks</td>
  235. <td>488 Greenwich St, New York</td>
  236. </tr>
  237. <tr id class="spotRow">
  238. <td class="name">Karma Bookstore</td>
  239. <td>136 East Third St, New York</td>
  240. </tr>
  241. <tr id class="spotRow">
  242. <td class="name">Kew &amp; Willow Books</td>
  243. <td>81-63 Lefferts Boulevard, New York</td>
  244. </tr>
  245. <tr id class="spotRow">
  246. <td class="name">Kinokunya</td>
  247. <td>1073 Avenue of the Americas, New York</td>
  248. </tr>
  249. <tr id class="spotRow">
  250. <td class="name">Kitchen Arts &amp; Letters</td>
  251. <td>1435 Lexington Ave, New York</td>
  252. </tr>
  253. <tr id class="spotRow">
  254. <td class="name">Logos Bookstore</td>
  255. <td>1575 York Ave, New York</td>
  256. </tr>
  257. <tr id class="spotRow">
  258. <td class="name">Mast Books</td>
  259. <td>72 Avenue A, New York</td>
  260. </tr>
  261. <tr id class="spotRow">
  262. <td class="name">McNally Jackson Books</td>
  263. <td>52 Prince St, New York</td>
  264. </tr>
  265. <tr id class="spotRow">
  266. <td class="name">McNally Jackson Books City Point</td>
  267. <td>445 Albee Square W, Unit G112, Brooklyn</td>
  268. </tr>
  269. <tr id class="spotRow">
  270. <td class="name">McNally Jackson Books Seaport</td>
  271. <td>4 Fulton St, New York</td>
  272. </tr>
  273. <tr id class="spotRow">
  274. <td class="name">McNally Jackson Books Williamsburg</td>
  275. <td>76 North 4th St, Brooklyn</td>
  276. </tr>
  277. <tr id class="spotRow">
  278. <td class="name">Melville House Publishers</td>
  279. <td>46 John St, Brooklyn</td>
  280. </tr>
  281. <tr id class="spotRow">
  282. <td class="name">Mercer Street Books &amp; Records</td>
  283. <td>206 Mercer St, New York</td>
  284. </tr>
  285. <tr id class="spotRow">
  286. <td class="name">Mil Mundos Books</td>
  287. <td>323 Linden St, Brooklyn</td>
  288. </tr>
  289. <tr id class="spotRow">
  290. <td class="name">Molasses Books</td>
  291. <td>770 Hart St, Brooklyn</td>
  292. </tr>
  293. <tr id class="spotRow">
  294. <td class="name">Namaste Bookshop</td>
  295. <td>2 W 14th St, New York</td>
  296. </tr>
  297. <tr id class="spotRow">
  298. <td class="name">Pioneer Books</td>
  299. <td>159 Pioneer St, Brooklyn</td>
  300. </tr>
  301. <tr id class="spotRow">
  302. <td class="name">Posman Books Chelsea Market</td>
  303. <td>75 9th Avenue, New York</td>
  304. </tr>
  305. <tr id class="spotRow">
  306. <td class="name">Posman Books Rockefeller Center</td>
  307. <td>30 Rockefeller Plaza, New York</td>
  308. </tr>
  309. <tr id class="spotRow">
  310. <td class="name">PowerHouse Arena</td>
  311. <td>28 Adams St, Brooklyn</td>
  312. </tr>
  313. <tr id class="spotRow">
  314. <td class="name">PowerHouse on 8th</td>
  315. <td>1111 8th Ave, Brooklyn</td>
  316. </tr>
  317. <tr id class="spotRow">
  318. <td class="name">Printed Matter</td>
  319. <td>231 11th Ave, New York</td>
  320. </tr>
  321. <tr id class="spotRow">
  322. <td class="name">Printed Matter St. Marks</td>
  323. <td>38 St. Marks Pl, New York</td>
  324. </tr>
  325. <tr id class="spotRow">
  326. <td class="name">Quest Bookshop</td>
  327. <td>240 E 53rd St, New York</td>
  328. </tr>
  329. <tr id class="spotRow">
  330. <td class="name">Respect For Life Books-N-Things</td>
  331. <td>537 Nostrand Ave, Brooklyn</td>
  332. </tr>
  333. <tr id class="spotRow">
  334. <td class="name">Revolution Books</td>
  335. <td>437 Malcolm X Blvd, New York</td>
  336. </tr>
  337. <tr id class="spotRow">
  338. <td class="name">Rizzoli Bookstore</td>
  339. <td>1133 Broadway, New York</td>
  340. </tr>
  341. <tr id class="spotRow">
  342. <td class="name">Shakespeare &amp; Company</td>
  343. <td>939 Lexington Ave, New York</td>
  344. </tr>
  345. <tr id class="spotRow">
  346. <td class="name">Shakespeare &amp; Company (Upper West Side)</td>
  347. <td>2020 Broadway, New York</td>
  348. </tr>
  349. <tr id class="spotRow">
  350. <td class="name">Sister&apos;s Uptown Bookstore</td>
  351. <td>1942 Amsterdam Ave, New York</td>
  352. </tr>
  353. <tr id class="spotRow">
  354. <td class="name">Spoonbill &amp; Sugartown, Booksellers</td>
  355. <td>218 Bedford Ave, Brooklyn</td>
  356. </tr>
  357. <tr id class="spotRow">
  358. <td class="name">Standards Manual</td>
  359. <td>212 Franklin Street, Brooklyn</td>
  360. </tr>
  361. <tr id class="spotRow">
  362. <td class="name">Strand Bookstore</td>
  363. <td>828 Broadway, New York</td>
  364. </tr>
  365. <tr id class="spotRow">
  366. <td class="name">Terrace Books</td>
  367. <td>242 Prospect Park West, Brooklyn</td>
  368. </tr>
  369. <tr id class="spotRow">
  370. <td class="name">The Austin Book Shop</td>
  371. <td>104-29 Jamaica Ave, Richmond Hill</td>
  372. </tr>
  373. <tr id class="spotRow">
  374. <td class="name">The Book Cellar</td>
  375. <td>1465 York Ave, New York</td>
  376. </tr>
  377. <tr id class="spotRow">
  378. <td class="name">The Center for Fiction</td>
  379. <td>15 Lafayette Ave, Brooklyn</td>
  380. </tr>
  381. <tr id class="spotRow">
  382. <td class="name">The Corner Bookstore</td>
  383. <td>1313 Madison Ave, New York</td>
  384. </tr>
  385. <tr id class="spotRow">
  386. <td class="name">The Lit. Bar</td>
  387. <td>131 Alexander Ave, Bronx</td>
  388. </tr>
  389. <tr id class="spotRow">
  390. <td class="name">The Mysterious Bookshop</td>
  391. <td>58 Warren St, New York</td>
  392. </tr>
  393. <tr id class="spotRow">
  394. <td class="name">Three Lives &amp; Company</td>
  395. <td>154 West 10th St, New York</td>
  396. </tr>
  397. <tr id class="spotRow">
  398. <td class="name">Topos Bookstore Cafe</td>
  399. <td>788 Woodward Ave, Brooklyn</td>
  400. </tr>
  401. <tr id class="spotRow">
  402. <td class="name">Turn The Page... Again</td>
  403. <td>39-15a Bell Blvd, Flushing</td>
  404. </tr>
  405. <tr id class="spotRow">
  406. <td class="name">Unnameable Books</td>
  407. <td>600 Vanderbilt Ave, Brooklyn</td>
  408. </tr>
  409. <tr id class="spotRow">
  410. <td class="name">Unoppressive Non-Imperialist Bargain Books</td>
  411. <td>34 Carmine St, New York</td>
  412. </tr>
  413. <tr id class="spotRow">
  414. <td class="name">Ursus Books</td>
  415. <td>50 East 78th St, Suite 1C, New York</td>
  416. </tr>
  417. <tr id class="spotRow">
  418. <td class="name">Westsider Rare &amp; Used Books</td>
  419. <td>2246 Broadway, New York</td>
  420. </tr>
  421. <tr id class="spotRow">
  422. <td class="name">Westsider Records</td>
  423. <td>233 West 72nd St, New York</td>
  424. </tr>
  425. <tr id class="spotRow">
  426. <td class="name">Word Bookstore</td>
  427. <td>126 Franklin St, Brooklyn</td>
  428. </tr>
  429. <tr id class="spotRow">
  430. <td class="name">Word Up Books</td>
  431. <td>2113 Amsterdam Ave, New York</td>
  432. </tr>
  433. </tbody></table>
  434. </div>
  435. </div>
  436. </div><!-- end wrapper -->
  437. <script id="Table" type="text/html">
  438. <table>
  439. <tr><th class="tHeader">Name</th><th class="tHeader">Address</th></tr>
  440. {{#rows}}
  441. <tr id="{{rowNumber}}" class="spotRow">
  442. <td class="name">{{name}}</td>
  443. <td>{{address}}, {{city}}</td>
  444. </tr>
  445. {{/rows}}
  446. </table>
  447. </script>
  448. <script id="selectedStore" type="text/html">
  449. {{#store}}
  450. <h2>{{name}}</h2>
  451. <p class="address">{{address}}<p>
  452. <p class="address">{{city}},NY {{#postcode}} {{postcode}} {{/postcode}}</p>
  453. <p>
  454. <a href="https://maps.google.com/maps?q={{name}} {{address}},{{city}},NY" target="_blank">View in Google Maps</a>
  455. </p>
  456. <ul>
  457. <li>
  458. <span class="store-details">Events:</span> {{events}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  459. <span class="store-details">Caf&eacute;:</span> {{cafe}}
  460. </li>
  461. {{#website}}
  462. <li><a href='{{website}}' target="_blank">{{website}}</a></li>
  463. {{/website}}
  464. </ul>
  465. {{#description}}
  466. <p class="description">{{description}}</p>
  467. {{/description}}
  468. {{/store}}
  469. </script>
  470. <script>
  471. mapboxgl.accessToken = 'pk.eyJ1IjoiYWxhenlyZWFkZXIiLCJhIjoiY2lucDZhb2JxMHp6MHRxa2pvaTFoOWpuZyJ9.DILGYYxxt7A-A_lHHwp6tQ';
  472. var map = new mapboxgl.Map({
  473. container: 'map',
  474. style: 'mapbox://styles/mapbox/basic-v9',
  475. center: [-73.957292, 40.729071], // arbitrary center point
  476. zoom: 10,
  477. minZoom: 9,
  478. maxZoom: 17,
  479. dragRotate: false
  480. });
  481. var popup = new mapboxgl.Popup({
  482. closeOnClick: false,
  483. closeButton: false
  484. });
  485. document.addEventListener('DOMContentLoaded', function() {
  486. $.getJSON('./stores.json', function(data) {
  487. data.sort(
  488. function(a, b) {
  489. var aname = a.name.toLowerCase();
  490. var bname = b.name.toLowerCase();
  491. return aname === bname ? 0 : +(aname > bname) || -1;
  492. }
  493. )
  494. $.each(data, function(key, value) {
  495. value.rowNumber = key;
  496. value.slug = slugify(value.name);
  497. });
  498. $('#storeCount').html(data.length);
  499. window.data = data;
  500. loadMap(data);
  501. });
  502. });
  503. window.addEventListener("hashchange", function(e){
  504. updateViewBySlug(e.newURL.split('#')[1]);
  505. }, false);
  506. function updateHash(slug) {
  507. history.pushState(null, null, "#" + slug);
  508. }
  509. function slugify(str) {
  510. return str
  511. .toLowerCase()
  512. .replace(/é/g,'e')
  513. .replace(/&/g,' and ')
  514. .replace(/ /g,'-')
  515. .replace(/[']+/g,'')
  516. .replace(/[^\w-]+/g,'-')
  517. .replace(/-+/g,'-')
  518. .replace(/^-|-$/g,'');
  519. }
  520. function getStoreBySlug(slug) {
  521. var ret = false;
  522. $.each(window.data, function(key, value) {
  523. if (value.slug === slug) {
  524. ret = value;
  525. return false;
  526. }
  527. });
  528. return ret;
  529. }
  530. function updateViewBySlug(slug) {
  531. if (slug === "info" || slug === undefined) {
  532. showInfo(false);
  533. } else {
  534. var store = getStoreBySlug(slug);
  535. if (store) {
  536. updateSelectedStore(store, false);
  537. }
  538. }
  539. }
  540. function boundingBox(point) {
  541. // add some buffer to a point to give the user some leeway
  542. return [[point.x - 5, point.y - 5], [point.x + 5, point.y + 5]]
  543. }
  544. function updateSelectedStore(store, pushState=false) {
  545. map.flyTo({center: [store.long, store.lat]});
  546. popup.setLngLat([store.long, store.lat])
  547. .setHTML(store.name)
  548. .addTo(map);
  549. $('#info').hide();
  550. var template = $('#selectedStore').html();
  551. var rendered = Mustache.render(template, {store: store});
  552. $('#selected').html(rendered);
  553. $('#selected').show();
  554. if (pushState) {
  555. updateHash(store.slug);
  556. }
  557. }
  558. function showInfo(pushState=true) {
  559. $('#selected').hide();
  560. popup.remove();
  561. $('#info').show();
  562. if (pushState) {
  563. updateHash('info');
  564. }
  565. }
  566. function loadMap(data) {
  567. var geolocate = new mapboxgl.GeolocateControl();
  568. var points = [];
  569. $.each(data, function(key, value) {
  570. points.push({
  571. "type": "Feature",
  572. "geometry": {
  573. "type": "Point",
  574. "coordinates": [value.long, value.lat]
  575. },
  576. "properties": value
  577. });
  578. });
  579. map.on('load', function () {
  580. map.addLayer({
  581. "id": "stores",
  582. "type": "circle",
  583. "source": {
  584. "type": "geojson",
  585. "data": {
  586. "type": "FeatureCollection",
  587. "features": points
  588. }
  589. },
  590. "paint": {
  591. "circle-radius": 5,
  592. "circle-color": "#B9FCFC",
  593. "circle-stroke-width": 2,
  594. "circle-stroke-color": "#000000"
  595. }
  596. })
  597. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  598. map.addControl(geolocate, 'top-right');
  599. updateViewBySlug(window.location.hash.split("#")[1]);
  600. });
  601. map.on('click', function (e) {
  602. if (!map.getLayer('stores')) { return; }
  603. popup.remove();
  604. // Use queryRenderedFeatures to get features at a click event's point
  605. var features = map.queryRenderedFeatures(boundingBox(e.point), { layers: ['stores'] });
  606. // fly to the location of the click event
  607. if (features.length) {
  608. var store = features[0];
  609. // Get coordinates from the symbol and center the map on those coordinates
  610. updateSelectedStore(store.properties, true);
  611. }
  612. });
  613. // indicate that the symbols are clickable by changing the cursor style to 'pointer'.
  614. map.on('mousemove', function (e) {
  615. if (!map.getLayer('stores')) { return; }
  616. var features = map.queryRenderedFeatures(boundingBox(e.point), { layers: ['stores'] });
  617. map.getCanvas().style.cursor = features.length ? 'pointer' : '';
  618. });
  619. geolocate.on('geolocate', function (e) {
  620. map.setZoom(14);
  621. popup.setLngLat([e.coords.longitude, e.coords.latitude])
  622. .setHTML('Current Location')
  623. .addTo(map);
  624. });
  625. var template = $('#Table').html();
  626. var rendered = Mustache.render(template, {rows: data});
  627. $('#Stores').html(rendered);
  628. $("#Stores tbody tr").not(':first').on("click", function() {
  629. updateSelectedStore(data[$(this)[0].id], true);
  630. $(window).scrollTo($("#selected"), 250, {offset: {top: -15}});
  631. });
  632. $('#viewInfo').on("click", showInfo);
  633. };
  634. </script>
  635. <script>
  636. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  637. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  638. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  639. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  640. ga('create', 'UA-100418882-1', 'auto');
  641. ga('send', 'pageview');
  642. </script>
  643. </body></html>