creating new column for distance in Km

Sorry if that made you upset, I didn’t mean anything.
Did the last formula that I provided work well then?
For determining the country, you have to use geonames.org api and then by having the distance and the country of the customer, you can use this expression in “Rule Engine” node to label the customers:

$Distance$ <= 15 AND $Country$ = "Germany" => "Local Customer"
$Distance$ > 15 AND $Distance$ <= 50 AND $Country$ = "Germany" => "National Customer"
$Distance$ > 50 AND $Country$ = "Germany" => "Online Customer"
TRUE => "Foreign Customer"

Sorry, one big mistake:
First, you have to convert the latitude and longitude values from degrees to radians by using this formula:

X * (pi / 180)

To make everything clear for you, I’ve attached the workflow (you have to change the username in api link provided in “Constant Value Column” node from “demo” to your own username from geonames.org). All the calculations are based on the assumption that the base location coordination is provided in “latitude” and “longitude” columns and the customers’ location coordination is provided in “lat” and “Lon” columns. So you can change whichever you want.

Best

Armin

customer_type.

customer_type_output

Customer Type.knwf (19.2 KB)

First of thanks alot the effort you made. I have learned a lot from you. Secondy the syntax works perfectly fine


I really appriciate your effort. Thank you have a good day.
Regards,
Q

2 Likes

Dear Qamar,

I was checking the workflow and noticed that I had a mistake in writing the formula.
I have corrected the formula and here is the workflow:
Customer Type.knwf (38.7 KB)

Also I have published a video on my Youtube channel in which I have explained the solution completely:

Best,
Armin

4 Likes

NIce one Armin :wink:
Ivan

1 Like