Function to calculate distance between two coordinates

I’m currently using the function below and it doesn’t work properly. According to Google Maps, the distance between these coordinates (from 59.3293371,13.4877472 to 59.3225525,13.4619422) are 2.2 kilometres while the function returns 1.6 kilometres. How can I make this function return the correct distance? function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) { var R = 6371; // Radius … Read more

Shortest distance between a point and a line segment

I need a basic function to find the shortest distance between a point and a line segment. Feel free to write the solution in any language you want; I can translate it into what I’m using (Javascript). EDIT: My line segment is defined by two endpoints. So my line segment AB is defined by the … Read more

Should I use px or rem value units in my CSS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. The community reviewed whether to reopen this question 6 months ago and left it closed: Original close reason(s) were … Read more