Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Qlik Community,
I have tried unsuccessfully to get GeoConnection Routes to work with my live data, so I decided to use a sample set of data, and still cannot get it to build routes. Here is the error I am getting and the small sample code I am now using:
// Step 1: Load minimal test data
GeoCustomer2Test:
LOAD
GeoCustomerSID,
Text('40.7128,-74.0060') AS CustomerGeoPoint, // New York coordinates directly as string
Text('34.0522,-118.2437') AS WarehouseGeoPoint // Los Angeles coordinates directly as string
INLINE [
GeoCustomerSID
1
2
];
[DistanceTestTable]:
LOAD * Extension GeoOperations.ScriptEval('
SELECT _autoIndex_, Distance, Status
FROM Distance(originField="WarehouseGeoPoint", destField="CustomerGeoPoint")
DATASOURCE dataset INTABLE crs="auto", pointField="CustomerGeoPoint"
', GeoCustomer2Test);
Anyone have experience with this?
Thanks in advance,
Mike
Hi ASC-Mike,
You should change the datetype of the fields, using GeoMakePoint. Storing the fields as text is causing the issue.
Solution:
// Step 1: Load minimal test data
GeoCustomer2Test:
LOAD distinct
GeoCustomerSID,
GeoMakePoint(40.7128,-74.0060) AS CustomerGeoPoint, // New York coordinates directly as string
GeoMakePoint(34.0522,-118.2437) AS WarehouseGeoPoint // Los Angeles coordinates directly as string
INLINE [
GeoCustomerSID
1
2
];
[RoutesResultTable]:
Load * Extension GeoOperations.ScriptEval('
SELECT _autoIndex_, Distance, Duration, Status, LowResLine, dataset.WarehouseGeoPoint, dataset.CustomerGeoPoint FROM
Routes(criteria="fastest", transportation="car", destField="WarehouseGeoPoint", geometryType="point")
DATASOURCE dataset INTABLE crs="auto", pointField="CustomerGeoPoint"
', GeoCustomer2Test);
Hi ASC-Mike,
You should change the datetype of the fields, using GeoMakePoint. Storing the fields as text is causing the issue.
Solution:
// Step 1: Load minimal test data
GeoCustomer2Test:
LOAD distinct
GeoCustomerSID,
GeoMakePoint(40.7128,-74.0060) AS CustomerGeoPoint, // New York coordinates directly as string
GeoMakePoint(34.0522,-118.2437) AS WarehouseGeoPoint // Los Angeles coordinates directly as string
INLINE [
GeoCustomerSID
1
2
];
[RoutesResultTable]:
Load * Extension GeoOperations.ScriptEval('
SELECT _autoIndex_, Distance, Duration, Status, LowResLine, dataset.WarehouseGeoPoint, dataset.CustomerGeoPoint FROM
Routes(criteria="fastest", transportation="car", destField="WarehouseGeoPoint", geometryType="point")
DATASOURCE dataset INTABLE crs="auto", pointField="CustomerGeoPoint"
', GeoCustomer2Test);
Hi @joostvanegmond7 I had the same error as mike and followed your advice by converting the latitude and Longitude using GeoMakePoint yet I am getting the same error, can you suggest me some other points that I might be missing Thanks.
Hi AnujKheria,
Is it possible to upload a Qlik Sense file with some data where the problem occurs? I could look into it then.
Joost
Hi @joostvanegmond7 I found the Issue it was actually number of cloumns and rows causing it, It was solved as I commented additional columns I had and reduced the rows.