양선아

최종 update

1 +# Generated by Django 3.0.6 on 2020-06-10 21:23
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0009_auto_20200522_1514'),
10 + ]
11 +
12 + operations = [
13 + migrations.CreateModel(
14 + name='AuctionData',
15 + fields=[
16 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17 + ('aucng_de', models.IntegerField()),
18 + ('pblmng_whsal_mrkt_nm', models.CharField(max_length=16)),
19 + ('pblmng_whsal_mrkt_cd', models.IntegerField()),
20 + ('cpr_nm', models.CharField(max_length=16)),
21 + ('cpr_cd', models.IntegerField()),
22 + ('prdlst_nm', models.CharField(max_length=10)),
23 + ('prdlst_cd', models.IntegerField()),
24 + ('spcies_nm', models.CharField(max_length=10)),
25 + ('spcies_cd', models.IntegerField()),
26 + ('delngbundle_qy', models.FloatField()),
27 + ('stndrd', models.CharField(max_length=10)),
28 + ('stndrd_cd', models.IntegerField()),
29 + ('grad', models.CharField(max_length=8)),
30 + ('grad_cd', models.IntegerField()),
31 + ('sanji_cd', models.IntegerField()),
32 + ('sanji_nm', models.CharField(max_length=20)),
33 + ('mumm_amt', models.IntegerField()),
34 + ('avrg_amt', models.IntegerField()),
35 + ('mxmm_amt', models.IntegerField()),
36 + ('delng_qy', models.IntegerField()),
37 + ('cnts', models.IntegerField()),
38 + ],
39 + ),
40 + migrations.CreateModel(
41 + name='ProductData',
42 + fields=[
43 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44 + ('large_cd', models.IntegerField()),
45 + ('large_nm', models.CharField(max_length=10)),
46 + ('medium_cd', models.IntegerField()),
47 + ('medium_nm', models.CharField(max_length=10)),
48 + ('small_cd', models.IntegerField()),
49 + ('small_nm', models.CharField(max_length=15)),
50 + ],
51 + ),
52 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:33
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0010_auctiondata_productdata'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='small_nm',
16 + field=models.CharField(max_length=16),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:35
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0011_auto_20200611_0633'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='large_cd',
16 + field=models.CharField(max_length=5),
17 + ),
18 + migrations.AlterField(
19 + model_name='productdata',
20 + name='medium_cd',
21 + field=models.CharField(max_length=5),
22 + ),
23 + migrations.AlterField(
24 + model_name='productdata',
25 + name='small_cd',
26 + field=models.CharField(max_length=8),
27 + ),
28 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:35
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0012_auto_20200611_0635'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='large_cd',
16 + field=models.CharField(max_length=8),
17 + ),
18 + migrations.AlterField(
19 + model_name='productdata',
20 + name='medium_cd',
21 + field=models.CharField(max_length=8),
22 + ),
23 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:36
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0013_auto_20200611_0635'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='large_cd',
16 + field=models.CharField(max_length=10),
17 + ),
18 + migrations.AlterField(
19 + model_name='productdata',
20 + name='medium_cd',
21 + field=models.CharField(max_length=10),
22 + ),
23 + migrations.AlterField(
24 + model_name='productdata',
25 + name='small_cd',
26 + field=models.CharField(max_length=10),
27 + ),
28 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:36
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0014_auto_20200611_0636'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='medium_nm',
16 + field=models.CharField(max_length=16),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 21:37
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0015_auto_20200611_0636'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='productdata',
15 + name='small_nm',
16 + field=models.CharField(max_length=22),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:08
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0016_auto_20200611_0637'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='cpr_cd',
16 + field=models.CharField(max_length=16),
17 + ),
18 + migrations.AlterField(
19 + model_name='auctiondata',
20 + name='grad',
21 + field=models.CharField(max_length=16),
22 + ),
23 + migrations.AlterField(
24 + model_name='auctiondata',
25 + name='grad_cd',
26 + field=models.CharField(max_length=16),
27 + ),
28 + migrations.AlterField(
29 + model_name='auctiondata',
30 + name='pblmng_whsal_mrkt_cd',
31 + field=models.CharField(max_length=16),
32 + ),
33 + migrations.AlterField(
34 + model_name='auctiondata',
35 + name='prdlst_cd',
36 + field=models.CharField(max_length=16),
37 + ),
38 + migrations.AlterField(
39 + model_name='auctiondata',
40 + name='sanji_cd',
41 + field=models.CharField(max_length=16),
42 + ),
43 + migrations.AlterField(
44 + model_name='auctiondata',
45 + name='spcies_cd',
46 + field=models.CharField(max_length=16),
47 + ),
48 + migrations.AlterField(
49 + model_name='auctiondata',
50 + name='stndrd_cd',
51 + field=models.CharField(max_length=16),
52 + ),
53 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:18
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0017_auto_20200611_0808'),
10 + ]
11 +
12 + operations = [
13 + migrations.AddField(
14 + model_name='auctiondata',
15 + name='raw_num',
16 + field=models.IntegerField(default=1),
17 + preserve_default=False,
18 + ),
19 + migrations.AlterField(
20 + model_name='auctiondata',
21 + name='spcies_nm',
22 + field=models.CharField(max_length=16),
23 + ),
24 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:27
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0018_auto_20200611_0818'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='sanji_cd',
16 + field=models.CharField(max_length=16, null=True),
17 + ),
18 + migrations.AlterField(
19 + model_name='auctiondata',
20 + name='sanji_nm',
21 + field=models.CharField(max_length=20, null=True),
22 + ),
23 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:27
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0019_auto_20200611_0827'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='stndrd',
16 + field=models.CharField(max_length=16),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:28
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0020_auto_20200611_0827'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='prdlst_nm',
16 + field=models.CharField(max_length=16),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:28
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0021_auto_20200611_0828'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='stndrd',
16 + field=models.CharField(max_length=17),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-06-10 23:29
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0022_auto_20200611_0828'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='auctiondata',
15 + name='stndrd',
16 + field=models.CharField(max_length=20),
17 + ),
18 + ]
...@@ -24,4 +24,40 @@ class RT_agri_policy(models.Model): ...@@ -24,4 +24,40 @@ class RT_agri_policy(models.Model):
24 plcy_condition_detail = models.TextField(null=True) 24 plcy_condition_detail = models.TextField(null=True)
25 plcy_document = models.TextField(null=True) 25 plcy_document = models.TextField(null=True)
26 plcy_amount = models.TextField(null=True) 26 plcy_amount = models.TextField(null=True)
27 - plcy_contact = models.TextField(null=True)
...\ No newline at end of file ...\ No newline at end of file
27 + plcy_contact = models.TextField(null=True)
28 +
29 +class AuctionData(models.Model):
30 + raw_num = models.IntegerField()
31 + aucng_de = models.IntegerField()
32 + pblmng_whsal_mrkt_nm = models.CharField(max_length=16)
33 + pblmng_whsal_mrkt_cd = models.CharField(max_length=16)
34 + cpr_nm = models.CharField(max_length=16)
35 + cpr_cd = models.CharField(max_length=16)
36 + prdlst_nm = models.CharField(max_length=16)
37 + prdlst_cd = models.CharField(max_length=16)
38 + spcies_nm = models.CharField(max_length=16)
39 + spcies_cd = models.CharField(max_length=16)
40 + delngbundle_qy = models.FloatField()
41 + stndrd = models.CharField(max_length=20)
42 + stndrd_cd = models.CharField(max_length=16)
43 + grad = models.CharField(max_length=16)
44 + grad_cd = models.CharField(max_length=16)
45 + sanji_cd = models.CharField(max_length=16, null=True)
46 + sanji_nm = models.CharField(max_length=20, null=True)
47 + mumm_amt = models.IntegerField()
48 + avrg_amt = models.IntegerField()
49 + mxmm_amt = models.IntegerField()
50 + delng_qy = models.IntegerField()
51 + cnts = models.IntegerField()
52 +
53 +class ProductData(models.Model):
54 + large_cd = models.CharField(max_length=10)
55 + large_nm = models.CharField(max_length=10)
56 + medium_cd = models.CharField(max_length=10)
57 + medium_nm = models.CharField(max_length=16)
58 + small_cd = models.CharField(max_length=10)
59 + small_nm = models.CharField(max_length=22)
60 +
61 +class JointMarketData(models.Model):
62 + raw_num = models.IntegerField()
63 + aucng_de = models.IntegerField()
...\ No newline at end of file ...\ No newline at end of file
......
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="kr"> 2 <html lang="kr">
3 <head> 3 <head>
4 - <title>RF-Project</title> 4 + <title>귀농통계서비스</title>
5 <meta charset="utf-8"> 5 <meta charset="utf-8">
6 <!--BOOTSTRAP 사용 부분--> 6 <!--BOOTSTRAP 사용 부분-->
7 <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">
...@@ -10,19 +10,58 @@ ...@@ -10,19 +10,58 @@
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 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
11 <div id="header"> 11 <div id="header">
12 <style> 12 <style>
13 - #header{ 13 + #bodyWrap{
14 - color: brown;
15 text-align: center; 14 text-align: center;
16 - background: #fff7b5; 15 + background: #fffce2;
17 - font-family: "210 자연주의";
18 } 16 }
19 - h1{ 17 + a.projectname{
20 - font-weight: bold; 18 + font-family: "THE또박또박";
19 + color: black;
20 + text-decoration:none;
21 + }
22 + a.projectname:hover{
23 + color: orange;
24 + text-decoration:none;
21 } 25 }
22 h3{ 26 h3{
23 font-family: "Dovemayo"; 27 font-family: "Dovemayo";
28 + font-size: 150%;
29 + }
30 + a.nav-link{
31 + font-size: 175%;
32 + font-family: "THE또박또박";
33 + color: rgb(0, 0, 0);
34 + }
35 + a.nav-link:hover{
36 + color: orange;
37 + }
38 + #contentWrap{
39 + text-align:center;
40 + line-height: 220%;
41 + padding: 100px;
42 + }
43 + a.datalink{
44 + color: orange;
45 + }
46 + a.datalink:hover{
47 + color: orangered;
48 + }
49 + p.dataexplain{
50 + font-family: "Dovemayo";
51 + font-size: 150%;
52 + }
53 + table.CategoryTable{
54 + font-family: "Dovemayo";
55 + font-size: 150%;
56 + margin:0 auto;
57 + }
58 + th,td{
59 + padding: 15px;
60 + }
61 + th.orangetext{
62 + color: orangered;
24 } 63 }
25 - </style> 64 + </style>
26 </div> 65 </div>
27 </head> 66 </head>
28 67
...@@ -30,15 +69,15 @@ ...@@ -30,15 +69,15 @@
30 <!--body--> 69 <!--body-->
31 <div id="bodyWrap"> 70 <div id="bodyWrap">
32 <div id="header"> 71 <div id="header">
33 - <h1 class="projectname"><a href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1> 72 + <h1 class="projectname"><a class="projectname" href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1>
34 <br> 73 <br>
35 - <h3>농산물 시장 유통에 대한 통계분석 입니다.</h3> 74 + <h3>- 귀농 데이터 통계분석 서비스 -</h3>
36 <br> 75 <br>
37 </div> 76 </div>
38 <div id="menubar"> 77 <div id="menubar">
39 <ul class="nav justify-content-center"> 78 <ul class="nav justify-content-center">
40 <li class="nav-item"> 79 <li class="nav-item">
41 - <a class="nav-link active" href="/market_analysis/market">Market</a> 80 + <a class="nav-link" href="/market_analysis/market">Market</a>
42 </li> 81 </li>
43 <li class="nav-item"> 82 <li class="nav-item">
44 <a class="nav-link" href="/market_analysis/population">Population</a> 83 <a class="nav-link" href="/market_analysis/population">Population</a>
...@@ -51,9 +90,27 @@ ...@@ -51,9 +90,27 @@
51 </div> 90 </div>
52 <!--content--> 91 <!--content-->
53 <div id="contentWrap"> 92 <div id="contentWrap">
54 - <h6> 93 + <p class="dataexplain">
55 - explain 들어가는 부분 94 + 이 서비스는 귀농 데이터 분석을 위한 웹 베이스 서비스입니다.<br>
56 - </h6> 95 + 본 데이터들은 대부분 국가 공공데이터들을 이용하여 분석한 내용입니다.<br>
96 + 대부분의 주요 데이터들은 <a class="datalink" href="https://www.data.go.kr/">여기서</a> 확인하실 수 있습니다.<br>
97 + 일부 통계청 데이터들은 <a class="datalink" href="https://kosis.kr/openapi/index/index.jsp">KOSIS 공유서비스</a>를 사용하였습니다.
98 + <br><br>
99 + <table class="CategoryTable">
100 + <tr>
101 + <th class="orangetext">Market</th>
102 + <td>농수산물 시장 데이터 분석</td>
103 + </tr>
104 + <tr>
105 + <th class="orangetext">Population</th>
106 + <td>통계청 데이터 기반 인구수 분석</td>
107 + </tr>
108 + <tr>
109 + <th class="orangetext">Return Farm</th>
110 + <td>귀농 관련 데이터 분석</td>
111 + </tr>
112 + </table>
113 + </p>
57 </div> 114 </div>
58 </body> 115 </body>
59 </html> 116 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 -<h1>market</h1>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="kr">
3 + <head>
4 + <title>RF-Project</title>
5 + <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 -->
6 + <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 -->
7 + <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. -->
8 + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
9 + <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
10 +
11 + <!--BOOTSTRAP 사용 부분-->
12 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
13 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
14 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
15 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
16 + <style>
17 + #mapbase
18 + {
19 + position:relative;
20 + width:80%;
21 + padding-bottom:80%;
22 + margin-left: 3%;
23 + margin-bottom: 50px;
24 + }
25 + h1 {
26 + font-size: 20px;
27 + }
28 + .form-group{
29 + margin-left: 3%;
30 + margin-top: 2%;
31 + }
32 + .info {
33 + padding: 6px 8px;
34 + font: 14px/16px Arial, Helvetica, sans-serif;
35 + background: white;
36 + background: rgba(255,255,255,0.8);
37 + box-shadow: 0 0 15px rgba(0,0,0,0.2);
38 + border-radius: 5px;
39 + }
40 + .info h4 {
41 + margin: 0 0 5px;
42 + color: #777;
43 + }
44 + .legend {
45 + line-height: 18px;
46 + color: #555;
47 + }
48 + .legend i {
49 + width: 18px;
50 + height: 18px;
51 + float: left;
52 + margin-right: 8px;
53 + opacity: 0.7;
54 + }
55 + #bodyWrap{
56 + text-align: center;
57 + background: #fffce2;
58 + }
59 + a.projectname{
60 + font-family: "THE또박또박";
61 + color: black;
62 + text-decoration:none;
63 + }
64 + a.projectname:hover{
65 + color: orange;
66 + text-decoration:none;
67 + }
68 + h3{
69 + font-family: "Dovemayo";
70 + font-size: 150%;
71 + }
72 + a.nav-link{
73 + font-size: 175%;
74 + font-family: "THE또박또박";
75 + color: black;
76 + }
77 + a.nav-link:hover{
78 + color: orange;
79 + }
80 + p{
81 + font-family: "Dovemayo";
82 + font-size: medium;
83 + }
84 + .data_explain{
85 + display: inline;
86 + }
87 + </style>
88 + </head>
89 +
90 + <body>
91 + <!--body-->
92 + <div id="bodyWrap">
93 + <div id="header">
94 + <h1 class="projectname"><a class="projectname" href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1>
95 + <br>
96 + <h3>- 귀농 데이터 통계분석 서비스 -</h3>
97 + <br>
98 + </div>
99 + <div id="menubar">
100 + <ul class="nav justify-content-center">
101 + <li class="nav-item">
102 + <a class="nav-link" href="/market_analysis/market">Market</a>
103 + </li>
104 + <li class="nav-item">
105 + <a class="nav-link" href="/market_analysis/population">Population</a>
106 + </li>
107 + <li class="nav-item">
108 + <a class="nav-link" href="/market_analysis/returnfarm">Return Farm</a>
109 + </li>
110 + </ul>
111 + </div>
112 + </div>
113 + <div id="contentWrap">
114 + <!--검색 바 만든 부분-->
115 + <div id="searchmenu">
116 + <form action="{% url 'market' %}" method="GET">
117 + <div class="form-group">
118 + <select name="maptype">
119 + <option value="9">시도</option>
120 + <option value="10">시군구</option>
121 + </select>
122 + <select name="densitytype">
123 + <option value="auctiondata">도매시장 거래 데이터</option>
124 + <option value="jointmarketdata">농협 산지공판장 데이터</option>
125 + </select>
126 + <select name="ctgr_large">
127 + <option value="all">전체</option>
128 + {% for lrg in largedata%}
129 + <option value="{{lrg.large_cd}}">{{lrg.large_nm}}</option>
130 + {%endfor%}
131 + </select>
132 + <select name="ctgr_medium">
133 + <option value="all">전체</option>
134 + {% for mdu in mediumdata%}
135 + <option value="{{mdu.medium_cd}}">{{mdu.medium_nm}}</option>
136 + {%endfor%}
137 + </select>
138 + <input type="submit">
139 + </div>
140 + </form>
141 + </div>
142 + <!--지도 생성 부분-->
143 + <div id="mapbase">
144 + <script type="text/javascript">
145 + // map 객체 생성 map안에 넣어주는건 div id
146 + // 위도, 경도, zoom 수준
147 + var map = L.map('mapbase', {zoomDelta: 0.25, zoomSnap: 0}).setView([36.5205243,128.0540569], 7);
148 + // tilelayer를 씌우는 작업 OSM을 사용했음
149 + L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
150 + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
151 + maxZoom: 10,
152 + id: 'mapbox/light-v9',
153 + tileSize: 512,
154 + zoomOffset:-1,
155 + accessToken: 'pk.eyJ1IjoidGpzZGszMTA1IiwiYSI6ImNrYWM5bXljZzB1N28ycnA5bTVsNHZsbnkifQ.W3-irWof5WMR8BcfBR4Ftw'
156 + }).addTo(map);
157 +
158 + // mapdata 가져오는 부분
159 + // replace 쓰는 방법 : (바꾸기 전 문자, 바꾸고 난 후 문자)
160 + var statesdata = "{{maps.mapdata}}".replace(/&quot;/g,"\"");
161 + statesdata = JSON.parse(statesdata);
162 + let key = Object.keys(statesdata.features[1].properties);
163 + var density_max = "{{max}}".replace(/&#x27;/g,"\"");
164 + density_max = JSON.parse(density_max);
165 + density_max = Number(density_max.maxx)*0.3;
166 +
167 + </script>
168 + </div>
169 + <!--지도에 밀도 데이터 받는 부분-->
170 + <div id="density_mapping">
171 + <script>
172 + // density data 추가하는 부분
173 + for(var j=0; j<statesdata.features.length; j++)
174 + {
175 + statesdata.features[j]['properties']['density'] = 0;
176 + }
177 + </script>
178 + {% for data in exportdata %}
179 + <script>
180 + // density data 추가하는 부분
181 + for(var j=0; j<statesdata.features.length; j++)
182 + {
183 + var reg = new RegExp(statesdata.features[j]['properties'][key[2]].substring(0,2));
184 + var result = reg.exec("{{data.sanji_nm}}");
185 + if (result == null)
186 + {
187 + reg = new RegExp(statesdata.features[j]['properties'][key[2]].substring(0,1)+statesdata.features[j]['properties'][key[2]].substring(2,3));
188 + result = reg.exec("{{data.sanji_nm}}");
189 + }
190 +
191 + if ("{{maps.id}}"==9){
192 + if (result != null)
193 + {
194 + statesdata.features[j]['properties']['density']+=Number("{{data.count}}");
195 + break;
196 + }
197 + }
198 + else
199 + {
200 + if (result != null)
201 + {
202 + statesdata.features[j]['properties']['density']+=Number("{{data.count}}");
203 + break;
204 + }
205 + }
206 + }
207 + </script>
208 + {% endfor %}
209 + </div>
210 + <!--지도의 큰 모양 바꾸는 부분-->
211 + <div id="map_design">
212 + <script>
213 + var geojson;
214 + function getColor(d) {
215 + return d > parseInt(density_max*0.9) ? '#7e5109' :
216 + d > parseInt(density_max*0.8) ? '#9c640c' :
217 + d > parseInt(density_max*0.7) ? '#b9770e' :
218 + d > parseInt(density_max*0.6) ? '#d68910' :
219 + d > parseInt(density_max*0.5) ? '#f39c12' :
220 + d > parseInt(density_max*0.4) ? '#f5b041' :
221 + d > parseInt(density_max*0.3) ? '#f8c471' :
222 + d > parseInt(density_max*0.2) ? '#fad7a0' :
223 + d > parseInt(density_max*0.1) ? '#fdebd0' :
224 + '#fef5e7';
225 + }
226 + function style(feature) {
227 + return {
228 + fillColor: getColor(feature.properties.density),
229 + weight: 2,
230 + opacity: 1,
231 + color: 'white',
232 + dashArray: '3',
233 + fillOpacity: 0.7
234 + };
235 + }
236 + L.geoJson(statesdata, {style: style}).addTo(map);
237 + // mouseover event listener
238 + function highlightFeature(e) {
239 + var layer = e.target;
240 + layer.setStyle({
241 + weight: 5,
242 + color: '#666',
243 + dashArray: '',
244 + fillOpacity: 0.7
245 + });
246 +
247 + if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
248 + layer.bringToFront();
249 + }
250 + info.update(layer.feature.properties);
251 + }
252 + // mouseout define
253 + function resetHighlight(e) {
254 + geojson.resetStyle(e.target);
255 + info.update();
256 + }
257 + function zoomToFeature(e) {
258 + map.fitBounds(e.target.getBounds());
259 + }
260 + function onEachFeature(feature, layer) {
261 + layer.on({
262 + mouseover: highlightFeature,
263 + mouseout: resetHighlight,
264 + click: zoomToFeature
265 + });
266 + }
267 +
268 + geojson = L.geoJson(statesdata, {
269 + style: style,
270 + onEachFeature: onEachFeature
271 + }).addTo(map);
272 + </script>
273 + </div>
274 + <!--information, legend, zoom 넣는 부분-->
275 + <div class="map_info">
276 + <script>
277 + var info = L.control();
278 +
279 + info.onAdd = function (map) {
280 + this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
281 + this.update();
282 + return this._div;
283 + };
284 +
285 + // method that we will use to update the control based on feature properties passed
286 + info.update = function (props) {
287 + this._div.innerHTML = '<h4>Korea Return Farm Density</h4>' + (props ?
288 + '<b>' + props[key[2]] + '</b> ' + props.density + ' 건'
289 + : 'Hover over a state');
290 + };
291 +
292 + info.addTo(map);
293 +
294 + var legend = L.control({position: 'bottomright'});
295 +
296 + legend.onAdd = function (map) {
297 +
298 + var div = L.DomUtil.create('div', 'info legend'),
299 + 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)],
300 + labels = [],
301 + from, to;
302 +
303 + // loop through our density intervals and generate a label with a colored square for each interval
304 + for (var i = 0; i < grades.length; i++) {
305 + from = grades[i];
306 + to = grades[i+1];
307 + labels.push(
308 + '<i style="background: '+ getColor(from + 1) + '"></i> ' + from + (to ? '&ndash;' + to :'+'));
309 + }
310 + div.innerHTML = labels.join('<br>');
311 + return div;
312 + };
313 + legend.addTo(map);
314 + </script>
315 + </div>
316 + </div>
317 + </body>
318 +</html>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,12 +7,21 @@ ...@@ -7,12 +7,21 @@
7 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. --> 7 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. -->
8 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" /> 8 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
9 <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script> 9 <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
10 - <!--css 내용 여기에 direct로 넣었다--> 10 +
11 + <!--BOOTSTRAP 사용 부분-->
12 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
13 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
14 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
15 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
11 <style> 16 <style>
12 - #mapbase {position:relative; width:40%; height:0; padding-bottom:40%; } 17 + #mapbase {position:relative; width:80%; height:0; padding-bottom:80%; margin-left: 3%;}
13 h1 { 18 h1 {
14 font-size: 20px; 19 font-size: 20px;
15 } 20 }
21 + .form-group{
22 + margin-left: 3%;
23 + margin-top: 2%;
24 + }
16 .info { 25 .info {
17 padding: 6px 8px; 26 padding: 6px 8px;
18 font: 14px/16px Arial, Helvetica, sans-serif; 27 font: 14px/16px Arial, Helvetica, sans-serif;
...@@ -36,52 +45,74 @@ ...@@ -36,52 +45,74 @@
36 margin-right: 8px; 45 margin-right: 8px;
37 opacity: 0.7; 46 opacity: 0.7;
38 } 47 }
39 - 48 + #bodyWrap{
40 - </style> 49 + text-align: center;
41 - 50 + background: #fffce2;
42 - <!--BOOTSTRAP 사용 부분--> 51 + }
43 - <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> 52 + a.projectname{
44 - <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> 53 + font-family: "THE또박또박";
45 - <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> 54 + color: black;
46 - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> 55 + text-decoration:none;
47 - 56 + }
57 + a.projectname:hover{
58 + color: orange;
59 + text-decoration:none;
60 + }
61 + h3{
62 + font-family: "Dovemayo";
63 + font-size: 150%;
64 + }
65 + a.nav-link{
66 + font-size: 175%;
67 + font-family: "THE또박또박";
68 + color: black;
69 + }
70 + a.nav-link:hover{
71 + color: orange;
72 + }
73 + p{
74 + font-family: "Dovemayo";
75 + font-size: medium;
76 + }
77 + </style>
48 </head> 78 </head>
49 - 79 +
50 - <body> 80 + <body>
81 + <!--body-->
51 <div id="bodyWrap"> 82 <div id="bodyWrap">
52 - <div id="header"> 83 + <div id="header">
53 - <h1><a href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1> 84 + <h1 class="projectname"><a class="projectname" href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1>
54 - <br> 85 + <br>
55 - <h3>농산물 시장 유통에 대한 통계분석 입니다.</h3> 86 + <h3>- 귀농 데이터 통계분석 서비스 -</h3>
56 - <br> 87 + <br>
57 - </div> 88 + </div>
58 - <div id="menubar"> 89 + <div id="menubar">
59 - <ul class="nav justify-content-center"> 90 + <ul class="nav justify-content-center">
60 - <li class="nav-item"> 91 + <li class="nav-item">
61 - <a class="nav-link active" href="/market_analysis/market">Market</a> 92 + <a class="nav-link" href="/market_analysis/market">Market</a>
62 - </li> 93 + </li>
63 - <li class="nav-item"> 94 + <li class="nav-item">
64 - <a class="nav-link" href="/market_analysis/population">Population</a> 95 + <a class="nav-link" href="/market_analysis/population">Population</a>
65 - </li> 96 + </li>
66 - <li class="nav-item"> 97 + <li class="nav-item">
67 - <a class="nav-link" href="/market_analysis/returnfarm">Return Farm</a> 98 + <a class="nav-link" href="/market_analysis/returnfarm">Return Farm</a>
68 - </li> 99 + </li>
69 - </ul> 100 + </ul>
70 - </div> 101 + </div>
71 </div> 102 </div>
72 <!--population 단독 부분--> 103 <!--population 단독 부분-->
73 - <!--return farm 단독 부분-->
74 <div id="contentWrap"> 104 <div id="contentWrap">
75 <!--검색 바 만든 부분--> 105 <!--검색 바 만든 부분-->
76 <div id="searchmenu"> 106 <div id="searchmenu">
77 <form action="{% url 'population' %}" method="GET"> 107 <form action="{% url 'population' %}" method="GET">
78 <div class="form-group"> 108 <div class="form-group">
79 <select name="maptype"> 109 <select name="maptype">
80 - <option value="9">시도</option> 110 + <option value="9">시도</option>
81 - <option value="10">시군구</option> 111 + <option value="10">시군구</option>
82 </select> 112 </select>
83 <select name="densitytype"> 113 <select name="densitytype">
84 - <option value="edu">귀농가구원 연령별</option> 114 + <option value="returnfarm_agri_population">지역별 귀농가구원수</option>
115 + <option value="population">지역별 총 인구수</option>
85 </select> 116 </select>
86 <input type="submit"> 117 <input type="submit">
87 </div> 118 </div>
...@@ -115,6 +146,7 @@ ...@@ -115,6 +146,7 @@
115 <script> 146 <script>
116 var densitydatas = "{{exportdata}}".replace(/&quot;/g,"\""); 147 var densitydatas = "{{exportdata}}".replace(/&quot;/g,"\"");
117 densitydatas = JSON.parse(densitydatas); 148 densitydatas = JSON.parse(densitydatas);
149 + //alert(key);
118 for(var i=0; i < densitydatas.length; i++) 150 for(var i=0; i < densitydatas.length; i++)
119 { 151 {
120 for(var j=0; j<statesdata.features.length; j++) 152 for(var j=0; j<statesdata.features.length; j++)
...@@ -124,6 +156,11 @@ ...@@ -124,6 +156,11 @@
124 statesdata.features[j]['properties']['density']=densitydatas[i]['DT']; 156 statesdata.features[j]['properties']['density']=densitydatas[i]['DT'];
125 break; 157 break;
126 } 158 }
159 + else if(statesdata.features[j]['properties'][key[2]]==densitydatas[i]['C1_NM'] && densitydatas[i]['ITM_NM']=='총인구')
160 + {
161 + statesdata.features[j]['properties']['density']=densitydatas[i]['DT'];
162 + break;
163 + }
127 } 164 }
128 } 165 }
129 </script> 166 </script>
...@@ -132,17 +169,26 @@ ...@@ -132,17 +169,26 @@
132 <div id="map_design"> 169 <div id="map_design">
133 <script> 170 <script>
134 var geojson; 171 var geojson;
172 + var density_max = 500000;
173 + if (key[2]=='CTP_KOR_NM' && densitydatas[3]['ITM_NM']=='총인구')
174 + { density_max = 8000000;}
175 + else if(key[2]=='CTP_KOR_NM' && densitydatas[3]['ITM_NM']=='귀농가구원수')
176 + { density_max = 300;}
177 + else if(key[2]=='SIG_KOR_NM' && densitydatas[3]['ITM_NM']=='총인구')
178 + { density_max = 500000;}
179 + else if(key[2]=='SIG_KOR_NM' && densitydatas[3]['ITM_NM']=='귀농가구원수')
180 + { density_max = 100;}
135 function getColor(d) { 181 function getColor(d) {
136 - return d > parseInt(density_max*0.9) ? '#FF0015' : 182 + return d > parseInt(density_max*0.9) ? '#7e5109' :
137 - d > parseInt(density_max*0.8) ? '#F20D20' : 183 + d > parseInt(density_max*0.8) ? '#9c640c' :
138 - d > parseInt(density_max*0.7) ? '#E6192A' : 184 + d > parseInt(density_max*0.7) ? '#b9770e' :
139 - d > parseInt(density_max*0.6) ? '#D92635' : 185 + d > parseInt(density_max*0.6) ? '#d68910' :
140 - d > parseInt(density_max*0.5) ? '#CC3340' : 186 + d > parseInt(density_max*0.5) ? '#f39c12' :
141 - d > parseInt(density_max*0.4) ? '#BF404A' : 187 + d > parseInt(density_max*0.4) ? '#f5b041' :
142 - d > parseInt(density_max*0.3) ? '#B34D55' : 188 + d > parseInt(density_max*0.3) ? '#f8c471' :
143 - d > parseInt(density_max*0.2) ? '#A65960' : 189 + d > parseInt(density_max*0.2) ? '#fad7a0' :
144 - d > parseInt(density_max*0.1) ? '#99666A' : 190 + d > parseInt(density_max*0.1) ? '#fdebd0' :
145 - '#8C7375'; 191 + '#fef5e7';
146 } 192 }
147 function style(feature) { 193 function style(feature) {
148 return { 194 return {
...@@ -206,7 +252,7 @@ ...@@ -206,7 +252,7 @@
206 // method that we will use to update the control based on feature properties passed 252 // method that we will use to update the control based on feature properties passed
207 info.update = function (props) { 253 info.update = function (props) {
208 this._div.innerHTML = '<h4>Korea Return Farm Density</h4>' + (props ? 254 this._div.innerHTML = '<h4>Korea Return Farm Density</h4>' + (props ?
209 - '<b>' + props[key[2]] + '</b><br />' + props.density + ' 개의 교육 예정' 255 + '<b>' + props[key[2]] + '</b> ' + props.density + ' 명'
210 : 'Hover over a state'); 256 : 'Hover over a state');
211 }; 257 };
212 258
......
...@@ -2,15 +2,26 @@ ...@@ -2,15 +2,26 @@
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">
6 <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 --> 5 <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 -->
7 <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 --> 6 <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 -->
8 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. --> 7 <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. -->
9 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" /> 8 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
10 <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script> 9 <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
11 - <!--css 내용 여기에 direct로 넣었다--> 10 +
11 + <!--BOOTSTRAP 사용 부분-->
12 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
13 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
14 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
15 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
12 <style> 16 <style>
13 - #mapbase {position:relative; width:40%; height:0; padding-bottom:40%; } 17 + #mapbase {position:relative; width:80%; height:0; padding-bottom:80%; margin-left: 3%;}
18 + h1 {
19 + font-size: 20px;
20 + }
21 + .form-group{
22 + margin-left: 3%;
23 + margin-top: 2%;
24 + }
14 .info { 25 .info {
15 padding: 6px 8px; 26 padding: 6px 8px;
16 font: 14px/16px Arial, Helvetica, sans-serif; 27 font: 14px/16px Arial, Helvetica, sans-serif;
...@@ -34,37 +45,60 @@ ...@@ -34,37 +45,60 @@
34 margin-right: 8px; 45 margin-right: 8px;
35 opacity: 0.7; 46 opacity: 0.7;
36 } 47 }
37 - </style> 48 + #bodyWrap{
38 - 49 + text-align: center;
39 - <!--BOOTSTRAP 사용 부분--> 50 + background: #fffce2;
40 - <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> 51 + }
41 - <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> 52 + a.projectname{
42 - <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> 53 + font-family: "THE또박또박";
43 - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> 54 + color: black;
44 - 55 + text-decoration:none;
56 + }
57 + a.projectname:hover{
58 + color: orange;
59 + text-decoration:none;
60 + }
61 + h3{
62 + font-family: "Dovemayo";
63 + font-size: 150%;
64 + }
65 + a.nav-link{
66 + font-size: 175%;
67 + font-family: "THE또박또박";
68 + color: black;
69 + }
70 + a.nav-link:hover{
71 + color: orange;
72 + }
73 + p{
74 + font-family: "Dovemayo";
75 + font-size: medium;
76 + }
77 + </style>
45 </head> 78 </head>
46 - 79 +
47 <body> 80 <body>
81 + <!--body-->
48 <div id="bodyWrap"> 82 <div id="bodyWrap">
49 - <div id="header"> 83 + <div id="header">
50 - <h1><a href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1> 84 + <h1 class="projectname"><a class="projectname" href="/market_analysis/maplist">Statistics on Return Farm Project</a></h1>
51 - <br> 85 + <br>
52 - <h3>농산물 시장 유통에 대한 통계분석 입니다.</h3> 86 + <h3>- 귀농 데이터 통계분석 서비스 -</h3>
53 - <br> 87 + <br>
54 - </div> 88 + </div>
55 - <div id="menubar"> 89 + <div id="menubar">
56 - <ul class="nav justify-content-center"> 90 + <ul class="nav justify-content-center">
57 - <li class="nav-item"> 91 + <li class="nav-item">
58 - <a class="nav-link active" href="/market_analysis/market">Market</a> 92 + <a class="nav-link" href="/market_analysis/market">Market</a>
59 - </li> 93 + </li>
60 - <li class="nav-item"> 94 + <li class="nav-item">
61 - <a class="nav-link" href="/market_analysis/population">Population</a> 95 + <a class="nav-link" href="/market_analysis/population">Population</a>
62 - </li> 96 + </li>
63 - <li class="nav-item"> 97 + <li class="nav-item">
64 - <a class="nav-link" href="/market_analysis/returnfarm">Return Farm</a> 98 + <a class="nav-link" href="/market_analysis/returnfarm">Return Farm</a>
65 - </li> 99 + </li>
66 - </ul> 100 + </ul>
67 - </div> 101 + </div>
68 </div> 102 </div>
69 <!--return farm 단독 부분--> 103 <!--return farm 단독 부분-->
70 <div id="contentWrap"> 104 <div id="contentWrap">
...@@ -89,7 +123,7 @@ ...@@ -89,7 +123,7 @@
89 <script type="text/javascript"> 123 <script type="text/javascript">
90 // map 객체 생성 map안에 넣어주는건 div id 124 // map 객체 생성 map안에 넣어주는건 div id
91 // 위도, 경도, zoom 수준 125 // 위도, 경도, zoom 수준
92 - var map = L.map('mapbase', {zoomDelta: 0.25, zoomSnap: 0}).setView([36.5205243,128.0540569], 7); 126 + var map = L.map('mapbase', {zoomDelta: 0.25, zoomSnap: 0}).setView([36.5205243,128.0540569], 6);
93 // tilelayer를 씌우는 작업 OSM을 사용했음 127 // tilelayer를 씌우는 작업 OSM을 사용했음
94 L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { 128 L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
95 attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 129 attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
...@@ -141,16 +175,16 @@ ...@@ -141,16 +175,16 @@
141 <script> 175 <script>
142 var geojson; 176 var geojson;
143 function getColor(d) { 177 function getColor(d) {
144 - return d > parseInt(density_max*0.9) ? '#FF0015' : 178 + return d > parseInt(density_max*0.9) ? '#7e5109' :
145 - d > parseInt(density_max*0.8) ? '#F20D20' : 179 + d > parseInt(density_max*0.8) ? '#9c640c' :
146 - d > parseInt(density_max*0.7) ? '#E6192A' : 180 + d > parseInt(density_max*0.7) ? '#b9770e' :
147 - d > parseInt(density_max*0.6) ? '#D92635' : 181 + d > parseInt(density_max*0.6) ? '#d68910' :
148 - d > parseInt(density_max*0.5) ? '#CC3340' : 182 + d > parseInt(density_max*0.5) ? '#f39c12' :
149 - d > parseInt(density_max*0.4) ? '#BF404A' : 183 + d > parseInt(density_max*0.4) ? '#f5b041' :
150 - d > parseInt(density_max*0.3) ? '#B34D55' : 184 + d > parseInt(density_max*0.3) ? '#f8c471' :
151 - d > parseInt(density_max*0.2) ? '#A65960' : 185 + d > parseInt(density_max*0.2) ? '#fad7a0' :
152 - d > parseInt(density_max*0.1) ? '#99666A' : 186 + d > parseInt(density_max*0.1) ? '#fdebd0' :
153 - '#8C7375'; 187 + '#fef5e7';
154 } 188 }
155 function style(feature) { 189 function style(feature) {
156 return { 190 return {
...@@ -213,7 +247,7 @@ ...@@ -213,7 +247,7 @@
213 // method that we will use to update the control based on feature properties passed 247 // method that we will use to update the control based on feature properties passed
214 info.update = function (props) { 248 info.update = function (props) {
215 this._div.innerHTML = '<h4>Korea Return Farm Density</h4>' + (props ? 249 this._div.innerHTML = '<h4>Korea Return Farm Density</h4>' + (props ?
216 - '<b>' + props[key[2]] + '</b><br />' + props.density + ' 개의 교육 예정' 250 + '<b>' + props[key[2]] + '</b> ' + props.density + ' 개'
217 : 'Hover over a state'); 251 : 'Hover over a state');
218 }; 252 };
219 253
......
...@@ -5,6 +5,6 @@ from . import views ...@@ -5,6 +5,6 @@ from . import views
5 urlpatterns = [ 5 urlpatterns = [
6 url('returnfarm', views.returnfarm, name="returnfarm"), 6 url('returnfarm', views.returnfarm, name="returnfarm"),
7 url('population', views.population, name="population"), 7 url('population', views.population, name="population"),
8 - url('market', views.market), 8 + url('market', views.market, name="market"),
9 url('', views.main), 9 url('', views.main),
10 ] 10 ]
...\ No newline at end of file ...\ No newline at end of file
......
1 #-*- coding:utf-8 1 #-*- coding:utf-8
2 2
3 from django.shortcuts import render 3 from django.shortcuts import render
4 -from django.db.models import Count, Max 4 +from django.db.models import Count, Max, Sum, Avg
5 from urllib.request import urlopen 5 from urllib.request import urlopen
6 -from .models import RT_edu, Maps, RT_agri_policy 6 +from .models import RT_edu, Maps, RT_agri_policy, ProductData, AuctionData
7 from bs4 import BeautifulSoup 7 from bs4 import BeautifulSoup
8 import pandas as pd 8 import pandas as pd
9 9
...@@ -23,9 +23,12 @@ def returnfarm_dbselect(contenttype, maptype): ...@@ -23,9 +23,12 @@ def returnfarm_dbselect(contenttype, maptype):
23 23
24 24
25 # 공공데이터 불러오는 부분 25 # 공공데이터 불러오는 부분
26 -def publicdata(): 26 +def publicdata(densitytype):
27 # 통계청 귀농가구원의 시도별, 시군별, 연령별 27 # 통계청 귀농가구원의 시도별, 시군별, 연령별
28 - url = 'http://kosis.kr/openapi/statisticsData.do?method=getList&apiKey=M2I3MWFhNzE2MjlkYjhhNzgwNWFjNWQ3MGU0MzY5Y2Y=&format=json&jsonVD=Y&userStatsId=tjsdk3105/101/DT_1A02003/2/1/20200529160216&prdSe=Y&newEstPrdCnt=1' 28 + if densitytype == 'returnfarm_agri_population':
29 + url = 'http://kosis.kr/openapi/statisticsData.do?method=getList&apiKey=M2I3MWFhNzE2MjlkYjhhNzgwNWFjNWQ3MGU0MzY5Y2Y=&format=json&jsonVD=Y&userStatsId=tjsdk3105/101/DT_1A02003/2/1/20200529160216&prdSe=Y&newEstPrdCnt=1'
30 + elif densitytype == 'population':
31 + url = 'http://kosis.kr/openapi/statisticsData.do?method=getList&apiKey=M2I3MWFhNzE2MjlkYjhhNzgwNWFjNWQ3MGU0MzY5Y2Y=&format=json&jsonVD=Y&userStatsId=tjsdk3105/101/DT_1IN1502/2/1/20200611044341&prdSe=Y&newEstPrdCnt=1'
29 data = urlopen(url).read().decode('utf8') 32 data = urlopen(url).read().decode('utf8')
30 return data 33 return data
31 34
...@@ -56,7 +59,7 @@ def population(request): ...@@ -56,7 +59,7 @@ def population(request):
56 maptype = request.GET['maptype'] 59 maptype = request.GET['maptype']
57 densitytype = request.GET['densitytype'] 60 densitytype = request.GET['densitytype']
58 mapp = Maps.objects.get(id=int(maptype)) 61 mapp = Maps.objects.get(id=int(maptype))
59 - exportdatas = publicdata() 62 + exportdatas = publicdata(densitytype)
60 except: 63 except:
61 mapp = Maps.objects.get(id=9) 64 mapp = Maps.objects.get(id=9)
62 exportdatas = {} 65 exportdatas = {}
...@@ -65,4 +68,24 @@ def population(request): ...@@ -65,4 +68,24 @@ def population(request):
65 68
66 ########### market ########## 69 ########### market ##########
67 def market(request): 70 def market(request):
68 - return render(request, 'market.html')
...\ No newline at end of file ...\ No newline at end of file
71 + product_large = ProductData.objects.values('large_cd','large_nm').distinct()
72 + product_medium = ProductData.objects.values('medium_cd','medium_nm').distinct()
73 + product_small = ProductData.objects.values('small_cd','small_nm')
74 + try:
75 + maptype = request.GET['maptype']
76 + mapp = Maps.objects.get(id=int(maptype))
77 + largefilter = request.GET['ctgr_large']
78 + mediumfilter = request.GET['ctgr_medium']
79 + if mediumfilter=='all':
80 + if largefilter=='all':
81 + exportdatas = AuctionData.objects.values('sanji_nm').annotate(count=Count('sanji_nm'))
82 + else:
83 + exportdatas = AuctionData.objects.values('sanji_nm').filter(large_cd=largefilter).annotate(count=Count('sanji_nm'))
84 + else:
85 + exportdatas = AuctionData.objects.values('sanji_nm').filter(medium_cd=mediumfilter).annotate(count=Count('sanji_nm'))
86 + except:
87 + mapp = Maps.objects.get(id=9)
88 + exportdatas = AuctionData.objects.values('sanji_nm').annotate(count=Count('sanji_nm'),avrg=Avg('mumm_amt'))
89 + maxx = exportdatas.aggregate(maxx=Sum('count'))
90 + context = {'largedata' : product_large, 'mediumdata': product_medium, 'maps':mapp, 'max':maxx, 'exportdata':exportdatas}
91 + return render(request, 'market.html', context)
...\ No newline at end of file ...\ No newline at end of file
......
No preview for this file type