# How to calculate the L2 (Euclidean) and L1 (cityblock, or we say Manhattan distance) distance based on longitude and latitude?

I have several coordinate of points with longitude and latitude. For example, as follows:

22.7397142000000 113.488351100000

22.7669794000000 113.509290500000

22.7704230000000 113.507311200000

22.7669970000000 113.508321300000

22.7670235000000 113.508306300000

22.7696037000000 113.511283800000

22.7711551000000 113.508804100000

22.7711704000000 113.508833800000

22.7694847000000 113.512802400000

22.7693585000000 113.513163800000

22.7679902000000 113.518024500000

22.7691143000000 113.520290400000

22.7690086000000 113.520259300000

22.7689764000000 113.520256300000

22.7690396000000 113.520267700000

22.7692776000000 113.518461600000

22.7692416000000 113.518455000000

22.7684318000000 113.518207300000

22.7703652000000 113.514779800000

22.7708152000000 113.511255300000

22.7703001000000 113.515150400000

22.7712174000000 113.516411500000

22.7692346000000 113.516134300000

22.7715692000000 113.511309900000

22.7727208000000 113.510230300000

22.7727138000000 113.510273300000

22.7733021000000 113.508423100000

22.7729565000000 113.508392900000

22.7681272000000 113.515703800000

22.7715343000000 113.512768200000

22.7746171000000 113.508364000000

I want to calculate the L2 and L1 distance between each of them.

Q1: For L2, I use 'distance' in mapping toolbox, and deg2km to convert the value to km, I'm NOT sure whether it makes sense, or is there any other ways?

Q2: For L1, no idea if there is any command in MATLAB to do this step by step, waiting for guide and codes.

##### 0 Comments

### Accepted Answer

##### 6 Comments

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!