Skip to content

Commit

Permalink
Merge pull request #5 from mbasa/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mbasa authored Sep 6, 2021
2 parents 607309c + 6de146c commit 9bdd614
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ id, source, target, cost, geom.
CREATE VIEW pgrserver AS SELECT id,node_from AS source,node_to AS target,cost,wkb_geometry AS geom FROM kanto ;
```

Getting the Application
-----------------------

The *WAR* file of the application can be downloaded from from each stable release
of this repository.



Building the Application
------------------------

Expand Down Expand Up @@ -152,7 +160,11 @@ curl -X POST -F "authcode=abc12345" "http://localhost:8080/pgrServer/api/graphre
Viewing the Data
----------------

pgrServer returns a GeoJSON object for the created route or driving distance polygon, hence any application that supports GeoJSON can be used to view the results.
A demo application, *[pgrServerDemo](http://github.com/mbasa/pgrServerDemo)* , has been created
to easily display selected features of pgrServer.


Also, pgrServer returns a GeoJSON object for the created route or driving distance polygon, hence any application that supports GeoJSON can be used to view the results.

To quickly view the results, GeoJSONLint web service can be used:

Expand Down
15 changes: 6 additions & 9 deletions src/main/java/org/pgrserver/graph/MainGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,20 @@ public void createDirectedGraph() {

defaultGraph = new DefaultDirectedWeightedGraph<Integer,
LabeledWeightedEdge>(LabeledWeightedEdge.class);

for(PgrServer p : pgrData) {
defaultGraph.addVertex((int)p.getSource());
defaultGraph.addVertex((int)p.getTarget());
}

for(PgrServer p : pgrData) {
LabeledWeightedEdge lwe = new LabeledWeightedEdge();
lwe.setEdgeId(p.getId());
lwe.setEdgeId(p.getId());

defaultGraph.addEdge(
(int)p.getSource(),(int)p.getTarget(),lwe);
(int)p.getSource(),(int)p.getTarget(),lwe);

defaultGraph.setEdgeWeight(
defaultGraph.getEdge((int)p.getSource(),
(int)p.getTarget()), p.getCost());
defaultGraph.setEdgeWeight(lwe, p.getCost());
}

logger.info("Data received: "+pgrData.size());
}

Expand Down

0 comments on commit 9bdd614

Please sign in to comment.