{"id":311,"date":"2014-07-21T16:48:59","date_gmt":"2014-07-21T08:48:59","guid":{"rendered":"http:\/\/suherman.asia\/w2\/?p=311"},"modified":"2014-07-21T16:48:59","modified_gmt":"2014-07-21T08:48:59","slug":"calculating-the-shortest-path-between-two-geometries","status":"publish","type":"post","link":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html","title":{"rendered":"Calculating the Shortest Path Between Two Geometries"},"content":{"rendered":"<p>Seperti kita ketahui bahwa untuk mendapatkan berapa panjang jarak Antara 2 buah titik dapat menggunakan function STDistance() seperti contoh berikut :<!--more--><\/p>\n<p>Misal saya akan menandakan 2 buah point di kecamatan simokerto Surabaya :<\/p>\n<pre class=\"lang:tsql decode:true \">DECLARE @Simo1 geography = 'POINT(112.752191 -7.234907)';\r\nDECLARE @Simo2 geography = 'POINT(112.751384 -7.234276)';\r\n<\/pre>\n<p>Kemudian kita hitung jaraknya adalah :<\/p>\n<pre class=\"lang:tsql decode:true \">SELECT @Simo1.STDistance(@Simo2);<\/pre>\n<p>Dimana hasilnya adalah : <strong>113.194027345718<\/strong> Meter.<\/p>\n<p>Namun hal ini hanya menandakan jarak 2 buah titik lokasi tanpa kita mengetahui bagaimana bentuk linestring yang menghubungkan dua lokasi tersebut.<\/p>\n<p>Untuk hal tersebut dapat menggunakan function ShortestLineTo(). Sehingga garis yang terpendek yang menghubungkan 2 buah titik tersebut adalah :<\/p>\n<pre class=\"lang:tsql decode:true \">SELECT @Simo1.ShortestLineTo(@Simo2)<\/pre>\n<p>Sehingga jika kita ingin mengetahui jarak terdekat dan berapa jauh jarak terdekat tersebut dapat digambarkan dengan T-SQL lengkap sebagai berikut :<\/p>\n<pre class=\"lang:tsql decode:true \">DECLARE @Simo1 geography = 'POINT(112.752191 -7.234907)';\r\nDECLARE @Simo2 geography = 'POINT(112.751384 -7.234276)'; \r\n\r\nSelect @Simo1.STBuffer(5) Geom, 'SiMolawang I'\r\nUnion All Select\r\n@Simo2.STBuffer(5) Geom, 'SiMolawang II'\r\nUnion All Select\r\n@Simo1.ShortestLineTo(@Simo2).STBuffer(2) geom,'ShortestLineTo';<\/pre>\n<p>Dimana hasilnya adalah seperti ini :<\/p>\n<p><a href=\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-313\" src=\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\" alt=\"line\" width=\"470\" height=\"342\" srcset=\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png 470w, http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line-300x218.png 300w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Seperti kita ketahui bahwa untuk mendapatkan berapa panjang jarak Antara 2 buah titik dapat menggunakan function STDistance() seperti contoh berikut :<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\">Continue reading<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":313,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[68,56,52],"class_list":["post-311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spatial","tag-shortestlineto","tag-sql-server-spatial","tag-stdistance"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Calculating the Shortest Path Between Two Geometries - Suherman Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Calculating the Shortest Path Between Two Geometries - Suherman Blog\" \/>\n<meta property=\"og:description\" content=\"Seperti kita ketahui bahwa untuk mendapatkan berapa panjang jarak Antara 2 buah titik dapat menggunakan function STDistance() seperti contoh berikut : Continue reading\" \/>\n<meta property=\"og:url\" content=\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\" \/>\n<meta property=\"og:site_name\" content=\"Suherman Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/emantin34\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/emantin34\" \/>\n<meta property=\"article:published_time\" content=\"2014-07-21T08:48:59+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\" \/>\n\t<meta property=\"og:image:width\" content=\"470\" \/>\n\t<meta property=\"og:image:height\" content=\"342\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#article\",\"isPartOf\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\"},\"author\":{\"name\":\"admin\",\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc\"},\"headline\":\"Calculating the Shortest Path Between Two Geometries\",\"datePublished\":\"2014-07-21T08:48:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\"},\"wordCount\":107,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc\"},\"image\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage\"},\"thumbnailUrl\":\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\",\"keywords\":[\"ShortestLineTo\",\"SQL Server Spatial\",\"STDistance()\"],\"articleSection\":[\"Spatial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\",\"url\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\",\"name\":\"Calculating the Shortest Path Between Two Geometries - Suherman Blog\",\"isPartOf\":{\"@id\":\"http:\/\/suherman.asia\/w2\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage\"},\"image\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage\"},\"thumbnailUrl\":\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\",\"datePublished\":\"2014-07-21T08:48:59+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage\",\"url\":\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\",\"contentUrl\":\"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png\",\"width\":470,\"height\":342},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/suherman.asia\/w2\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Calculating the Shortest Path Between Two Geometries\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/suherman.asia\/w2\/#website\",\"url\":\"http:\/\/suherman.asia\/w2\/\",\"name\":\"Suherman Blog\",\"description\":\"Just Another Geek Site\",\"publisher\":{\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/suherman.asia\/w2\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eed6f889b4c2af2a8c18cb3bf63de6a4?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eed6f889b4c2af2a8c18cb3bf63de6a4?s=96&d=retro&r=g\",\"caption\":\"admin\"},\"logo\":{\"@id\":\"http:\/\/suherman.asia\/w2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/suherman.asia\",\"https:\/\/www.facebook.com\/emantin34\",\"https:\/\/x.com\/emantin34\"],\"url\":\"http:\/\/suherman.asia\/w2\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Calculating the Shortest Path Between Two Geometries - Suherman Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html","og_locale":"en_US","og_type":"article","og_title":"Calculating the Shortest Path Between Two Geometries - Suherman Blog","og_description":"Seperti kita ketahui bahwa untuk mendapatkan berapa panjang jarak Antara 2 buah titik dapat menggunakan function STDistance() seperti contoh berikut : Continue reading","og_url":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html","og_site_name":"Suherman Blog","article_publisher":"https:\/\/www.facebook.com\/emantin34","article_author":"https:\/\/www.facebook.com\/emantin34","article_published_time":"2014-07-21T08:48:59+00:00","og_image":[{"width":470,"height":342,"url":"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png","type":"image\/png"}],"author":"admin","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#article","isPartOf":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html"},"author":{"name":"admin","@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc"},"headline":"Calculating the Shortest Path Between Two Geometries","datePublished":"2014-07-21T08:48:59+00:00","mainEntityOfPage":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html"},"wordCount":107,"commentCount":0,"publisher":{"@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc"},"image":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage"},"thumbnailUrl":"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png","keywords":["ShortestLineTo","SQL Server Spatial","STDistance()"],"articleSection":["Spatial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#respond"]}]},{"@type":"WebPage","@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html","url":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html","name":"Calculating the Shortest Path Between Two Geometries - Suherman Blog","isPartOf":{"@id":"http:\/\/suherman.asia\/w2\/#website"},"primaryImageOfPage":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage"},"image":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage"},"thumbnailUrl":"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png","datePublished":"2014-07-21T08:48:59+00:00","breadcrumb":{"@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#primaryimage","url":"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png","contentUrl":"http:\/\/suherman.asia\/w2\/wp-content\/uploads\/2014\/07\/line.png","width":470,"height":342},{"@type":"BreadcrumbList","@id":"http:\/\/suherman.asia\/w2\/calculating-the-shortest-path-between-two-geometries.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/suherman.asia\/w2"},{"@type":"ListItem","position":2,"name":"Calculating the Shortest Path Between Two Geometries"}]},{"@type":"WebSite","@id":"http:\/\/suherman.asia\/w2\/#website","url":"http:\/\/suherman.asia\/w2\/","name":"Suherman Blog","description":"Just Another Geek Site","publisher":{"@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/suherman.asia\/w2\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/63654a129ee88012961c1a00415967dc","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eed6f889b4c2af2a8c18cb3bf63de6a4?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eed6f889b4c2af2a8c18cb3bf63de6a4?s=96&d=retro&r=g","caption":"admin"},"logo":{"@id":"http:\/\/suherman.asia\/w2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/suherman.asia","https:\/\/www.facebook.com\/emantin34","https:\/\/x.com\/emantin34"],"url":"http:\/\/suherman.asia\/w2\/author\/admin"}]}},"_links":{"self":[{"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":2,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":314,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/posts\/311\/revisions\/314"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/media\/313"}],"wp:attachment":[{"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/suherman.asia\/w2\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}