Skip to content
Advertisement

All possible points of (latitude,longitude) from latitude/longitude coordinates in separate arrays

I have latitude and longitude coordinates in two separate arrays:

JavaScript

How can I easily find all possible points made up of these coordinates?

I’ve been messing around with itertools.combinations:

JavaScript

but this doesn’t work for me because the points (71,75) and (43,42) are latitude/latitude and longitude/longitude pairs.

What I would like to have is this:

JavaScript

The a and b arrays will eventually be of a larger size but will be kept the same size as they are latitude/longitude pairs.

Advertisement

Answer

What you want is itertools.product():

JavaScript
Advertisement