Zaid Alissa Almaliki
1 min readAug 8, 2019

--

Lat long coordinates have a problem that they are 2 features that represent a three-dimensional space. This means that the long coordinate goes all around, which means the two most extreme values are actually very close together. I’ve dealt with this problem a few times and what I do in this case is map them to x, y and z coordinates. This means close points in these 3 dimensions are also close in reality. Depending on the use case you can disregard the changes in height and map them to a perfect sphere. These features can then be standardized properly.

To clarify (summarised from the comments):

x = cos(lat) * cos(lon)
y = cos(lat) * sin(lon),
z = sin(lat)

check this response https://datascience.stackexchange.com/questions/13567/ways-to-deal-with-longitude-latitude-feature/13575

--

--

Zaid Alissa Almaliki
Zaid Alissa Almaliki

Written by Zaid Alissa Almaliki

Data Engineer, LinkedIn and Twitter Top Voice. Contributing to leading platforms like Towards Data Science.

No responses yet