Showing
3 changed files
with
26 additions
and
1 deletions
| ... | @@ -39,6 +39,15 @@ | ... | @@ -39,6 +39,15 @@ |
| 39 | /> | 39 | /> |
| 40 | </div> | 40 | </div> |
| 41 | <div> | 41 | <div> |
| 42 | + 거주지역 | ||
| 43 | + <input | ||
| 44 | + type="text" | ||
| 45 | + id="address" | ||
| 46 | + name="address" | ||
| 47 | + placeholder="(도/시/구/동)을 입력해주세요." | ||
| 48 | + /> | ||
| 49 | + </div> | ||
| 50 | + <div> | ||
| 42 | <input class="btn" type="submit" value="SUBMIT" /> | 51 | <input class="btn" type="submit" value="SUBMIT" /> |
| 43 | </div> | 52 | </div> |
| 44 | </form> | 53 | </form> | ... | ... |
| ... | @@ -74,6 +74,18 @@ function makeOutListener(infowindow) { | ... | @@ -74,6 +74,18 @@ function makeOutListener(infowindow) { |
| 74 | } | 74 | } |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | +searchAddrFromCoords(map.getCenter(), displayCenterInfo); | ||
| 78 | +function searchAddrFromCoords(coords, callback) { | ||
| 79 | + // 좌표로 행정동 주소 정보를 요청합니다 | ||
| 80 | + geocoder.coord2RegionCode(coords.getLng(), coords.getLat(), callback); | ||
| 81 | +} | ||
| 82 | +function displayCenterInfo(result, status) { | ||
| 83 | +if (status === kakao.maps.services.Status.OK) { | ||
| 84 | + var infoDiv = document.getElementById('you'); | ||
| 85 | + infoDiv.innerHTML = result[0].address_name; | ||
| 86 | +} | ||
| 87 | +} | ||
| 88 | + | ||
| 77 | function displayMarker(Position) { | 89 | function displayMarker(Position) { |
| 78 | var marker = new kakao.maps.Marker({ | 90 | var marker = new kakao.maps.Marker({ |
| 79 | map: map, | 91 | map: map, | ... | ... |
| ... | @@ -4,6 +4,8 @@ const path = require("path"); | ... | @@ -4,6 +4,8 @@ const path = require("path"); |
| 4 | const HTTPS = require("https"); | 4 | const HTTPS = require("https"); |
| 5 | const mysql = require('mysql'); | 5 | const mysql = require('mysql'); |
| 6 | 6 | ||
| 7 | +var address; | ||
| 8 | + | ||
| 7 | const app = express(); | 9 | const app = express(); |
| 8 | const domain = "2020105635.oss2021.tk"; | 10 | const domain = "2020105635.oss2021.tk"; |
| 9 | const sslport = 8080; | 11 | const sslport = 8080; |
| ... | @@ -21,7 +23,7 @@ db.query('SELECT * FROM csvdata.csvdata', function (error, results, fields) { | ... | @@ -21,7 +23,7 @@ db.query('SELECT * FROM csvdata.csvdata', function (error, results, fields) { |
| 21 | if (error) { | 23 | if (error) { |
| 22 | throw(error); | 24 | throw(error); |
| 23 | } | 25 | } |
| 24 | - console.log(results[0].amount); | 26 | + console.log(results.length); |
| 25 | }); | 27 | }); |
| 26 | 28 | ||
| 27 | app.get("/", function (req, res) { | 29 | app.get("/", function (req, res) { |
| ... | @@ -29,6 +31,8 @@ app.get("/", function (req, res) { | ... | @@ -29,6 +31,8 @@ app.get("/", function (req, res) { |
| 29 | }); | 31 | }); |
| 30 | 32 | ||
| 31 | app.get("/geolocation", function (req, res) { | 33 | app.get("/geolocation", function (req, res) { |
| 34 | + address = req.query.address; | ||
| 35 | + console.log(address); | ||
| 32 | res.sendFile(path.join(__dirname + "/kakao/kakaomap.html")); | 36 | res.sendFile(path.join(__dirname + "/kakao/kakaomap.html")); |
| 33 | }); | 37 | }); |
| 34 | 38 | ... | ... |
-
Please register or login to post a comment