{"id":11651,"date":"2021-09-18T10:56:06","date_gmt":"2021-09-18T01:56:06","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=11651"},"modified":"2021-09-19T13:30:48","modified_gmt":"2021-09-19T04:30:48","slug":"postgis-%ea%b0%80%ec%9e%a5-%ea%b0%80%ea%b9%8c%ec%9a%b4-%ec%9c%84%ec%b9%98-%ec%b0%be%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=11651","title":{"rendered":"[PostGIS] \uac00\uc7a5 \uac00\uae4c\uc6b4 \uc704\uce58 \ucc3e\uae30"},"content":{"rendered":"<p>\uc2dc\ub098\ub9ac\uc624\ub294 \uc5b4\ub5a4 \uc9c0\uc810\uc5d0\uc11c \uac00\uc7a5 \uac00\uae4c\uc6b4 \uc704\uce58\ub97c \ucc3e\uc544\uc57c \ud55c\ub2e4.. \uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc704\uce58\uc5d0 \ub300\ud55c \uc88c\ud45c \ud0c0\uc785\uc774 geometry\uac00 \uc544\ub2c8\uace0 \uc77c\ub2e8 \uc2e4\uc218\ud615\uc774\ub77c\ub294 \uc810\uc785\ub2c8\ub2e4. \uadf8\ub9ac\uace0 \uae30\uc900 \uc88c\ud45c\uc640 \ucc3e\uc544\uc57c \ud558\ub294 \uc88c\ud45c\uc758 \uc88c\ud45c \uccb4\uacc4\uac00 \ub2e4\ub985\ub2c8\ub2e4. \ud558\ub098\ub294 \uad6c\uae00 \uc88c\ud45c\uacc4(EPSG:3857)\uc774\uace0 \ud558\ub098\ub294 \uacbd\uc704\ub3c4 \uc88c\ud45c\uacc4(EPSG:4326)\uc785\ub2c8\ub2e4.<\/p>\n<p>\uc544\ub798\uc758 \ucffc\ub9ac\uac00 \uc704\uc758 \ub0b4\uc6a9\uc5d0 \ub300\ud55c \uc194\ub8e8\uc158 \uc911 \ud558\ub098\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">\r\nSELECT \r\n    station_id,\r\n    address,\r\n    lng,\r\n    lat,\r\n    ST_DISTANCE(\r\n        ST_TRANSFORM(\r\n            ('SRID=4326;POINT(' || lng || ' ' || lat || ')')::geometry,\r\n            3857\r\n        ),\r\n        'SRID=3857;POINT(14128453 4506986)'::geometry\r\n    ) AS distance\r\nFROM \r\n    weather_station\r\nORDER BY\r\n    distance\r\n<\/pre>\n<p>\uc989, \uad6c\uae00 \uc88c\ud45c\uacc4\ub85c (14128453, 4506986)\uc778 \uc9c0\uc810\uacfc\uc758 \uac70\ub9ac\ub97c \uad6c\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uac70\ub9ac\ub97c \uad6c\ud558\ub294 ST_DISTANCE\ub294 \uc11c\ub85c \ub2e4\ub978 \uc88c\ud45c\uacc4\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc73c\ubbc0\ub85c ST_TRANSFORM\uc744 \ud1b5\ud574 \uacbd\uc704\ub3c4 \uc88c\ud45c\ub97c X,Y \uc88c\ud45c\uacc4\ub85c \ubcc0\uacbd\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2021\/09\/postgis_st_distance.png\" alt=\"\" width=\"800\" class=\"aligncenter size-full wp-image-11652\" \/><\/p>\n<p>\ubcf4\uc2dc\uba74 \uac00\uc7a5 \uccab\ubc88\uc9f8 Row\uac00 \uac00\uc7a5 \uac00\uae4c\uc6b4 \ub300\uc0c1\uc774\ub77c\ub294 \uac83\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc2dc\ub098\ub9ac\uc624\ub294 \uc5b4\ub5a4 \uc9c0\uc810\uc5d0\uc11c \uac00\uc7a5 \uac00\uae4c\uc6b4 \uc704\uce58\ub97c \ucc3e\uc544\uc57c \ud55c\ub2e4.. \uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc704\uce58\uc5d0 \ub300\ud55c \uc88c\ud45c \ud0c0\uc785\uc774 geometry\uac00 \uc544\ub2c8\uace0 \uc77c\ub2e8 \uc2e4\uc218\ud615\uc774\ub77c\ub294 \uc810\uc785\ub2c8\ub2e4. \uadf8\ub9ac\uace0 \uae30\uc900 \uc88c\ud45c\uc640 \ucc3e\uc544\uc57c \ud558\ub294 \uc88c\ud45c\uc758 \uc88c\ud45c \uccb4\uacc4\uac00 \ub2e4\ub985\ub2c8\ub2e4. \ud558\ub098\ub294 \uad6c\uae00 \uc88c\ud45c\uacc4(EPSG:3857)\uc774\uace0 \ud558\ub098\ub294 \uacbd\uc704\ub3c4 \uc88c\ud45c\uacc4(EPSG:4326)\uc785\ub2c8\ub2e4. \uc544\ub798\uc758 \ucffc\ub9ac\uac00 \uc704\uc758 \ub0b4\uc6a9\uc5d0 \ub300\ud55c \uc194\ub8e8\uc158 \uc911 \ud558\ub098\uc785\ub2c8\ub2e4. SELECT station_id, address, lng, lat, ST_DISTANCE( ST_TRANSFORM( (&#8216;SRID=4326;POINT(&#8216; || lng || &#8216; &#8216; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=11651\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[PostGIS] \uac00\uc7a5 \uac00\uae4c\uc6b4 \uc704\uce58 \ucc3e\uae30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-11651","post","type-post","status-publish","format-standard","hentry","category-gis-working-history"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11651"}],"version-history":[{"count":4,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11651\/revisions"}],"predecessor-version":[{"id":11659,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11651\/revisions\/11659"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11651"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}