You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Displaying Coordinates of a number of places together in Map
For displaying map, we use react-map-gl pkg which is a react friendly API wrapper around MapboxGL JS.
Since, this Map component, can take in only 1 lat and lng but we had an array of lat and lng, to solve this problem, we use geolib pkg's getCenter function, which takes an array of lat and lng and returns a single lat and lng representing the center of the given array of lat and lng.
Finally we pass, this centered coordinate, which ensures our map is centered around all the coordinates.
About
Airbnb clone with Calendar to pick date range and displaying Map using Mapbox and data coming from Contentful CMS.