Calculating distance using MySQL

Calculating distance using MySQL” is a very useful blog post for everyone who works with geographical location data and MySQL. It shows a simple example of how to calculate the distance between two coordinates on a sphere (Earth in particular) within the MySQL itself.

SELECT ST_Distance_Sphere(
    point(-87.6770458, 41.9631174),
    point(-73.9898293, 40.7628267)
);

The above will return 1148978.6738241839, which is the distance between the two points in meters.

This functionality is available since MySQL 5.7. Have a look at the documentation of the spacial convenience functions.

MariaDB has similar functionality, but with a slightly different function names. Use ST_DISTANCE() instead of ST_Distance_Sphere(). Have a look at this blog post for more details.

GDPR cookie scanner

I came across the GDPR Expert service via this HackerNews thread. It is a service that helps website owners with the GDPR compliance. Behind the scenes, there is this open source tool, which scans for cookies and provides the details about the vendor and purpose of each identified cookie. The database includes more than 10,000 known cookies.

Very handy.