2

I need to pass my longitudes and latitudes of origin and destination for a sql view in geoserver to get a WMS layer with the route. I've performed in qgis to view and is working perfectly.

This is the view in geoserver:

enter image description here

This my code to add the layer on the map, I'm using leaflet.

function findRoute(){  
 route = L.tileLayer.wms("http://localhost:8888/geoserver/pgrouting/wms", {
     layers: 'pgrouting',
     viewparams: [x1:paramOrigemLng;y1:paramOrigemLat;x2:paramDestino1Lng;y2:paramDestino1Lat]
    });
}

Can anyone give me an example of layer viewparams the key format: value with leaflet because I'm not hitting the syntax. I'm doing as the link: http://docs.geoserver.org/stable/en/user/data/database/sqlview.html

Your Answer

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

Browse other questions tagged or ask your own question.