routexl / routexl-api-connector Goto Github PK
View Code? Open in Web Editor NEWPHP and Javascript examples to connect to the RouteXL routing optimization API
Home Page: https://www.routexl.com/
PHP and Javascript examples to connect to the RouteXL routing optimization API
Home Page: https://www.routexl.com/
If returned info is not json then nothing wont show up
// Decode the output
if(json_decode($output)) {
$this->result = json_decode($output);
}else{
$this->result = $output;
}
Has anybody already achieved to convert this funky JSON into an object?
{"id":"4T4446Pj","count":4,"feasible":true,"route":{"0":{"name":"The Hague, The Netherlands","arrival":0,"distance":0},"1":{"name":"The Hague, The Netherlands","arrival":5,"distance":3.9},"2":{"name":"Uden, The Netherlands","arrival":93,"distance":137.1},"3":{"name":"Sint-Oedenrode, The Netherlands","arrival":112,"distance":160.5}}}
All converts I know create some very creative objects like this:
public class __invalid_type__0
{
public string name { get; set; }
public int arrival { get; set; }
public int distance { get; set; }
}
public class __invalid_type__1
{
public string name { get; set; }
public int arrival { get; set; }
public double distance { get; set; }
}
public class __invalid_type__2
{
public string name { get; set; }
public int arrival { get; set; }
public double distance { get; set; }
}
public class __invalid_type__3
{
public string name { get; set; }
public int arrival { get; set; }
public double distance { get; set; }
}
public class RootObject
{
public __invalid_type__0 __invalid_name__0 { get; set; }
public __invalid_type__1 __invalid_name__1 { get; set; }
public __invalid_type__2 __invalid_name__2 { get; set; }
public __invalid_type__3 __invalid_name__3 { get; set; }
}
This of course works when I know that I expect 4 route elements. What about n elements?
How about add more examples with service time and time window restrictions?
I can not understand how create valid api request with restrictions.
There is a violation in the line document.write(result);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.