﻿{"id":7895,"date":"2019-01-24T02:01:24","date_gmt":"2019-01-24T01:01:24","guid":{"rendered":"http:\/\/www.sigterritoires.fr\/?p=7895"},"modified":"2019-01-24T08:27:37","modified_gmt":"2019-01-24T07:27:37","slug":"how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/","title":{"rendered":"How to develop an application with pgrouting in Windows (2): the A-star algorithm"},"content":{"rendered":"\n<p>The pgrouting extension offers various algorithms to find the best\nroute: Dijkstra, A *, Ksp, Trsp, &#8230; <\/p>\n\n\n\n<p>In this article we will discuss in detail the use of a * (A-star). <\/p>\n\n\n\n<p>We will continue to use the database and tools described in the previous\narticle (How to develop an application with pgrouting inWindows (1)). <\/p>\n\n\n\n<p>The algorithm A * is a path search algorithm in a graph between an\ninitial node and an end node. It uses a heuristic evaluation on each node to\nestimate the best path passing through it, and then visits the nodes according\nto their order in this heuristic evaluation. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Together with the Dijkstra&rsquo;s algorithm, these are the most used\nalgorithms for calculating the <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-shortest-path-network-analysis-tools\/\">shortest path<\/a> between two points of a linear\nnetwork. <\/p>\n\n\n\n<p><strong>Request A *<\/strong> <\/p>\n\n\n\n<p>The syntax of the A * algorithm is as follows: <\/p>\n\n\n\n<p>pgr_astar ( <strong><em>sql<\/em><\/strong> text, <strong><em>source<\/em><\/strong> integer, <strong><em>target<\/em><\/strong>\ninteger, <strong><em>directed<\/em><\/strong> boolean, <strong><em>has_rcost<\/em><\/strong> boolean); <\/p>\n\n\n\n<p>Where <strong><em>source<\/em><\/strong> is the desired departure point of the route, <strong><em>target<\/em><\/strong>\nthe end point of the route and the <strong><em>sql<\/em><\/strong> chain is of the following type:\n<\/p>\n\n\n\n<p>SELECT id, source, target, cost, x1, y1, x2, y2 [, reverse_cost] FROM\nnetwork <\/p>\n\n\n\n<p>We will discuss later the two Boolean variables and their use. <\/p>\n\n\n\n<p>The command returns a <strong><em>pgr_costResult<\/em><\/strong> element that includes\n(seq, id1, id2, cost), where <strong><em>seq<\/em><\/strong> is the order of the section in\nthe route, <strong><em>id1<\/em><\/strong> the starting point of the section, <strong><em>id2<\/em><\/strong>\nthe point of arrival of the section and <strong><em>cost<\/em><\/strong> the cost associated\nwith this stretch. <\/p>\n\n\n\n<p><strong>Preparation of the database<\/strong> <\/p>\n\n\n\n<p>Unlike other pgrouting algorithms, to use A * you must add, if\nnecessary, the latitude \/ longitude coordinates of the beginning and end nodes\nof each section. \n\nIf you followed the creation of the database in\nthe previous article by importing OpenStreeMap data with osm2pgrouting, you\nhave nothing to do because this program generates the fields x1, y1, x2, y2 needed\nfor method A * &nbsp;&nbsp;\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"384\" data-attachment-id=\"7896\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/241\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/241.png?fit=525%2C384&amp;ssl=1\" data-orig-size=\"525,384\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"241\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/241.png?fit=525%2C384&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/241.png?resize=525%2C384&#038;ssl=1\" alt=\"\" class=\"wp-image-7896\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/241.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/241.png?resize=300%2C219&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>If these fields are not present in your network layer, you will have to\ncreate them. \n\nBut, firstly, you have to check the type of\ngeometry of your network. In pgAdmin III, select the geometry field of your\ntable: &nbsp;\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"315\" data-attachment-id=\"7897\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/242\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/242.png?fit=525%2C315&amp;ssl=1\" data-orig-size=\"525,315\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"242\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/242.png?fit=525%2C315&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/242.png?resize=525%2C315&#038;ssl=1\" alt=\"\" class=\"wp-image-7897\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/242.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/242.png?resize=300%2C180&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong>Problem: MultiLineString geometry or LineString?<\/strong> <\/p>\n\n\n\n<p>You can find two types of geometry: LineString and MultiLineString. Commands\nused to compute node coordinates only work with LineString geometries. If you\nhave a MultiLineString geometry, not a chance!. You will not get an error\nmessage, but your columns will remain desperately empty. <\/p>\n\n\n\n<p>This is particularly silly since you have 99.99% probability of not\nreally having a MultiLine String geometry! If you use the <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/starting-with-postgres-postgis\/\">PostGis<\/a> <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/shapefile-vs-geopackage\/\">Shapefile<\/a>\nutility and DBF loader, you will have this type of geometry by default, even if\nyour data is LineString. <\/p>\n\n\n\n<p><strong>SOLUTION:<\/strong> <\/p>\n\n\n\n<p>Test the geometry to verify that it is not necessarily MultiLineString\nwith the following SQL command <strong>SELECT COUNT (<\/strong><br><strong>CASE WHEN ST_NumGeometries (the_geom)&gt; 1 THEN 1 END<\/strong><br><strong>) AS multi, COUNT (the_geom) AS total<\/strong><br><strong>FROM ways;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"394\" data-attachment-id=\"7898\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/243\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/243.png?fit=525%2C394&amp;ssl=1\" data-orig-size=\"525,394\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"243\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/243.png?fit=525%2C394&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/243.png?resize=525%2C394&#038;ssl=1\" alt=\"\" class=\"wp-image-7898\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/243.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/243.png?resize=300%2C225&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>If the result of Multi is <strong>0<\/strong> , you do not have multilines and you\ncan change the geometry type to LineString with the SQL command <\/p>\n\n\n\n<p><strong>ALTER TABLE ways<\/strong> <br>\n<strong>ALTER COLUMN the_geom geometry TYPE (LineString, 4326)<\/strong> <br>\n<strong>USING ST_GeometryN (the_geom, 1);<\/strong> <\/p>\n\n\n\n<p>Now you can create the fields x1, y1, x2, y2 with the following sql\ncommands: <\/p>\n\n\n\n<p><strong>ALTER TABLE ways COLUMN ADD x1 double precision;<\/strong> <br>\n<strong>ALTER TABLE ways ADD COLUMN y1 double precision;<\/strong> <br>\n<strong>ALTER TABLE ways ADD COLUMN x2 double precision;<\/strong> <br>\n<strong>ALTER TABLE ways ADD COLUMN y2 double precision;<\/strong> <\/p>\n\n\n\n<p><strong>UPDATE ways SET x1 = ST_x (ST_PointN (the_geom,\n1));<\/strong> <br>\n<strong>UPDATE ways SET y1 = ST_y (ST_PointN (the_geom, 1));<\/strong> <strong>UPDATE ways SET x2 = ST_x (ST_PointN (the_geom,\nST_NumPoints (the_geom)));<\/strong><br><strong>UPDATE ways SET y2 = ST_y (ST_PointN (the_geom, ST_NumPoints (the_geom)));<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"387\" data-attachment-id=\"7899\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/244\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/244.png?fit=525%2C387&amp;ssl=1\" data-orig-size=\"525,387\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"244\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/244.png?fit=525%2C387&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/244.png?resize=525%2C387&#038;ssl=1\" alt=\"\" class=\"wp-image-7899\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/244.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/244.png?resize=300%2C221&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong>Problem: choosing the \u201ccost\u201d<\/strong> <strong>of a section.<\/strong> <\/p>\n\n\n\n<p>The routing algorithm looks for the path with the lowest cost. Depending\non your goals, you have to decide which cost item you will support. <\/p>\n\n\n\n<p>Let&rsquo;s take our OpenStreetMap database. You have a field &nbsp; \u201ccost\u201d\n&nbsp; that gets back the length of the section in degrees. If you use this\nfield in the A * algorithm as the cost value, the proposed route will be the\nshortest path between the two chosen points. Let&rsquo;s see an example. <\/p>\n\n\n\n<p>The following command calculates the route between points 69072 and\n64204 using the \u201ccost\u201d &nbsp; that corresponds to the length of the section. <strong>SELECT seq, id1 AS node, id2 AS edge, di.cost,\nthe_geom<\/strong><br><strong>FROM pgr_astar (<\/strong><br><strong>&lsquo;SELECT gid as id, source :: integer, target :: integer, cost :: double\nprecision, x1, y1, x2, y2 FROM public.ways&rsquo;,<\/strong><br><strong>69072, 64204, false, false<\/strong><br><strong>) as di<\/strong><br><strong>JOIN public.ways ways_vertices_pgr<\/strong><br><strong>ON di.id2 = ways_vertices_pgr.gid;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"347\" data-attachment-id=\"7900\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/245\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/245.png?fit=525%2C347&amp;ssl=1\" data-orig-size=\"525,347\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"245\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/245.png?fit=525%2C347&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/245.png?resize=525%2C347&#038;ssl=1\" alt=\"\" class=\"wp-image-7900\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/245.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/245.png?resize=300%2C198&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nOnce\nloaded into QGis, the result is as follows: &nbsp;&nbsp;\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"298\" data-attachment-id=\"7901\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/246\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/246.png?fit=525%2C298&amp;ssl=1\" data-orig-size=\"525,298\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"246\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/246.png?fit=525%2C298&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/246.png?resize=525%2C298&#038;ssl=1\" alt=\"\" class=\"wp-image-7901\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/246.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/246.png?resize=300%2C170&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>On foot, it&rsquo;s the best route. But by car we would never take it! Small\nstreets with 30km \/ h zones instead of a 110km \/ h fast track&#8230; <\/p>\n\n\n\n<p>In the OSM table you find another field, called cost_s. This is the\nresult of calculating the travel time in seconds, by using the length and speed\nallowed for each section. <\/p>\n\n\n\n<p>If you modify the sql query to use this field: <strong>SELECT seq, id1 AS node, id2 AS edge, di.cost,\nthe_geom<\/strong><br><strong>FROM pgr_astar (<\/strong><br><strong>&lsquo;SELECT gid as id, source :: integer, target :: integer, cost_s :: double\nprecision as cost, x1, y1, x2, y2 FROM public.ways&rsquo;,<\/strong><br><strong>69072, 64204, false, false<\/strong><br><strong>) as di<\/strong><br><strong>JOIN public.ways ways_vertices_pgr<\/strong><br><strong>ON di.id2 = ways_vertices_pgr.gid;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"326\" data-attachment-id=\"7902\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/247\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/247.png?fit=525%2C326&amp;ssl=1\" data-orig-size=\"525,326\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"247\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/247.png?fit=525%2C326&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/247.png?resize=525%2C326&#038;ssl=1\" alt=\"\" class=\"wp-image-7902\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/247.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/247.png?resize=300%2C186&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nOnce\nloaded in QGis, the result is the following (red line)\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"303\" data-attachment-id=\"7903\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/248\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/248.png?fit=525%2C303&amp;ssl=1\" data-orig-size=\"525,303\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"248\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/248.png?fit=525%2C303&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/248.png?resize=525%2C303&#038;ssl=1\" alt=\"\" class=\"wp-image-7903\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/248.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/248.png?resize=300%2C173&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong>Problem: cost_s has null values<\/strong> <\/p>\n\n\n\n<p>There is a good chance that the last SQL query will return an error\nsaying that cost_s has null values. <\/p>\n\n\n\n<p>This is because the field that is used by osm2pgrouting to calculate the\ncost in seconds is the length of the section in m (length_m), and this field is\nnot always filled in. <\/p>\n\n\n\n<p><strong>SOLUTION:<\/strong> <\/p>\n\n\n\n<p>After loading the <strong><em>ways<\/em><\/strong> layer , select <strong><em>Project-&gt; project\nproperties-&gt; SCR<\/em><\/strong> with QGis.<\/p>\n\n\n\n<p>Check the <strong><em><a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-projections-crs\/\">Projection<\/a> on the fly box<\/em><\/strong> and select a flat\nprojection, Lambert 95 for example. <\/p>\n\n\n\n<p>Open the attributes table of <strong><em>ways<\/em><\/strong> , pass the table in edit\nmode. \n\nSelect all records with zero <strong><em>cost_s<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"323\" data-attachment-id=\"7904\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/249\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/249.png?fit=525%2C323&amp;ssl=1\" data-orig-size=\"525,323\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"249\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/249.png?fit=525%2C323&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/249.png?resize=525%2C323&#038;ssl=1\" alt=\"\" class=\"wp-image-7904\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/249.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/249.png?resize=300%2C185&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou\nwill notice that the selected records have a zero <strong><em>length_m<\/em><\/strong>&nbsp; as well. &nbsp;\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"370\" data-attachment-id=\"7905\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/2410\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2410.png?fit=525%2C370&amp;ssl=1\" data-orig-size=\"525,370\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2410\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2410.png?fit=525%2C370&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2410.png?resize=525%2C370&#038;ssl=1\" alt=\"\" class=\"wp-image-7905\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2410.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2410.png?resize=300%2C211&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nUsing\nthe field calculator check the box <strong><em>Update an existing field<\/em><\/strong> ,\nselect the field <strong><em>lenght_m<\/em><\/strong> and in <strong>Expression<\/strong> type <strong><em>$\nlength<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"419\" data-attachment-id=\"7906\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/2411\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2411.png?fit=525%2C419&amp;ssl=1\" data-orig-size=\"525,419\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2411\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2411.png?fit=525%2C419&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2411.png?resize=525%2C419&#038;ssl=1\" alt=\"\" class=\"wp-image-7906\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2411.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2411.png?resize=300%2C239&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>This will inform the field the length of the section, calculated\naccording the current QGis coordinate system (lambert95 for example). <\/p>\n\n\n\n<p>Now you can update the <strong><em>cost_s<\/em><\/strong> field with the expression <strong>( &lsquo;<\/strong><strong>length_m<\/strong><strong>\u00ab\u00a0*\n3600) \/ (\u00ab\u00a0<\/strong><strong>maxspeed_forward<\/strong><strong>*\n1000)<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"419\" data-attachment-id=\"7907\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/2412\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2412.png?fit=525%2C419&amp;ssl=1\" data-orig-size=\"525,419\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2412\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2412.png?fit=525%2C419&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2412.png?resize=525%2C419&#038;ssl=1\" alt=\"\" class=\"wp-image-7907\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2412.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2412.png?resize=300%2C239&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong>Problem: The route works in the opposite direction<\/strong> \n\nWith the queries used so far, you can get\nresults such as the following: \n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"294\" data-attachment-id=\"7908\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/2413\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2413.png?fit=525%2C294&amp;ssl=1\" data-orig-size=\"525,294\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2413\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2413.png?fit=525%2C294&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2413.png?resize=525%2C294&#038;ssl=1\" alt=\"\" class=\"wp-image-7908\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2413.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2413.png?resize=300%2C168&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>The calculated route suggests you to get out of the fast lane and follow\nit in the opposite direction! <\/p>\n\n\n\n<p>In the OSM data, a oneway field indicates, if it is equal to 1, that the section has only one direction of travel. Pgrouting algorithms do not use this field directly. They use the <strong><em>reverse_cost<\/em><\/strong> field . <\/p>\n\n\n\n<p>So you have a field <strong><em>cost<\/em><\/strong> and a <strong><em>reverse_cost<\/em><\/strong>\nfield . If the value of these two fields is the same, the algorithm reads it as\na two-way street. The proposed route can, therefore, go both ways. <\/p>\n\n\n\n<p>If <strong><em>reverse_cost<\/em><\/strong> has a negative value, it will never take\nthis section in the opposite direction but, always, from the <strong><em>source<\/em><\/strong>\nnode to the <strong><em>target<\/em><\/strong> node . The section is, immediately, removed\nfrom the resulting graph. If not, you can also assign an extremely large value\n(for example 1000000) to the reverse_costs of the one-way sections. In this\ncase the section will be evaluated (unfavorably) but not rejected immediately. <\/p>\n\n\n\n<p>For the algorithm to take into account these values, you must modify the\ntwo boolean parameters of the SQL query <strong><em>directed<\/em><\/strong> and <strong><em>has_reverse<\/em><\/strong>\n. There are some subtleties that go beyond the scope of this article concerning\nthe change of only one of the two parameters (true, false &nbsp; and false,\ntrue). Overall, you set both parameters as <strong>true<\/strong> so that the algorithm\nworks by taking into consideration the forbidden directions. \n\nHere is the request as it should be to avoid the\nmisinterpretation problem in the expressway: &nbsp;\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"268\" data-attachment-id=\"7909\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/how-to-develop-an-application-with-pgrouting-in-windows-2-the-a-star-algorithm\/attachment\/2414\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2414.png?fit=525%2C268&amp;ssl=1\" data-orig-size=\"525,268\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2414\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2414.png?fit=525%2C268&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2414.png?resize=525%2C268&#038;ssl=1\" alt=\"\" class=\"wp-image-7909\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2414.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2019\/01\/2414.png?resize=300%2C153&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong>Problem: reverse_costs_s has null values<\/strong> <\/p>\n\n\n\n<p>As for the field <strong><em>cost_s<\/em><\/strong> , this problem arises due to &nbsp;the fact that the field being used by osm2pgrouting\nto calculate the cost in seconds is the length of the section in m ( <strong><em>length_m<\/em><\/strong>\n), and, that this field is not always filled. <\/p>\n\n\n\n<p><strong>SOLUTION<\/strong> <\/p>\n\n\n\n<p>Since you have, in theory, &nbsp;filled\nall the values \u200b\u200bof <strong><em>costs_s<\/em><\/strong> , just select in the QGis table all the\nrecords with null <strong><em>reverse_costs_s<\/em><\/strong> values , then, using the field\ncalculator set the value of <strong><em>costs_s<\/em><\/strong> to <strong><em>reverse_costs_s<\/em><\/strong>\n. <\/p>\n\n\n\n<p>But now, we have generated the following problem: <\/p>\n\n\n\n<p><strong>Problem: reverse_costs_s does not take into account\nthe forbidden direction (same value as the corresponding costs_s)<\/strong> <\/p>\n\n\n\n<p><strong>SOLUTION<\/strong> <\/p>\n\n\n\n<p>Select the records with <strong><em>oneway<\/em><\/strong> = 1, then set the <strong><em>-costs_s<\/em><\/strong>\nvalue to the <strong><em>reverse_costs_s<\/em><\/strong> field <\/p>\n\n\n\n<p>The solutions to the last two problems start up in the base you are\nusing for the OSM data and render all the records consistent. Of course, if you\nhave a particular network and have adopted other specifications, you will need\nto adapt the queries to meet your definitions. <\/p>\n\n\n\n<p>We have finished the tour of the algorithm A * and its most common\nproblems. If you find others (I trust you), do not hesitate to leave a comment.\n<\/p>\n\n\n\n<p>In the next article we will discuss how (do\/do not) work the other\nrouting algorithms with Windows. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The pgrouting extension offers various algorithms to find the best route: Dijkstra, A *, Ksp, Trsp, &#8230; In this article we will discuss in detail the use of a * (A-star). We will continue to use&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1260],"tags":[],"class_list":["post-7895","post","type-post","status-publish","format-standard","hentry","category-non-classe-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-23l","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/7895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=7895"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/7895\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=7895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=7895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=7895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}