/pgRouting-Web-Direction-API

pgRouting a complete direction API written in Node JS Javascript Express for PostGIS/pgRouting

Primary LanguageJavaScriptMIT LicenseMIT

pgRouting-Web-API MIT licensed

A complete solution of pgRouting direction Web API written in Node js (Javascript) Express

Setup

  • edit src/config/config.js file according to your postgres connection, pgRouting table name and express js settings.

  • *if your pgrouting database table schema/name of columns is different, you have to change the query schema in src/model/pgrouting.js

Install Modules

npm install

Start Development Server

npm start

API Request Example

My API Request Example

App is underdevelopment:

  • Way Points
  • Docker
  • Handle other pgRouting capabilities.
SELECT st_asgeojson(st_transform(ST_LineMerge(st_union(geom)),4326))  geojson
FROM pgr_dijkstra(
        'SELECT id, source, target, cost_len as cost, rcost_len as reverse_cost FROM line', 
        (SELECT id FROM line_vertices_pgr ORDER BY st_distance(the_geom, st_setsrid(st_makepoint(99.99537, 6.81322), 4326)) LIMIT 1),
        (SELECT id FROM line_vertices_pgr ORDER BY st_distance(the_geom, st_setsrid(st_makepoint(100.00850, 6.81125), 4326)) LIMIT 1),
        false) as dj, line as ln where dj.edge=ln."id";