0

I'm following the http://workshop.pgrouting.org/ but my routing result not showed up at all, like the picture below: enter image description here

my firebug also didn't give me an error, I'm using geoserver 2.4.2, postgresql 9.2 x64, postgis 2.1.1, and pgrouting 2.0. Here are the code that originally came from the pgrouting latest workshop:

<!DOCTYPE html>

ol3 pgRouting client #ol-map { width: 100%; height: 400px; } start final

<button id="clear">clear</button>

<script type="text/javascript">

  var map = new ol.Map({
    target: 'ol-map',
    renderer: ol.RendererHint.CANVAS,
    layers: [
      new ol.layer.TileLayer({
        source: new ol.source.OSM()
      })
    ],
    view: new ol.View2D({
      center: [-127998, 6974591],
      zoom: 10
    })
  });

  var params = {
    LAYERS: 'pgrouting:pgrouting',
    FORMAT: 'image/png'
  };

  var startPoint = new ol.Overlay({
    map: map,
    element: document.getElementById('start-point')
  });
  var finalPoint = new ol.Overlay({
    map: map,
    element: document.getElementById('final-point')
  });

  var transform = ol.proj.getTransform('EPSG:3857', 'EPSG:4326');

  map.on('click', function(event) {
    var coordinate = event.getCoordinate();
    if (startPoint.getPosition() == undefined) {
      // first click
      startPoint.setPosition(coordinate);
    } else if (finalPoint.getPosition() == undefined) {
      // second click
      finalPoint.setPosition(coordinate);

      // transform the coordinates from the map projection (EPSG:3857)
      // into the server projection (EPSG:4326)
      var startCoord = transform(startPoint.getPosition());
      var finalCoord = transform(finalPoint.getPosition());
      var viewparams = [
        'x1:' + startCoord[0], 'y1:' + startCoord[1],
        'x2:' + finalCoord[0], 'y2:' + finalCoord[1]
      ];
      params.viewparams = viewparams.join(';');

      // we now have the two points, create the result layer and add it to the map
      result = new ol.layer.ImageLayer({
        source: new ol.source.SingleImageWMS({
          url: 'http://localhost:9090/geoserver/pgrouting/wms',
          params: params
        })
      });
      map.addLayer(result);
    }
  });

  document.getElementById('clear').addEventListener('click', function(event) {
    // hide the overlays
    startPoint.setPosition(undefined);
    finalPoint.setPosition(undefined);

    // remove the result layer
    map.removeLayer(result);
  });

</script>

am i missing something? I've been followed the workshop and check it twice. Please help me I've been through so much error whether it using the older tutorial sample or this is the latest tutorial.

best regards

closed as off-topic by Ian Turton Feb 13 '14 at 9:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Ian Turton
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Do pgRouting queries work, ie. the ones in the workshop chapters before? – dkastl Feb 11 '14 at 14:46
  • @dkastl yes, it's worked both for dijkstra and a-star. I've tried in qgis desktop and pgAdmin – iqnaul Feb 11 '14 at 15:51
  • What am I missing ? Because yesterday I met other people who also got the same problem and we still trying to find the solution but we don't have a clue what we're missing sir @dkastl – iqnaul Feb 12 '14 at 1:38
  • Does your request to Geoserver return something? Try to add console.log() into your Javascript source to see where you send/retrieve something (or not). – dkastl Feb 12 '14 at 15:22
  • I don't know if it changed something, I upgraded my Geoserver into 2.4.4 version and now it works @dkastl and I did some modification to in the wrapper. How can I change the wrapper so it can used the A-star algorithym? I want to add the Query-table result into my webpage directly after the route showed up, is it possible? – iqnaul Feb 13 '14 at 2:48
0

Suddenly the route showed up after I upgrade my Geoserver into 2.4.4 version and I also did some modification in the wrapper so it matches my own data. I'm using shapefile and imported to PostgreSQL, the data was topology checked. route showed up

Now, I want to write the wrapper for A-star algorithm because in my research I want to use this alogirthm and add the query-result table directly after the route showed up.

  • what type of modifications you did? – Julio Marins May 27 '15 at 2:08
  • I modify the wrapper script from pgRouting workshop tutorial to match my own database, e.g change "the_geom" to "geom" because I'm using PostGIS 2.0 @JulioMarins – iqnaul May 28 '15 at 4:31
  • can you add me on facebook(facebook.com/aj07mm)? I having some probs and my postgis version is >2.0. Still nothing. Where did you changed the "the_geom" to "geom" specificaly? – Julio Marins May 28 '15 at 5:21
  • Did you followed this workshop workshop.pgrouting.org/chapters/wrapper.html @JulioMarins ? On the wrapper section you may seen a bunch of code, you need to adjust/modify the code to match your own data. – iqnaul May 28 '15 at 7:33
  • I left all the same. I exported the .osm data from JOSM. Any tips on this? – Julio Marins May 28 '15 at 13:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.