mapbox-gl-geocoder icon indicating copy to clipboard operation
mapbox-gl-geocoder copied to clipboard

support coordinates as either Array or Object

Open jayenashar opened this issue 4 years ago • 2 comments

bbox is an array of [x, y, x, y]. proximity is an object of {longitude, latitude}.

why not make them both arrays of [x, y, x, y] or [x, y]?

jayenashar avatar Jun 24 '20 16:06 jayenashar

I'd be happy to see these inherit GL JS's LngLatLike and LngLatBoundsLike so both array or object are accepted interchangable.

This wouldn't be a breaking change because both as an Array and Object would be accepted.

andrewharvey avatar Jun 25 '20 00:06 andrewharvey

so apparently an array is supported, but it's not documented. _geocode converts it to an array if the documented object is provided.

if (key === 'proximity' && self.options[key] && typeof self.options[key].longitude === 'number' && typeof self.options[key].latitude === 'number') {
  config[key] = [self.options[key].longitude, self.options[key].latitude]
}

jayenashar avatar Oct 26 '20 02:10 jayenashar