양선아

6/10 updates

...@@ -2,19 +2,35 @@ ...@@ -2,19 +2,35 @@
2 <html lang="kr"> 2 <html lang="kr">
3 <head> 3 <head>
4 <title>RF-Project</title> 4 <title>RF-Project</title>
5 + <meta charset="utf-8">
5 <!--BOOTSTRAP 사용 부분--> 6 <!--BOOTSTRAP 사용 부분-->
6 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> 7 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
7 <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> 8 <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
8 <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> 9 <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
9 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> 10 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
10 - 11 + <div id="header">
12 + <style>
13 + #header{
14 + color: brown;
15 + text-align: center;
16 + background: #fff7b5;
17 + font-family: "210 자연주의";
18 + }
19 + h1{
20 + font-weight: bold;
21 + }
22 + h3{
23 + font-family: "Dovemayo";
24 + }
25 + </style>
26 + </div>
11 </head> 27 </head>
12 28
13 <body> 29 <body>
14 <!--body--> 30 <!--body-->
15 <div id="bodyWrap"> 31 <div id="bodyWrap">
16 <div id="header"> 32 <div id="header">
17 - <h1><a href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1> 33 + <h1 class="projectname"><a href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1>
18 <br> 34 <br>
19 <h3>농산물 시장 유통에 대한 통계분석 입니다.</h3> 35 <h3>농산물 시장 유통에 대한 통계분석 입니다.</h3>
20 <br> 36 <br>
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
10 <!--css 내용 여기에 direct로 넣었다--> 10 <!--css 내용 여기에 direct로 넣었다-->
11 <style> 11 <style>
12 #mapbase {position:relative; width:40%; height:0; padding-bottom:40%; } 12 #mapbase {position:relative; width:40%; height:0; padding-bottom:40%; }
13 + h1 {
14 + font-size: 20px;
15 + }
13 .info { 16 .info {
14 padding: 6px 8px; 17 padding: 6px 8px;
15 font: 14px/16px Arial, Helvetica, sans-serif; 18 font: 14px/16px Arial, Helvetica, sans-serif;
...@@ -33,6 +36,7 @@ ...@@ -33,6 +36,7 @@
33 margin-right: 8px; 36 margin-right: 8px;
34 opacity: 0.7; 37 opacity: 0.7;
35 } 38 }
39 +
36 </style> 40 </style>
37 41
38 <!--BOOTSTRAP 사용 부분--> 42 <!--BOOTSTRAP 사용 부분-->
...@@ -128,17 +132,16 @@ ...@@ -128,17 +132,16 @@
128 <div id="map_design"> 132 <div id="map_design">
129 <script> 133 <script>
130 var geojson; 134 var geojson;
131 - var density_max = 3300;
132 function getColor(d) { 135 function getColor(d) {
133 - return d > density_max*0.9 ? '#FF0015' : 136 + return d > parseInt(density_max*0.9) ? '#FF0015' :
134 - d > density_max*0.8 ? '#F20D20' : 137 + d > parseInt(density_max*0.8) ? '#F20D20' :
135 - d > density_max*0.7 ? '#E6192A' : 138 + d > parseInt(density_max*0.7) ? '#E6192A' :
136 - d > density_max*0.6 ? '#D92635' : 139 + d > parseInt(density_max*0.6) ? '#D92635' :
137 - d > density_max*0.5 ? '#CC3340' : 140 + d > parseInt(density_max*0.5) ? '#CC3340' :
138 - d > density_max*0.4 ? '#BF404A' : 141 + d > parseInt(density_max*0.4) ? '#BF404A' :
139 - d > density_max*0.3 ? '#B34D55' : 142 + d > parseInt(density_max*0.3) ? '#B34D55' :
140 - d > density_max*0.2 ? '#A65960' : 143 + d > parseInt(density_max*0.2) ? '#A65960' :
141 - d > density_max*0.1 ? '#99666A' : 144 + d > parseInt(density_max*0.1) ? '#99666A' :
142 '#8C7375'; 145 '#8C7375';
143 } 146 }
144 function style(feature) { 147 function style(feature) {
...@@ -214,7 +217,7 @@ ...@@ -214,7 +217,7 @@
214 legend.onAdd = function (map) { 217 legend.onAdd = function (map) {
215 218
216 var div = L.DomUtil.create('div', 'info legend'), 219 var div = L.DomUtil.create('div', 'info legend'),
217 - grades = [0, density_max*0.1, density_max*0.2, density_max*0.3, density_max*0.4,density_max*0.5, density_max*0.6, density_max*0.7, density_max*0.8,density_max*0.9], 220 + grades = [0, parseInt(density_max*0.1), parseInt(density_max*0.2), parseInt(density_max*0.3), parseInt(density_max*0.4),parseInt(density_max*0.5), parseInt(density_max*0.6), parseInt(density_max*0.7), parseInt(density_max*0.8),parseInt(density_max*0.9)],
218 labels = [], 221 labels = [],
219 from, to; 222 from, to;
220 223
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
2 <html lang="kr"> 2 <html lang="kr">
3 <head> 3 <head>
4 <title>RF-Project</title> 4 <title>RF-Project</title>
5 + <meta charset = "utf-8">
5 <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 --> 6 <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 -->
6 <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 --> 7 <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 -->
7 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. --> 8 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. -->
...@@ -104,6 +105,9 @@ ...@@ -104,6 +105,9 @@
104 var statesdata = "{{maps.mapdata}}".replace(/&quot;/g,"\""); 105 var statesdata = "{{maps.mapdata}}".replace(/&quot;/g,"\"");
105 statesdata = JSON.parse(statesdata); 106 statesdata = JSON.parse(statesdata);
106 let key = Object.keys(statesdata.features[1].properties); 107 let key = Object.keys(statesdata.features[1].properties);
108 + var density_max = "{{max}}".replace(/&#x27;/g,"\"");
109 + density_max = JSON.parse(density_max);
110 + density_max = Number(density_max.maxx);
107 </script> 111 </script>
108 </div> 112 </div>
109 <!--지도에 밀도 데이터 받는 부분--> 113 <!--지도에 밀도 데이터 받는 부분-->
...@@ -136,17 +140,16 @@ ...@@ -136,17 +140,16 @@
136 <div id="map_design"> 140 <div id="map_design">
137 <script> 141 <script>
138 var geojson; 142 var geojson;
139 - var density_max = 100;
140 function getColor(d) { 143 function getColor(d) {
141 - return d > density_max*0.9 ? '#FF0015' : 144 + return d > parseInt(density_max*0.9) ? '#FF0015' :
142 - d > density_max*0.8 ? '#F20D20' : 145 + d > parseInt(density_max*0.8) ? '#F20D20' :
143 - d > density_max*0.7 ? '#E6192A' : 146 + d > parseInt(density_max*0.7) ? '#E6192A' :
144 - d > density_max*0.6 ? '#D92635' : 147 + d > parseInt(density_max*0.6) ? '#D92635' :
145 - d > density_max*0.5 ? '#CC3340' : 148 + d > parseInt(density_max*0.5) ? '#CC3340' :
146 - d > density_max*0.4 ? '#BF404A' : 149 + d > parseInt(density_max*0.4) ? '#BF404A' :
147 - d > density_max*0.3 ? '#B34D55' : 150 + d > parseInt(density_max*0.3) ? '#B34D55' :
148 - d > density_max*0.2 ? '#A65960' : 151 + d > parseInt(density_max*0.2) ? '#A65960' :
149 - d > density_max*0.1 ? '#99666A' : 152 + d > parseInt(density_max*0.1) ? '#99666A' :
150 '#8C7375'; 153 '#8C7375';
151 } 154 }
152 function style(feature) { 155 function style(feature) {
...@@ -190,7 +193,6 @@ ...@@ -190,7 +193,6 @@
190 click: zoomToFeature 193 click: zoomToFeature
191 }); 194 });
192 } 195 }
193 -
194 geojson = L.geoJson(statesdata, { 196 geojson = L.geoJson(statesdata, {
195 style: style, 197 style: style,
196 onEachFeature: onEachFeature 198 onEachFeature: onEachFeature
...@@ -222,7 +224,7 @@ ...@@ -222,7 +224,7 @@
222 legend.onAdd = function (map) { 224 legend.onAdd = function (map) {
223 225
224 var div = L.DomUtil.create('div', 'info legend'), 226 var div = L.DomUtil.create('div', 'info legend'),
225 - grades = [0, density_max*0.1, density_max*0.2, density_max*0.3, density_max*0.4,density_max*0.5, density_max*0.6, density_max*0.7, density_max*0.8,density_max*0.9], 227 + grades = [0, parseInt(density_max*0.1), parseInt(density_max*0.2), parseInt(density_max*0.3), parseInt(density_max*0.4),parseInt(density_max*0.5), parseInt(density_max*0.6), parseInt(density_max*0.7), parseInt(density_max*0.8),parseInt(density_max*0.9)],
226 labels = [], 228 labels = [],
227 from, to; 229 from, to;
228 230
......
...@@ -21,6 +21,7 @@ def returnfarm_dbselect(contenttype, maptype): ...@@ -21,6 +21,7 @@ def returnfarm_dbselect(contenttype, maptype):
21 myrtrn = RT_edu.objects.values(mapt).annotate(count=Count(mapt)) 21 myrtrn = RT_edu.objects.values(mapt).annotate(count=Count(mapt))
22 return myrtrn 22 return myrtrn
23 23
24 +
24 # 공공데이터 불러오는 부분 25 # 공공데이터 불러오는 부분
25 def publicdata(): 26 def publicdata():
26 # 통계청 귀농가구원의 시도별, 시군별, 연령별 27 # 통계청 귀농가구원의 시도별, 시군별, 연령별
...@@ -31,19 +32,25 @@ def publicdata(): ...@@ -31,19 +32,25 @@ def publicdata():
31 def main(request): 32 def main(request):
32 return render(request, 'main.html') 33 return render(request, 'main.html')
33 34
35 +
36 +# html에 넘겨주는 부분
37 +
38 +####### return farm ##########
34 def returnfarm(request): 39 def returnfarm(request):
35 try: 40 try:
36 maptype = request.GET['maptype'] 41 maptype = request.GET['maptype']
37 contenttype = request.GET['contenttype'] 42 contenttype = request.GET['contenttype']
38 mapp = Maps.objects.get(id=int(maptype)) 43 mapp = Maps.objects.get(id=int(maptype))
39 exportdatas = returnfarm_dbselect(contenttype, int(maptype)) 44 exportdatas = returnfarm_dbselect(contenttype, int(maptype))
45 + maxx = exportdatas.aggregate(maxx=Max('count'))
40 except: 46 except:
41 mapp = Maps.objects.get(id=9) 47 mapp = Maps.objects.get(id=9)
42 exportdatas = {} 48 exportdatas = {}
43 - context = {'exportdata': exportdatas, 'maps':mapp} 49 + maxx = {'maxx' : 100}
50 + context = {'exportdata': exportdatas, 'maps':mapp, 'max':maxx}
44 return render(request, 'returnfarm.html', context) 51 return render(request, 'returnfarm.html', context)
45 52
46 - 53 +######## population ###########
47 def population(request): 54 def population(request):
48 try: 55 try:
49 maptype = request.GET['maptype'] 56 maptype = request.GET['maptype']
...@@ -53,9 +60,9 @@ def population(request): ...@@ -53,9 +60,9 @@ def population(request):
53 except: 60 except:
54 mapp = Maps.objects.get(id=9) 61 mapp = Maps.objects.get(id=9)
55 exportdatas = {} 62 exportdatas = {}
56 - exportdatas = publicdata()
57 context = {'exportdata': exportdatas, 'maps':mapp} 63 context = {'exportdata': exportdatas, 'maps':mapp}
58 return render(request, 'population.html', context) 64 return render(request, 'population.html', context)
59 65
66 +########### market ##########
60 def market(request): 67 def market(request):
61 return render(request, 'market.html') 68 return render(request, 'market.html')
...\ No newline at end of file ...\ No newline at end of file
......