# Detect geolocation match a GeoJson pattern

I'm trying to detect if a geolocation (lat, lng) match a GeoJson pattern. As example i have line of location points and i want to detect if a new point can match that pattern in certain radius, like 10-20 meters.

I've heard that KMeans can do the work, but I'm not so sure. Also time-series.

What do you think? Can one of those approaches can do the trick?

Thanks!

The best method would be to calculate the Haversine distance between the new point and the GeoJSON object (Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon). Haversine distance is the great-circle distance over the surface of a sphere between two points.

No.

Clearly this is not a clustering problem, nor a dynamic time warping problem.

Instead, what you are looking for is nearest edge search.

Depending on how many datapoints your pattern has and how often you have to do it the easiest way might be a brute force approach and just calculate the distance of all points and check if the minimum is in reach. If your input data is to sparse you could also create first interpolate points to have a decent density of points.

Assume that you have enough gps data to form a pattern.

1) Get the road pattern by using regression analysis

2) Check whether the new point is fit into the pattern.

3) Get the nearest road gps & calculate the distance between 2 location.

• Is just a LineString. I don't have enought data. – Florescu Cătălin Nov 21 '19 at 8:37

This is not an unsupervised learning problem, so k-means or other clustering techniques will not be helpful. In the world of statistical learning techniques, I would rather recommend a semi-supervised approach for one-class classification problems (PU learning), because you have patterns that can be learned as the primary class ("in the pattern"), and data to classify into "in" or "out of" the pattern.

I don't know so much about such techniques, but anyway it feels like they may be too complicated for your case, and would involve somehow computing distances between the new point to classify and the patterns. So if it is not too computationally expensive, you should probably simply calculate the minimum distance to the pattern and see if it is within the expected range.