We want to get shipping rule by Territory from Customer Territory

We want to create shipping rule by city using territory in shipping rule we have to match the territory from customer and shipping rule. Apply shipping rule in sales order by matching the territory and get the shipping rule apply.