What are the alternatives for edgePadding

Viewed 17

As edge padding is only supported in google maps. Can anyone suggest alternatives of edge padding because i am unable to fit markers in screen. Attaching screenshot for referenceenter image description here.

1 Answers

Ahh , so basically you need to play with latitudeDelta and longitudeDelta ,

Ive done it with that to add some breathing space in the map route

THe below one gives a pretty good delta ,and some space for your map>

DO lemme know if this works

export function getRegionForCoordinates(points) {
  // points should be an array of { latitude: X, longitude: Y }
  let minX, maxX, minY, maxY;

  // init first point
  ((point) => {
    minX = point.latitude;
    maxX = point.latitude;
    minY = point.longitude;
    maxY = point.longitude;
  })(points[0]);

  // calculate rect
  points.map((point) => {
    minX = Math.min(minX, point.latitude);
    maxX = Math.max(maxX, point.latitude);
    minY = Math.min(minY, point.longitude);
    maxY = Math.max(maxY, point.longitude);
  });

  const midX = (minX + maxX) / 2;
  const midY = (minY + maxY) / 2;
  const deltaX = (maxX - minX);
  const deltaY = (maxY - minY);

  return {
    latitude: midX,
    longitude: midY,
    latitudeDelta: deltaX,
    longitudeDelta: deltaY
  };
}

Related