From 77c8b01daf605bbe9187a29923054d9e82bb27fa Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Tue, 28 Jan 2020 20:06:24 +0000 Subject: [PATCH 1/3] Not working in this form --- project.clj | 8 +- .../img/map-pins/Anchor-customer-pin.png | Bin 0 -> 1648 bytes .../img/map-pins/Anchor-customer-pin.svg | 166 ++++++++++++++ .../img/map-pins/Broadband-supplier-pin.png | Bin 0 -> 1924 bytes .../img/map-pins/Broadband-supplier-pin.svg | 213 ++++++++++++++++++ .../public/img/map-pins/Investor-pin.png | Bin 0 -> 1917 bytes .../public/img/map-pins/Investor-pin.svg | 162 +++++++++++++ .../public/img/map-pins/Landowner-pin.png | Bin 0 -> 1841 bytes .../public/img/map-pins/Landowner-pin.svg | 169 ++++++++++++++ .../public/img/map-pins/Operator-pin.png | Bin 0 -> 1996 bytes .../public/img/map-pins/Operator-pin.svg | 161 +++++++++++++ .../img/map-pins/Other-key-customers-pin.png | Bin 0 -> 1777 bytes .../img/map-pins/Other-key-customers-pin.svg | 162 +++++++++++++ .../img/map-pins/Power-supplier-pin.png | Bin 0 -> 2198 bytes .../img/map-pins/Power-supplier-pin.svg | 174 ++++++++++++++ src/clj/geocsv/handler.clj | 24 +- src/clj/geocsv/routes/home.clj | 11 +- src/clj/geocsv/routes/json.clj | 91 ++++++++ 18 files changed, 1323 insertions(+), 18 deletions(-) create mode 100644 resources/public/img/map-pins/Anchor-customer-pin.png create mode 100644 resources/public/img/map-pins/Anchor-customer-pin.svg create mode 100644 resources/public/img/map-pins/Broadband-supplier-pin.png create mode 100644 resources/public/img/map-pins/Broadband-supplier-pin.svg create mode 100644 resources/public/img/map-pins/Investor-pin.png create mode 100644 resources/public/img/map-pins/Investor-pin.svg create mode 100644 resources/public/img/map-pins/Landowner-pin.png create mode 100644 resources/public/img/map-pins/Landowner-pin.svg create mode 100644 resources/public/img/map-pins/Operator-pin.png create mode 100644 resources/public/img/map-pins/Operator-pin.svg create mode 100644 resources/public/img/map-pins/Other-key-customers-pin.png create mode 100644 resources/public/img/map-pins/Other-key-customers-pin.svg create mode 100644 resources/public/img/map-pins/Power-supplier-pin.png create mode 100644 resources/public/img/map-pins/Power-supplier-pin.svg create mode 100644 src/clj/geocsv/routes/json.clj diff --git a/project.clj b/project.clj index 9992b17..3da9450 100644 --- a/project.clj +++ b/project.clj @@ -1,19 +1,23 @@ (defproject geocsv "0.1.0-SNAPSHOT" - :description "FIXME: write description" + :description "A wee tool to show comma-separated value data on a map." :url "http://example.com/FIXME" - :dependencies [[ch.qos.logback/logback-classic "1.2.3"] + :dependencies [[adl-support "0.1.6"] + [ch.qos.logback/logback-classic "1.2.3"] [cheshire "5.9.0"] [cljs-ajax "0.8.0"] [cljsjs/leaflet "1.2.0-0"] [clojure.java-time "0.3.2"] [com.cemerick/url "0.1.1"] [com.cognitect/transit-clj "0.8.319"] + [compojure "1.6.1"] [cprop "0.1.15"] + [csv2edn "0.1.5"] [day8.re-frame/http-fx "0.1.6"] [expound "0.8.3"] [funcool/struct "1.4.0"] + [lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]] [luminus-jetty "0.1.7"] [luminus-transit "0.1.2"] [luminus/ring-ttl-session "0.3.3"] diff --git a/resources/public/img/map-pins/Anchor-customer-pin.png b/resources/public/img/map-pins/Anchor-customer-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..4cbe582431c38ff8f8c0da9f3aceac8efc9da01d GIT binary patch literal 1648 zcmV-$29NoPP)JM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(*K1oDDR9JwS>_5>;P?A&9*^gfR7!oQ zX`&uf5ibNHDJ26!$dd~T3t#p0^eh1gfMdsw`I1Tb6Nqi&a9(y4lDRaT z&Lw+m>%d-{%@{L`<^B5Z-Mc?kN_+qE<(IDICQWK^x&=xS&>V(k9WFLNbrc*%HqAuB zVoXnOn5nCqeOcGFN1Bx4#Q3;pe0?juxE0z)Kv!_74klgD(FecO=hlT-%pRYZ@JuKr zPH37&LnLC4u168##o$W7m>W9#!5xP|57-RT8@Vwz=a|ri*6c zP_+p6%OK)NmpydB!7)%-w=oOx8v}5)7Piko!!xc9Hk$8<1CHKFmkqh$N-Z27D3I8b zfOoPgXU4Xu`D90)r~1Vq3-Lc2{+sFS`fCu+*x}3`7%#~z&xOen=-OjOL|(*q%Aw;X z^wzC62d}~qaHS49|AhXEJc(yZpym;@4MV6AQeyqYp+;yO0dMU2P|Hc2(#)FcU4-U` zX7OJSPPM>}X)}fD3XCQZ; zxau{_VB08cdi?zSupO>!g~~_JJ_g_K1figHG*4phBDmsE8H4i;W+GV#!*4!_*;eOC zVdiA#vRN`+3HY%d8p05EW~*8jKtiTY_N_tl-CG1bTfjdGZw{r;>FiG*U#bO10`^V; zQ<*6hfYhX9x};=z&C>^MV`f(wY&5&dOh{<(!w#?-W`nRcoX%y3luT~Y2rIgR!7OkLtmPlCY zFI;HqH4ObpQt|um?sK`~QIMYlX-PxVw4_q%UN9K!OY=l#2W3WQXJ=(9rS1<8mrvfh zT?v0KyB`F!oX$xrb7!pKEI7s&rimr*ml|(EGm=0|=o`mX7AtjqeJvQE+=} uwOYScN-Zd*P8VvUU>rGe + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Broadband-supplier-pin.png b/resources/public/img/map-pins/Broadband-supplier-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..7d07d8bf8b20a411fccb13c7426a9565337991a8 GIT binary patch literal 1924 zcmV-~2YdL5P)JM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(+Qb|NXR9J<*mTznu2DoN2Hl(WRpC%?I^qcDd$B!S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git a/resources/public/img/map-pins/Broadband-supplier-pin.svg b/resources/public/img/map-pins/Broadband-supplier-pin.svg new file mode 100644 index 0000000..905c241 --- /dev/null +++ b/resources/public/img/map-pins/Broadband-supplier-pin.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Investor-pin.png b/resources/public/img/map-pins/Investor-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..cebbfbba7a5c56a6a77a82adc2322eff9d1b9b64 GIT binary patch literal 1917 zcmV-@2ZH#CP)JM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(+OG!jQR9Jycs1rtfmHJeK z1w!wJu>=@-6I$Wea6zdIs4FeW3!9speaPiwp8?a4}&4=(7u#L_ny}|dsyOn6DjclRuF{M2+_(d6}?B*Op_A9FYNE1 z-rP0fG-`0Vp~iUa!3ny^L2tb1kS8`_L?k!c!n26HS!cbLso~_s#O6xhnb$5&s^d8B zRhC7tyiOSLjaBJ8zYLb|yAUk{07xZdX8Y;z)a|Fkid@f-Xi(EB<;6suFw%D{Y+Q~B zz?6IR$%q;m0H8OL){T|F6?2_B2u;O=0>@!W#v(V=7zc7OwHw&Pi!;ss zu{a#2giz4nTm+x3F%3RmZs@-g@3py>ZjHiVDIq6g0Dx~BO3#&>xe>K|l~ogYeV(;9 zSG}B#EqW|%denAFEx&q>LV)#GQLPqqZk1 z4dITL%iH(VJ5QK+EGlu2_bF?PY3v;m3zXt%Lh*C^d~@dSx>|eqN?cev!xY@~sO^Fh zw=0xZ)ELt^I4WzD;EWhJKTp<)R?I5Q+FY)C5zGJ$_(d+O zM+gAEs(1dO=dh$Cd_I^gZ1KdLN;!;xZd+J#)}qgTb|9_Mvp@q_rqJ|j#8e_tlr>JZ z4sE<;S=nzB1umv!paip)N$q&bacbGUreJ1Hq6i%sGCCwc2bk*W>W(DAYkN}~{X^zh zFw=dqnM=L$pt;AQW8<+j#o?sPiSq5!YS7^H{dVo}irIyizix1L%ysIrRwN1lA6<1! z_aw9?Lg@1d0Kn~bKgBY5?-X4!w9G!}oncHwSVUF7Y@tz!^^N@do;!?;Sfpna+i|1H z^D(`!d%!y7azbk%6dD>E8=Gzx=ytp3at!)Hrs#ep0gOPZ(4~Uw%K9%jc`?q;5Mf#%W4vS7T#i=dE$o9ZCsHmMkd-O1c+W!~H9q0S^Gc zxtLCP*E{iHLdd+Prl#L>)yjFx1OV8-e}6zGbnD?E)5H`-7y#f{*l1@Ey_}C}-o^j` zk|b?UQp~r7OvL~IoiUvtQ}jc=I(Zwnw6qK$N)8_hn;a5Fs9)p@0igYVHwFNZDcX54 zuC*VFm~0XS4k2_rUyZzm>jqpdm)2qydJ7m?AD3`&U*q?a^3@nu#cgeENr}*pBNC&N z0PPu%#<+|D0C=AN3@D9KO81RdW87H0c=1XYXS@CZ4yd0#-3znm00000NkvXXu0mjf Dr6YB2 literal 0 HcmV?d00001 diff --git a/resources/public/img/map-pins/Investor-pin.svg b/resources/public/img/map-pins/Investor-pin.svg new file mode 100644 index 0000000..da764a0 --- /dev/null +++ b/resources/public/img/map-pins/Investor-pin.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Landowner-pin.png b/resources/public/img/map-pins/Landowner-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..0a8a6ec371c7cd372eb30896a98e9747a10af822 GIT binary patch literal 1841 zcmV-12hRA3P)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V^y(uMDZfGGl0Et~V+d|L!yEgtqOshzIZ zr*820`1l=#Jd?Q5zEvq*7;D}jF!_H611KrpTuX#nQa7VbQVP2e;#|ERo9dc}hK3pf zLEoayQF5CFTViBnY+Jn^n_BV2#DpO&ep)gdE~T`$Hsi4=Fo4tP{3WQ2QtB_8_1JU_ f4-db_CXegC!}e~)PIki900000NkvXXu0mjfuYzzm literal 0 HcmV?d00001 diff --git a/resources/public/img/map-pins/Landowner-pin.svg b/resources/public/img/map-pins/Landowner-pin.svg new file mode 100644 index 0000000..3f3a1a7 --- /dev/null +++ b/resources/public/img/map-pins/Landowner-pin.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Operator-pin.png b/resources/public/img/map-pins/Operator-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..114a5f71509de50f0489f0c2405198e9738e9df3 GIT binary patch literal 1996 zcmV;-2Q&DIP)JM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(+nn^@KR9JC(|)i`#|^H;q}im=x-o5x-HK^Q)7aQ-cWV>0iDbj_rH$H6 zT9HdI+HRJ1pkiccb&6%waua1xkc%_OaG7)24av74H(TRXm7je+ef#dAXyb#=eOOWuugpmGwtS(svy@ z_FYRLsMm}5#v82PyO$ihooKHYv9FI+RaGRMI6>0w+ek0I$f&`gHgys;4rz}BriY-=O*$PqTQwP9&$qSa_b zo69FY{?SB!et&;+vvseiX<|xh>Zm)=G?kQ)(%Xxvx|-H6zrOtY}taRwwCXI{E)Uun#IDj(}^i52~TDw z-q~?kS$LC@@Hm}>S}aU|^bzS*Rjgh%cytsQK$6fU30)B8k5yGfQ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|Ol$SBI;rcyXydO9o%KaN)in zXbp{x32}-d3HR=qB7n>PcQAme3ZLG*85z^uY>iSB!5|1i%Thg-lw30^EG#reMw_EDH<}931>t&^@}YpIffSvbAH! ejz6%><@z^Z*`87t)AF + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Other-key-customers-pin.png b/resources/public/img/map-pins/Other-key-customers-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..3cfa7e8e24fa1093afc0cf4d600ce36a13df2fc4 GIT binary patch literal 1777 zcmVJM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(*zez+vR9J<*m+wzo*BQq@=UyBC zz(0Xf^CK+5q>CE}8>yPKU0c#r)hg9lle}3gHPK!~d$FpM@;B`5_GZ$wNs}UyYJD+H z0fB-iA`#<$95`{}M61lp5rJs;MSW36 z(vcJep>_hSbR{yrj5pDoXa&A8mHG3bp`obg?d`SuJiafihPA2VYR8whb(^tyV4AdL zk;U2^Io*pl+eFhwH4`vghGX)%$sW^g{wHf@pRsto-gku*!H%mPW1FE9O!y*1o?2j` zK_W#l?!=ktqHFF5N2cxA3+00C>-J3WTJX!eNAA90wOW6phn@=k)gSez>u2j1i%G)_ zcMLQ9(>2y=6-sP2$dk85i8g%A*MU9kS$5&dmkYP%tft{M?1tOu)X?Z~Bpk`&%gbEe zGtT&r1wu8`yi!M9s+7qptF8-NIFuq)Q!W_58F#JU0ldkZ zpLf%}3^2gJz8l;KZZ}zH-8sb2zPEY%U*&>zsY`{b(KZJoM1l$>ym;4(P=J?tdHPXC z6HK(mh}p{p7qtaE%WNZnfl-qss~6)dtT-NJpitr#w;HPkr%7833>!d}Y|RIJ@RM0) zJ-4}CKg7_1$C<>4)m93&6d!Wrwyb`JnZP;D1Pc z0B`Zuje6>nrINSHhAkH+d@Dp~?qfdQA0hIis=+Q?`7@lk)_zALyaUExZn1xw+1o{w%H`#*=PQuWYt?=@cgwvompK$4`ZkG?~%^ZK12 z!TAsQu=^UwVsT_6^>+vzy(EBaC#9Gv55YfP3hj56A}Io|?E#g5!$0nj$BB~IKEC+-2rk+T{Y`U94`hp( zY^i)3`bJHnCDDXNza9#OZc2;%t>HGD{&|1dKZtUaC5sJPuATOK2RJZS+f&<^u1kBQ zlD`xH;c)mDx~Bi#k#NKUcLGzM6;D#A9cp2O5^GPac^5(p9T{JyPN7Z?3=9lD+}?0F zd{{^Sv(i*|DFdN|=}bD8+rDVKV_&y#xpCy3`I_lxraRNV^b<;`l0``<@f8}s?(gsa zCp>7{HY*$s@7HyGuat6ow`kMQ&RTMoVCZt_s&48J+n2k&cMoPfnWRMi4#;jEq-k1S zDfP|3z`*S-6DhqxrFH!H@kUip6AjZ13#~U>Cjn9oDeu$^Q$LeZJ~ucxc)eV&iVDcZ zix-z9@(;1L*ep25g=Wk_9{&cSL#zS_|m0I zi%P1|_^x=9(v>h=h99{4y@LUiQ0F%4Hl9p0CmNJcRw2ar4+2i5QvCw4I^Q|pg=DV3 zzklin0Y@ScLn42lugN>m_**p|RsR-kHrt<+QYod>KdSYpTE~tZJ41!Fps4=>{sB~Q Tp;tnx00000NkvXXu0mjfFD5`I literal 0 HcmV?d00001 diff --git a/resources/public/img/map-pins/Other-key-customers-pin.svg b/resources/public/img/map-pins/Other-key-customers-pin.svg new file mode 100644 index 0000000..df0a5e3 --- /dev/null +++ b/resources/public/img/map-pins/Other-key-customers-pin.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/img/map-pins/Power-supplier-pin.png b/resources/public/img/map-pins/Power-supplier-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..c766d43e0ce5bac0e51e18aa3b406ab7db900a1f GIT binary patch literal 2198 zcmV;H2x<3;P)JM$2_#Zwc4>2IZ*DpuF)lJ7Bnk-}(96dF000(r zMObu0a%Ew3X>V>IRB3Hx05UK!FfceUF$+otl>h(-WJyFpR9J<*mu+lQ*B!>6bFN<# zCw3CsiLpZ@Bh26K5!fF+Ou36K}!7$@;d9NS53U;Ey3_93J=;3OnveLntQp5Of+-*bHq z!9zJ54voQJc%5^)8(<{>SK^t7BnhFtj7c9wB9Y%Yoz6G_5CEvJueZrEKMg{Q1);(t zC~RSH%AXCF5hg#-OUX_f!0yR%@|EMqk9&y2;n3*yIqigGTQr&bI|wnw(>pM@2T$ci z!u^@)vf29L$-<>Cj{-DpH)mdLJop$9l|LXmcGP!Kp;E2Z z?(9x2oSb-|?z;Vck;`?gD47^nWn@?;WLZ?G)Y;=%!)5NlmO{pog2Aw2 zY{i=0pB0zXds|M_ZD1@(^*N={R5MCdEF;r0`N}t&+dL1>=62scQqtS=H+x^-KT0f? z=ZDM6_w}31Ya;+ag{2`PT`yN~&Xphv1^}Jcf4#ix_K`A5m2Alphi7H^_wE}_YsTkV z-p6INZ4Fv&TY~|Adsg@DKQ12{a$1KxPHS2DzOIVZhwg(Y80So-NNp0uF%=<{Z+rQl z=e3yy2>^)41D|gz&Sk>6Oj2Wy;&et_msJ#ByW#Eb*yKpxsh0W|L~%@&+A{+@Wx`0y z$sLZlrfU3T!?uOQ(`g3SVs!+RDxH+BP)f#y-kt_~ZtkjpxnNx&HRl_-Y77Q%8K1N7 z>`^E+a=Lz_sX8<(xUg{BXkp>D(R7XdeV^p__B3Ec+3x;j%U<=T<_7wkBdwQzWHg#8 zL(7ZneY4N`Na=Tb8VwJ9YNAvr+iWieAJ5sAzBEb&l|1D6kNIi+o*L})UNbW;(ffUk zPnf%0$4#6`)a$+aY{3D4M^-!@&2{yWo6fo2r}F-L<;^NeRk9c#)du_> zSeTD)F#s^-ulI*ScXLHCIPXC7 zf(HjrnmCt<)wb0K0Et9MakKMqDWyu8Ql)&e^KfY*5mEqv)wb2gxl9HJPtLpC^MZ#x z=S_k_D_N~uf=r52=ea#qa}m)SiAo1>*M3D>~sI#RV_(zYPD_&Dij&XVb6sx z3TE*8J4{C7YCnYlr*m)RXy7wbMdiVpCHC)(6qmf_t*rV<=UA{S@6&VNT@6s=}djtSH@e*XO%h(0b{I z<(4Hi{zM|I_KjT8&*eSmOW<*zF#`m_;4S^2>txZ=qHnmWs^92+ysoPHjb2e4Qw`j2 zUQP%d00`XfGbVGv#_*!RUhfqX2>76@rKq5wW~ip-@a@@ZH*Wk@cRUtQy9Q1y0|EDX z+spu-c*tqZy411gh$<59HGp%HlUp{r*>R*3RG9tbNd^AG*FU&nG=9|&&Ph1jV~9-- zt7a=#0AOHKegplDX1DuHJ^;kyehuf000e4Hj@WwXVEL@jR6|u(5+DHQRy^ z17u<0OWtM0b-srzrT_#VFfrlQ1_C#X(wmhu^h5Sc{Bf4+(H@ZTw=NDvRnH@tFsa8N#{RmB z^WJ=bf9vScqu0oEy0*4<10jm{2w@fJ4X7jtHor>q?QTNzV>5FhRXqBaRZMo9rrw*h z{Wl2V`!Oj?a{I;kjL~)Rij1sNxr3%#5K&soFHGRM+(afGqXs#n^k#GsZR^J9ez? zX}uQoLpC-x`Z$;0O(w4ua-N`5;Ldzbg#Lv<7YqgfNs^9$C)9GX-3$OszON@-KDkhz z1%pqVI57g?tR%Ht2$2cr{u}_8|L+sP(p0} z3Lp$NH8u5pDPX758RuO74QCTtKyFx!$D%(^YPI?goFl?H|JPzY7Om~uw|^fC{1!~> Ye>5Ig&K)Y6NdN!<07*qoM6N<$f{ij5vH$=8 literal 0 HcmV?d00001 diff --git a/resources/public/img/map-pins/Power-supplier-pin.svg b/resources/public/img/map-pins/Power-supplier-pin.svg new file mode 100644 index 0000000..74f9329 --- /dev/null +++ b/resources/public/img/map-pins/Power-supplier-pin.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Basic pin for SceneHere + 20100801 + + + Simon Brooke + + + + + Copyright (c) 2010 Simon Brooke + + + basic_map_pin.svg + + Basic default map pin + $Revision: 1.2 $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/clj/geocsv/handler.clj b/src/clj/geocsv/handler.clj index 15308eb..48c42d8 100644 --- a/src/clj/geocsv/handler.clj +++ b/src/clj/geocsv/handler.clj @@ -1,13 +1,14 @@ (ns geocsv.handler - (:require - [geocsv.middleware :as middleware] - [geocsv.layout :refer [error-page]] - [geocsv.routes.home :refer [home-routes]] - [reitit.ring :as ring] - [ring.middleware.content-type :refer [wrap-content-type]] - [ring.middleware.webjars :refer [wrap-webjars]] - [geocsv.env :refer [defaults]] - [mount.core :as mount])) + (:require [compojure.core :refer [routes wrap-routes]] + [geocsv.env :refer [defaults]] + [geocsv.middleware :as middleware] + [geocsv.layout :refer [error-page]] + [geocsv.routes.home :refer [home-routes]] + [geocsv.routes.json :refer [json-routes]] + [reitit.ring :as ring] + [ring.middleware.content-type :refer [wrap-content-type]] + [ring.middleware.webjars :refer [wrap-webjars]] + [mount.core :as mount])) (mount/defstate init-app :start ((or (:init defaults) (fn []))) @@ -17,7 +18,10 @@ :start (ring/ring-handler (ring/router - [(home-routes)]) + [(home-routes) + (-> #'json/json-routes + (wrap-routes middleware/wrap-csrf) + (wrap-routes middleware/wrap-formats))]) (ring/routes (ring/create-resource-handler {:path "/"}) diff --git a/src/clj/geocsv/routes/home.clj b/src/clj/geocsv/routes/home.clj index 9eec70f..fbfd090 100644 --- a/src/clj/geocsv/routes/home.clj +++ b/src/clj/geocsv/routes/home.clj @@ -1,10 +1,9 @@ (ns geocsv.routes.home - (:require - [geocsv.layout :as layout] - [clojure.java.io :as io] - [geocsv.middleware :as middleware] - [ring.util.response] - [ring.util.http-response :as response])) + (:require [clojure.java.io :as io] + [geocsv.layout :as layout] + [geocsv.middleware :as middleware] + [ring.util.response] + [ring.util.http-response :as response])) (defn home-page [request] (layout/render request "home.html")) diff --git a/src/clj/geocsv/routes/json.clj b/src/clj/geocsv/routes/json.clj new file mode 100644 index 0000000..b9e7d30 --- /dev/null +++ b/src/clj/geocsv/routes/json.clj @@ -0,0 +1,91 @@ +(ns geocsv.routes.json + "JSON routes for geocsv." + (:require [adl-support.core :as ac] + [adl-support.rest-support :as ar] + [clojure.core.memoize :as memo] + [clojure.java.io :as io] + [clojure.string :as s] + [clojure.tools.logging :as log] + [compojure.core :refer [defroutes GET POST]] + [csv2edn.csv2edn :refer :all] + [noir.response :as nresponse] + [noir.util.route :as route] + [ring.util.http-response :as response] + )) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; geocsv.routes.json: data service handlers. +;;;; +;;;; This program is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU General Public License +;;;; as published by the Free Software Foundation; either version 2 +;;;; of the License, or (at your option) any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this program; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +;;;; USA. +;;;; +;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defn get-pin-image-names + [request] + (ar/do-or-server-fail + (map + #(s/replace (.getName %) #"-pin\.png$" "") + (let [grammar-matcher (.getPathMatcher + (java.nio.file.FileSystems/getDefault) + "glob:*-pin.png")] + (->> "resources/public/img/map-pins" + clojure.java.io/file + file-seq + (filter #(.isFile %)) + (filter #(.matches grammar-matcher (.getFileName (.toPath %))))))) + 200)) + +(defn get-data-uri + "Return JSON formatted data taken from the CSV file at this URI. The file + must exist, be publicly readable, and use commas as separators." + [uri] + (csv->json uri)) + +(defn get-data-google + "Return JSON formatted data taken from the Google Sheets spreadsheet with + this `docid`. The spreadsheet must exist and must be publicly readable." + [docid] + (get-data-uri + (str + "https://docs.google.com/spreadsheets/d/" + docid + "/export?format=csv"))) + +(defn get-data-file + "Return JSON formatted data taken from the CSV file with the name `filename` + in the directory `resources/public/data`. TODO: There is a safe way to + access the content of the resource directory but I don't recall it just now." + [filename] + (csv->json (io/reader (io/file (str "resources/public/data/" filename))))) + +(defn get-data + [request] + (ar/do-or-server-fail + (let [params (ac/massage-params request)] + (cond + (:docid params) (get-data-google (:docid params)) + (:uri params) (get-data-uri (:uri params)) + (:file params) (get-data-file (:file params)) + :else (get-data-file "data.csv"))) + 200)) + +(defroutes json-routes + (GET "/get-pin-image-names" request (get-pin-image-names request)) + (POST "/get-pin-image-names" request (get-pin-image-names request)) + (GET "/get-data" request (get-data request))) From 08f9c2f201b262586a1fb622f8a6391aa4e620a3 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Tue, 28 Jan 2020 22:29:52 +0000 Subject: [PATCH 2/3] lein-release plugin: preparing 0.1.0 release --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 3da9450..a18d6b7 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject geocsv "0.1.0-SNAPSHOT" +(defproject geocsv "0.1.0" :description "A wee tool to show comma-separated value data on a map." :url "http://example.com/FIXME" From a5881c3b9789f2cefefc7c662754dbc7238f8f3e Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Tue, 28 Jan 2020 22:32:49 +0000 Subject: [PATCH 3/3] Now successfully remote-loading data from Google sheets --- README.md | 44 +++--- env/dev/resources/config.edn | 3 +- pom.xml.asc | 11 ++ resources/html/home.html | 45 +++--- resources/public/css/spinner.css | 141 +++++++++++++++++++ src/clj/geocsv/handler.clj | 57 +++++--- src/clj/geocsv/routes/home.clj | 28 ++-- src/clj/geocsv/routes/{json.clj => rest.clj} | 27 ++-- src/cljs/geocsv/events.cljs | 2 +- src/cljs/geocsv/views/map.cljs | 2 +- 10 files changed, 273 insertions(+), 87 deletions(-) create mode 100644 pom.xml.asc create mode 100644 resources/public/css/spinner.css rename src/clj/geocsv/routes/{json.clj => rest.clj} (79%) diff --git a/README.md b/README.md index af49f3d..2e12b74 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,30 @@ The CSV file must have Additionally, the value of the column `category`, if present, will be used to select map pins from the map pins folder, if a suitable pin is present. Thus is the value of `category` is `foo`, a map pin image with the name `Foo-pin.png` will be selected. +## Passing CSV files to the app + +### Loading them onto the server + +If you run the server running **geocsv**, the simplest way to add CSV files is simply to copy them into the directory `resourcs/data`. The default file is the one named `data.csv`, which is the one that will be served if nothing else is specified. Other files can be specifiec by appending `?file=filename` to the URL; so if the URL of your geocsv service is + + https://geocsv.example.com/ + +and the file you want to view is `myfile.csv`, then you would specify this as + + https://geocsv.example.com/?file=myfile.csv + +### Using a Google spreadsheet + +If you use [Google Sheets](https://www.google.co.uk/sheets/about/), then every sheet has a 'document id', a long string of characters which uniquely identifies that sheet. Suppose your Google spreadsheet has a document id of `abcdefghijklmnopqrstuvwxyz-12345`, then you could pull data from this spreadsheet by specifying: + + https://geocsv.example.com/?docid=abcdefghijklmnopqrstuvwxyz-12345 + +The spreadsheet **must** be publicly readable. + ## Not yet working GeoCSV is at an early stage of development, and some features are not yet working. -### Doesn't actually interpret CSV - -I haven't yet found an easy way to parse CSV into EDN client side, so I've written a [separate library](https://github.com/simon-brooke/csv2edn) to do it server side. However, that library is not yet integrated. Currently the client side actually interprets JSON. - ### Missing map pin images At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist. @@ -28,26 +44,6 @@ At the current stage of development, if no appropriate image exists in the `reso Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't. -### There's no way of linking your own data feed - -Currently, the data is taken from the file `resources/public/data/data.json`. What I intend is that you should have a form which allows you to either - -1. enter [the `DOCID` of your own (publicly readable) Google Sheets spreadsheet](https://stackoverflow.com/questions/33713084/download-link-for-google-spreadsheets-csv-export-with-multiple-sheets); -2. enter the URL of a CSV file publicly available on the web; -3. upload a CSV file to the server. - -### There's no way of shareing the map of your own data with other people - -Currently, the data that is shared is just the data that's present when the app is compiled. Ideally, there should be a way of generating a URL, which might take the form: - - https://server.name/geocsv/docid/564747867 - -To show data from the first sheet of the Google Sheets spreadsheet whose `DOCID` is 564747867; or - - https://server.name/geocsv?uri=https://address.of.another.server/path/to/csv-file.csv - -to show the content of a publicly available CSV file. - ## Prerequisites You will need [Leiningen][1] 2.0 or above installed. diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn index 0967ef4..8df4a7c 100644 --- a/env/dev/resources/config.edn +++ b/env/dev/resources/config.edn @@ -1 +1,2 @@ -{} +{:prod false + :port 3000} diff --git a/pom.xml.asc b/pom.xml.asc new file mode 100644 index 0000000..1b6b04c --- /dev/null +++ b/pom.xml.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- + +iQEzBAABCAAdFiEEgk5pWlj1vvTbfWCZp6TxjR1N+YcFAl4wte0ACgkQp6TxjR1N ++YdU8wgA3OSP8XYP/mI5EAmuR11ryXwTspVgbwBxIK82m+xDwTLQE9Za0I4FdS+g +RGEzo+S5LiYG1dD5fXkmtNr4WcnUJ7v5TFJZWE9eBAX3De0uVsksfF5u7F7I5oGy +mciv/C8hxyM6AQE9OviWE5UtDbJT1NxaLmLZwiZrnG2uq5JDR7h+7N4exWM99g7u +1FpHs/ed3ui+IIgsJdBnHsUBh8eOogvVmPpPePRIE8lQxoGzX/BTkZT3ed9xmdIF +ruyXwgVc9tMzy2wYu05kbOCcYqGeJK94UtPUhOmPbs3Z6nGRaVH5zQb3kiRo4P+S +KlAZkC9+sLY1mACD4JVjV1EWMAYOHg== +=GbQE +-----END PGP SIGNATURE----- diff --git a/resources/html/home.html b/resources/html/home.html index 770c5cc..9cb562e 100644 --- a/resources/html/home.html +++ b/resources/html/home.html @@ -1,31 +1,32 @@ - - - Welcome to geocsv + + + Welcome to geocsv -
-
-
-
-

Welcome to geocsv

-

If you're seeing this message, that means you haven't yet compiled your ClojureScript!

-

Please run lein figwheel to start the ClojureScript compiler and reload the page.

-

For better ClojureScript development experience in Chrome follow these steps:

-
    -
  • Open DevTools -
  • Go to Settings ("three dots" icon in the upper right corner of DevTools > Menu > Settings F1 > General > Console) -
  • Check-in "Enable custom formatters" -
  • Close DevTools -
  • Open DevTools -
-

See ClojureScript documentation for further details.

-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ {% block foot %} @@ -49,7 +50,7 @@ {% style "/css/geocsv.css" %} diff --git a/resources/public/css/spinner.css b/resources/public/css/spinner.css new file mode 100644 index 0000000..979f4ff --- /dev/null +++ b/resources/public/css/spinner.css @@ -0,0 +1,141 @@ +/* + * Cribbed from http://tobiasahlin.com/spinkit/ + * (source here https://github.com/tobiasahlin/SpinKit) + * Thanks Tobias! + */ + +.sk-fading-circle { + margin: 100px auto; + width: 40px; + height: 40px; + position: relative; +} + +.sk-fading-circle .sk-circle { + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; +} + +.sk-fading-circle .sk-circle:before { + content: ''; + display: block; + margin: 0 auto; + width: 15%; + height: 15%; + background-color: #3298dc; + border-radius: 100%; + -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; + animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; +} +.sk-fading-circle .sk-circle2 { + -webkit-transform: rotate(30deg); + -ms-transform: rotate(30deg); + transform: rotate(30deg); +} +.sk-fading-circle .sk-circle3 { + -webkit-transform: rotate(60deg); + -ms-transform: rotate(60deg); + transform: rotate(60deg); +} +.sk-fading-circle .sk-circle4 { + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} +.sk-fading-circle .sk-circle5 { + -webkit-transform: rotate(120deg); + -ms-transform: rotate(120deg); + transform: rotate(120deg); +} +.sk-fading-circle .sk-circle6 { + -webkit-transform: rotate(150deg); + -ms-transform: rotate(150deg); + transform: rotate(150deg); +} +.sk-fading-circle .sk-circle7 { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} +.sk-fading-circle .sk-circle8 { + -webkit-transform: rotate(210deg); + -ms-transform: rotate(210deg); + transform: rotate(210deg); +} +.sk-fading-circle .sk-circle9 { + -webkit-transform: rotate(240deg); + -ms-transform: rotate(240deg); + transform: rotate(240deg); +} +.sk-fading-circle .sk-circle10 { + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} +.sk-fading-circle .sk-circle11 { + -webkit-transform: rotate(300deg); + -ms-transform: rotate(300deg); + transform: rotate(300deg); +} +.sk-fading-circle .sk-circle12 { + -webkit-transform: rotate(330deg); + -ms-transform: rotate(330deg); + transform: rotate(330deg); +} +.sk-fading-circle .sk-circle2:before { + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} +.sk-fading-circle .sk-circle3:before { + -webkit-animation-delay: -1s; + animation-delay: -1s; +} +.sk-fading-circle .sk-circle4:before { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} +.sk-fading-circle .sk-circle5:before { + -webkit-animation-delay: -0.8s; + animation-delay: -0.8s; +} +.sk-fading-circle .sk-circle6:before { + -webkit-animation-delay: -0.7s; + animation-delay: -0.7s; +} +.sk-fading-circle .sk-circle7:before { + -webkit-animation-delay: -0.6s; + animation-delay: -0.6s; +} +.sk-fading-circle .sk-circle8:before { + -webkit-animation-delay: -0.5s; + animation-delay: -0.5s; +} +.sk-fading-circle .sk-circle9:before { + -webkit-animation-delay: -0.4s; + animation-delay: -0.4s; +} +.sk-fading-circle .sk-circle10:before { + -webkit-animation-delay: -0.3s; + animation-delay: -0.3s; +} +.sk-fading-circle .sk-circle11:before { + -webkit-animation-delay: -0.2s; + animation-delay: -0.2s; +} +.sk-fading-circle .sk-circle12:before { + -webkit-animation-delay: -0.1s; + animation-delay: -0.1s; +} + +@-webkit-keyframes sk-circleFadeDelay { + 0%, 39%, 100% { opacity: 0; } + 40% { opacity: 1; } +} + +@keyframes sk-circleFadeDelay { + 0%, 39%, 100% { opacity: 0; } + 40% { opacity: 1; } +} diff --git a/src/clj/geocsv/handler.clj b/src/clj/geocsv/handler.clj index 48c42d8..001fbf6 100644 --- a/src/clj/geocsv/handler.clj +++ b/src/clj/geocsv/handler.clj @@ -1,10 +1,11 @@ (ns geocsv.handler (:require [compojure.core :refer [routes wrap-routes]] + [compojure.route :as route] [geocsv.env :refer [defaults]] [geocsv.middleware :as middleware] [geocsv.layout :refer [error-page]] [geocsv.routes.home :refer [home-routes]] - [geocsv.routes.json :refer [json-routes]] + [geocsv.routes.rest :refer [rest-routes]] [reitit.ring :as ring] [ring.middleware.content-type :refer [wrap-content-type]] [ring.middleware.webjars :refer [wrap-webjars]] @@ -16,24 +17,42 @@ (mount/defstate app-routes :start - (ring/ring-handler - (ring/router - [(home-routes) - (-> #'json/json-routes - (wrap-routes middleware/wrap-csrf) - (wrap-routes middleware/wrap-formats))]) - (ring/routes - (ring/create-resource-handler - {:path "/"}) - (wrap-content-type - (wrap-webjars (constantly nil))) - (ring/create-default-handler - {:not-found - (constantly (error-page {:status 404, :title "404 - Page not found"})) - :method-not-allowed - (constantly (error-page {:status 405, :title "405 - Not allowed"})) - :not-acceptable - (constantly (error-page {:status 406, :title "406 - Not acceptable"}))})))) + ;; This is an older way of doing routing and Dmitri Sotnikov now does it + ;; another way which is almost certainly better but I can't make it work. + (routes + (-> #'home-routes + (wrap-routes middleware/wrap-csrf) + (wrap-routes middleware/wrap-formats)) + (-> #'rest-routes + (wrap-routes middleware/wrap-csrf) + (wrap-routes middleware/wrap-formats)) + (route/resources "/") + (route/not-found + (:body + (error-page {:status 404 + :title "Page not found" + :message "The page you requested has not yet been implemented"}))))) + + +;; (ring/ring-handler +;; (ring/router +;; [(home-routes) +;; ;; (-> rest-routes +;; ;; (wrap-routes middleware/wrap-csrf) +;; ;; (wrap-routes middleware/wrap-formats)) +;; ]) +;; (ring/routes +;; (ring/create-resource-handler +;; {:path "/"}) +;; (wrap-content-type +;; (wrap-webjars (constantly nil))) +;; (ring/create-default-handler +;; {:not-found +;; (constantly (error-page {:status 404, :title "404 - Page not found"})) +;; :method-not-allowed +;; (constantly (error-page {:status 405, :title "405 - Not allowed"})) +;; :not-acceptable +;; (constantly (error-page {:status 406, :title "406 - Not acceptable"}))})))) (defn app [] (middleware/wrap-base #'app-routes)) diff --git a/src/clj/geocsv/routes/home.clj b/src/clj/geocsv/routes/home.clj index fbfd090..005a18b 100644 --- a/src/clj/geocsv/routes/home.clj +++ b/src/clj/geocsv/routes/home.clj @@ -1,19 +1,29 @@ (ns geocsv.routes.home (:require [clojure.java.io :as io] + [compojure.core :refer [defroutes GET POST]] [geocsv.layout :as layout] [geocsv.middleware :as middleware] [ring.util.response] [ring.util.http-response :as response])) (defn home-page [request] - (layout/render request "home.html")) + "Serve the home page, in the process merging any parameters passed + in the request into the session." + (assoc + (layout/render request "home.html") + :session + (merge + (:session request) + (:params request)))) -(defn home-routes [] - ["" - {:middleware [middleware/wrap-csrf - middleware/wrap-formats]} - ["/" {:get home-page}] - ["/docs" {:get (fn [_] - (-> (response/ok (-> "docs/docs.md" io/resource slurp)) - (response/header "Content-Type" "text/plain; charset=utf-8")))}]]) +(defroutes home-routes + (GET "/" request (home-page request)) + (GET "/docs" _ (fn [_] + (-> + (response/ok + (-> + "docs/docs.md" + io/resource + slurp)) + (response/header "Content-Type" "text/plain; charset=utf-8"))))) diff --git a/src/clj/geocsv/routes/json.clj b/src/clj/geocsv/routes/rest.clj similarity index 79% rename from src/clj/geocsv/routes/json.clj rename to src/clj/geocsv/routes/rest.clj index b9e7d30..26d0446 100644 --- a/src/clj/geocsv/routes/json.clj +++ b/src/clj/geocsv/routes/rest.clj @@ -1,5 +1,5 @@ -(ns geocsv.routes.json - "JSON routes for geocsv." +(ns geocsv.routes.rest + "REST routes for geocsv." (:require [adl-support.core :as ac] [adl-support.rest-support :as ar] [clojure.core.memoize :as memo] @@ -44,8 +44,9 @@ (let [grammar-matcher (.getPathMatcher (java.nio.file.FileSystems/getDefault) "glob:*-pin.png")] - (->> "resources/public/img/map-pins" - clojure.java.io/file + (->> "public/img/map-pins" + io/resource + io/file file-seq (filter #(.isFile %)) (filter #(.matches grammar-matcher (.getFileName (.toPath %))))))) @@ -69,15 +70,20 @@ (defn get-data-file "Return JSON formatted data taken from the CSV file with the name `filename` - in the directory `resources/public/data`. TODO: There is a safe way to - access the content of the resource directory but I don't recall it just now." + in the directory `resources/public/data`." [filename] - (csv->json (io/reader (io/file (str "resources/public/data/" filename))))) + (-> (str "public/data/" filename) io/resource io/file io/reader csv->json)) (defn get-data + "Return JSON formatted data from the source implied by this `request`." [request] (ar/do-or-server-fail - (let [params (ac/massage-params request)] + ;; We're merging the parameters from the request with the key/value + ;; pairs already in the session, so that parame put into the session + ;; by calls to the home page can be used here. + (let [params (merge + (:session request) + (ac/massage-params request))] (cond (:docid params) (get-data-google (:docid params)) (:uri params) (get-data-uri (:uri params)) @@ -85,7 +91,8 @@ :else (get-data-file "data.csv"))) 200)) -(defroutes json-routes +(defroutes rest-routes (GET "/get-pin-image-names" request (get-pin-image-names request)) (POST "/get-pin-image-names" request (get-pin-image-names request)) - (GET "/get-data" request (get-data request))) + (GET "/get-data" request (get-data request)) + (POST "/get-data" request (get-data request))) diff --git a/src/cljs/geocsv/events.cljs b/src/cljs/geocsv/events.cljs index f620f71..f461a71 100644 --- a/src/cljs/geocsv/events.cljs +++ b/src/cljs/geocsv/events.cljs @@ -60,7 +60,7 @@ :fetch-data (fn [{db :db} _] (let [uri (assoc source-host - :path "/data/data.json")] + :path "/get-data")] (js/console.log (str "Fetching data: " uri)) diff --git a/src/cljs/geocsv/views/map.cljs b/src/cljs/geocsv/views/map.cljs index 181d37d..8d9d3b5 100644 --- a/src/cljs/geocsv/views/map.cljs +++ b/src/cljs/geocsv/views/map.cljs @@ -91,7 +91,7 @@ (defn map-render "Render the actual div containing the map." [] - [:div#map {:style {:height "500px"}}]) + [:div#map {:style {:height "1000px"}}]) (defn panel "A reagent class for the map object."