Comments (10)
This would be great — there's a lot moving in the Mapbox GL Camera API right now (mapbox/mapbox-gl-js#2801); we should do this after that lands (as it is, mapbox-gl-geocoder uses different camera methods depending on the result).
from mapbox-gl-geocoder.
Well this is travelling further down a rabbit hole but you can infer from the source code that it actually fits to bounds if the address is less specific and zooms to fixed zoom if it's more specific.
from mapbox-gl-geocoder.
Oh! we should keep this open. I think we should totally pass flyTo
options over!
from mapbox-gl-geocoder.
That was a bit of an oversight on my part. flyTo
should pass on the options available in https://www.mapbox.com/mapbox-gl-js/api/.
As an interim solution you can set flyTo: false
, listen for the result and write your own map.flyTo
.
var geocoder = new mapboxgl.Geocoder({
flyTo: false
});
geocoder.on('result', function(e) {
var result = e.result;
map.flyTo({
// Pass result and custom animation
});
});
from mapbox-gl-geocoder.
@tristen Thanks for the reply, seems to work now. Only problem that I have now is that with the standard geocoder it zooms further if the address is more specific. How should I add this to the custom animation? Do you have any suggestions for this.
from mapbox-gl-geocoder.
@tristen Great, thanks for the help.
from mapbox-gl-geocoder.
Oh! we should keep this open. I think we should totally pass flyTo options over!
Agreed, for my use case it would nice to reset the pitch to 0 by simply passing it as an option to flyTo rather than rolling my own on result event handler.
from mapbox-gl-geocoder.
With #214 in mind, slated for v4.
I think we should try to decide if those flyTo options are also applied when fitting the map to a geocode bbox.
mapbox-gl-geocoder uses fitBounds
when a bbox is found, and fitBounds
also supports GL JS CameraOptions and AnimationOptions https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds
from mapbox-gl-geocoder.
👍 didn't realize these properties were available on the fitBounds method was well. I think we should pass any custom camera/animation options to the fitBounds calls as well.
from mapbox-gl-geocoder.
This was done in a combination of #227 and #214. It will be available once version 4 is released.
from mapbox-gl-geocoder.
Related Issues (20)
- is there not a way to test geocoder in a jest mock?
- Geocoder flies to wrong location when using the `naturalEarth` projection HOT 2
- Geocoding mapbox.places HOT 1
- MaxListenersExceededWarning: Possible EventEmitter memory leak detected. HOT 1
- EventEmitter is not a constructor at new MapboxGeocoder (Next.JS & TypeScript) HOT 2
- 422 Error When Using External Geocoder and Mapbox GL JS
- espagnol
- reverseMode option type is unclear
- mapbox-gl not working with Vite HOT 1
- https4 no longer supported
- When retrieving the location: There was an error reaching the server / 检索位置时候出现:There was an errorreaching the server错误
- Mapbox geocoder [map.addControl(geocoder);] distorts in WordPress
- error: query must be an array with 2 items
- Autofill: Wrong suggestion is being selected HOT 7
- Geocode does not work with SwiperJS
- Padding and margin issues at bottom-right. Increasing the viewport size and pushing the copyright down. HOT 1
- Accessibility: search suggestions menu is not accessible to screen readers and has unexpected keyboard behavior (fails WCAG criteria) HOT 5
- Peer Dependency <3.0.0 mapbox-gl-geocoder with 3.0.0 beta or rc HOT 2
- npm install Error HOT 1
- Bug: function SetInput() when option showSuggestions is set to false, it still shows the suggestions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-gl-geocoder.