0

How can I zoom map to include all marker point into visible area?

I have an array of points, was trying to configure BoundingBox(), but have no idea how to set/find southWest and northEast values from [YMKPoint].

.cameraPosition(with: .init(southWest: ?, northEast: ?))
burnsi
  • 6,194
  • 13
  • 17
  • 27
Artem
  • 1

1 Answers1

0

I do not have a ready code for you, but hope this will help.

As you have an array of all the [YMKPoint] from that array you need to filter all the points which belong to the southWest zone & northEast zone.

See below statement that will help you to filter the points:

Latitude: Positive values indicate north latitude and negative values indicate south latitude.

Longitude: Positive values indicate east longitude, and negative values indicate west longitude.

After filtering the array based on two zones, you need to sort the array based on the points which is far for both the zones southWest & northEast.

Once array is sorted you will be able to create a BoundingBox by selecting first point from both the sorted array of zones.

See this image to understand how the co-ordinates are placed on the map using a graph.

See this image to understand how the co-ordinates are placed on the map using a graph.

Samir Bagaria
  • 130
  • 1
  • 10