Ojimin

Get location from user

......@@ -39,6 +39,15 @@
/>
</div>
<div>
거주지역
<input
type="text"
id="address"
name="address"
placeholder="(도/시/구/동)을 입력해주세요."
/>
</div>
<div>
<input class="btn" type="submit" value="SUBMIT" />
</div>
</form>
......
......@@ -74,6 +74,18 @@ function makeOutListener(infowindow) {
}
*/
searchAddrFromCoords(map.getCenter(), displayCenterInfo);
function searchAddrFromCoords(coords, callback) {
// 좌표로 행정동 주소 정보를 요청합니다
geocoder.coord2RegionCode(coords.getLng(), coords.getLat(), callback);
}
function displayCenterInfo(result, status) {
if (status === kakao.maps.services.Status.OK) {
var infoDiv = document.getElementById('you');
infoDiv.innerHTML = result[0].address_name;
}
}
function displayMarker(Position) {
var marker = new kakao.maps.Marker({
map: map,
......
......@@ -4,6 +4,8 @@ const path = require("path");
const HTTPS = require("https");
const mysql = require('mysql');
var address;
const app = express();
const domain = "2020105635.oss2021.tk";
const sslport = 8080;
......@@ -21,7 +23,7 @@ db.query('SELECT * FROM csvdata.csvdata', function (error, results, fields) {
if (error) {
throw(error);
}
console.log(results[0].amount);
console.log(results.length);
});
app.get("/", function (req, res) {
......@@ -29,6 +31,8 @@ app.get("/", function (req, res) {
});
app.get("/geolocation", function (req, res) {
address = req.query.address;
console.log(address);
res.sendFile(path.join(__dirname + "/kakao/kakaomap.html"));
});
......