1

I want to change the code from pgrouting latest workshop which is used the OpenLayers 3 beta to OpenLayers 2.13. The code is in here http://workshop.pgrouting.org/chapters/ol3_client.html

I tried to change it, but still have got some errors like this one: startpoint.getPosition is not a function

Is there anyone could help me? Because there are some features in OpenLayers 2.13 which are not (yet) supported in the Ol3js. My idea is simple, I just want to have a Layerswitcher button, and adds radio button for start and final location for the route, and the compute route button, so that the web will look more neat.

1

as user underdark already mentioned there are also versions of the pgrouting workshop online that used OpenLayers 2.x

You could for example download a slightly newer version of the workshop at https://github.com/pgRouting/workshop/releases/tag/v0.6.1 which uses OpenLayers 2.10 Here you can see a part of the demo-app:

function pgrouting(store, layer, method) {
         if (layer.features.length == 2) {
             // erase the previous route
             store.removeAll();

             // transform the two geometries from EPSG:900913 to EPSG:4326
             var startpoint = layer.features[0].geometry.clone();
             startpoint.transform(epsg_900913, epsg_4326);
             var finalpoint = layer.features[1].geometry.clone();
             finalpoint.transform(epsg_900913, epsg_4326);

             // load to route
             store.load({
                 params: {
                     startpoint: startpoint.x + " " + startpoint.y,
                     finalpoint: finalpoint.x + " " + finalpoint.y,
                     method: method
                 }
             });
         }
    }

( see https://github.com/pgRouting/workshop/blob/foss4g2011/web/routing-final.html )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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