G
G
German Zvonchuk2019-05-07 15:40:27
iOS
German Zvonchuk, 2019-05-07 15:40:27

How to find center coordinate between N-number of geographic coordinates?

Friends,
I have N-number of marks on the map, I need to find the coordinates of the middle.
I need the coordinates of the middle in order to display the map on the screen in such a way that all available marks fit on it.
I would be very grateful if you tell me how to do this.
I store the points in ElasticSearch, process them using PHP, and display them in an iOS application.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-05-07
@dollar

The X coordinate will be the arithmetic mean of all the X coordinates of your points.
Similar to Y.
I hope the principle is clear.
In fact, this is the center of mass if the points are the same, although in theory they can be given weights.
I recommend doing it in two passes.
1) First, just count the center.
2) See which points (fluctuations, outliers) are further than 1.5 of the screen, exclude them.
3) Again, consider the center based on the remaining ones - and now this will be the solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question