1

I have installed PostGIS/PostgreSQL, imported the OSM data from OpenStreetMaps and I am querying the database to get shortest path between two points. As is visible on image the query returns the nodes in the way between the points, however, the query returns just nodes and I need to draw the way on Map (Google map). Does anybody know how can I draw the way based on these nodes (latitude, longitude)?

Screenshot of executed query

SELECT * FROM shortest_path('
      SELECT id AS id,
          source::int4 AS source,
          target::int4 AS target,
          cost::float8 AS cost
      FROM br_2po_4pgr',
      1,
      5110,
      false,
      false)

It returns all coordinates between the source and target, but each line has two pairs of latitude and longitude (x1,y1 and x2,y2).. I don't know which one I have to use..

thanks!

4

1 回答 1

2

其实截图大小没问题。只需在浏览器中独立加载它。截图中缺少的是最后一列名称被截断。这才是真正的几何。您所要做的就是将该 geom 转换为KMLPostGIS ST_AsKML,然后像这样将其加载到 Google Maps 上。做一点研究KML

于 2012-11-15T15:57:39.070 回答