#### Topic: Algorithm of selection of geocoordinates from an array (no database)

It is given: there is a big array of geocoordinates of points and polylines

``````Poi: array [0. 1788500] of Double = (68.94989, 33.10013, 69.00689, 33.08681....);
Polyline: array [0. 508300] of Double = (69.02257, 33.0729,69.02223, 33.0729,69.02223, 33.07318,69.02257, 33.07318,69.02257, 33.0729,0....);``````

Question: it is necessary to select as fast as possible array points entering in BoundingBox (for example: [68.0,32.0,70.0,34.0]) current view pane
Implementation variants:
1. Now I do it by search and comparing of entrance of coordinates in area, it slowly.
2. It would be possible to use  coordinate system used in OSM, Google, Yandex. I.e. to group all coordinates on x, y . And to check entrance of coordinates  in demanded BoundingBox. It works faster, but I need to rotate still a card, at such approach square-topped  the approach loses the meaning (probably all noted that in the core in web cards there is no rotation).
Current tests are led in Delphi, but it is not basic, the possible algorithm of creation of system of an indexing interests, I do not know as it it is possible to name.
Thanks.

#### Re: Algorithm of selection of geocoordinates from an array (no database)

xMailer wrote:

1. Now I do it by search and comparing of entrance of coordinates in area, it slowly.

It is a high time to esteem the third volume of the Whip.

#### Re: Algorithm of selection of geocoordinates from an array (no database)

wrote:

but me it is necessary to rotate still a card, at such approach square-topped  the approach loses the meaning

does not lose, rotation is a simple transformation and it is possible to do the reverse
Instead of "to check entrance of coordinates  in demanded BoundingBox" on idea at you the partial intersection  and  BoundingBox should be checked at least, and then all the same be checked hit in it of a specific point
Taking into account turn on the arbitrary corner it will be just necessary to check intersection with BoundingBox a circle described around  (or is easier - center hit  in a bit expanded BoundingBox where the side ,  on a root from two is a little

#### Re: Algorithm of selection of geocoordinates from an array (no database)

Guys, explained all, many thanks!!!

#### Re: Algorithm of selection of geocoordinates from an array (no database)

After quad-tree it is possible to esteem about r-tree.