Thu, 04/14/2016 - 06:04
#1
Send route request as POST
I can see LeafletJS is overwriting the default behaviour of MapQuest when calling the MQ.routing.directions().route() method but this forces the request to be of type GET which in my case requires very lengthy URL. I want to be able to send my data through a POST request. Is it possible?
I did manage to find a way and send a POST request by looking deeper into leaflet's docs.
My biggest reason for that was been able to send a lot of route control points (about 140h+)
Well, I've tried with all sorts of points count but none of them work.
I am not even sure if Control Points are meant for the thing that I am looking for.
Well, the thread might be going off-topic so feel free to move the questions to another one.
I have made a screenshot with what I have currently (it would be easier for me to explain my goal). Here it is:
The purple line is the route and the blue polylines is the network my route SHOULD try to follow as close as possible. Currently, when I try with passing the control points, the purple line (the route) stays the same. Any suggestions/algorithms I could use?
Here is the link to the image (last post is not showing it for me):
http://s29.postimg.org/xx9nwer39/heavy_capture.png
Here is the sample route request:
directions.route({
locations: latLngs,
options: this._defaultDirectionOptions,
routeControlPointCollection: [{
lat: 51.173496,
lng: 4.425789,
weight: 0.1,
radius: 20
}]
});
The hardcoded control point is really close the point A but it's still not altering the road. I've tried with countless combinations of weight/radius - still nothing.
I really like the idea about getting rid of the distant coords with a layer bounds but I first need to know that the control points feature is working.
Well that was a silly mistake! Thanks!
I am still using alot of points and the app is doing just fine!