Back in Bing Maps v7, if you dragged the route to the edge of your map, it would move the map in that direction. This saves the user from having to drop that route marker, move the map themselves, and then pick back up the marker to continue altering the route to meet their needs. For example, if you go to https://www.bingmapsportal.com/isdk/ajaxv7#DirectionsModule2, you will be able to try out this functionality. However, if you go to http://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk#directionsGetRequestOptions+JS, you will not see the map move as you drag the route to the edge of the map.
I have looked at the api for directionsRenderOptions (https://msdn.microsoft.com/library/mt750365.aspx) and directionsRequestOptions (https://msdn.microsoft.com/library/mt750373.aspx), but I don't see anything that seems related to being able to move the map as you drag a route. Any help would be much appreciated.
I don't believe this is a scenario that will be supported in V8. Not sure if this is something that can be easily added as all the rendering happens on an HTML5 canvas in V8 and is re-rendered when it moves. Will add a feature request for this for the team to look into.
Related
Fairly new to Mapbox and getting there (slowly).
I have a map initially loaded at zoom level 1 for use in a web browser. When a user clicks on a marker, it'll center and zoom to level 10.
When that marker loses focus, I'd like to zoom back out to level 1.
This page discussing web applications does it (link below), but there doesn't seem to be (that I can find - sorry!) any documentation on how to achieve this.
https://docs.mapbox.com/help/getting-started/web-apps/
Any and all help appreciated!
For the first event, to zoom in when clicking a marker, you could adapt this example to zoom in addition to panning when calling flyTo
https://docs.mapbox.com/mapbox-gl-js/example/center-on-feature/
For the second part, you'd need to add a listener for another event depending on what you have in mind by "losing focus".
https://docs.mapbox.com/mapbox-gl-js/api/map/#map-events
I have recently implemented the flutter plugin called flutter_map, using the Mapbox tiles, and would like to know how you guys manage to count the network requests for the Static Tiles. Is it supposed to make a request for every move (zoom in, zoom out, move around, etc.) on the map itself? Is that the intended functioning or is there a way to diminish the number of requests made?Amount of requests made after zooming/panning
Is it supposed to make a request for every move (zoom in, zoom out, move around, etc.) on the map itself?
Yes indeed. The package supports static raster tiles, which means they must be re-downloaded if they change - such as on move or zoom events.
There isn't much in the way you can do about this, as it's a kind-of standard. This is why you'll find a similar thing in other mapping libraries, such as Leaflet.js and others.
See https://docs.mapbox.com/api/maps/static-tiles/ for potential ways to reduce costs whilst maintaining standards.
I am developing a weather radar viewer using Mapbox. In a certain mode, there are 2 Mapbox maps on the screen at the same time showing different modes of the radar. The maps are locked to each other. When one map moves, rotates, or pans - the other one does as well. I did this by simply passing the properties of one map to the other. In the below screenshot, you will see how they are showing identical locations.
What I want to do is - when the user is hovering the mouse over "map1", I would like an identical (ghost or false) cursor on "map2". Here is what I am looking to do:
(edit: What you are looking at is an actual screenshot. Each map is enclosed in a DIV with 50% width of the screen, if this helps to explain)
I don't know if this is even possible in Mapbox. Hopefully someone can give some guidance as I can't find any other questions related to this and I really have no code to show without knowing where to start.
If you attempt to do this inside Mapbox-GL-JS (for instance, by constantly updating the location of a GeoJSON feature layer), I think the performance will be pretty poor.
But since the two views are exactly locked (and presumably the exact same dimensions), you can just do this at an HTML/CSS level. Detect mouse movement on the first map, and update the location of an absolutely-positioned element hovering over the second map to match.
Another approach would be using a canvas element overlaid over the second map, similarly updated.
I have several GeoJSON features on the map and wonder if leaflet could notify me when I am over a feature. I think that's geofencing?
Yes, and there is nothing very complicated to implement it.
What do you mean by "I am over a feature"?
If you mean your mouse pointer or a kind of marker / point that represents your current position, you would simply need a plugin like leaflet-pip to determine which features contain your position, if any (react on map"mousemove" event for the mouse).
If you mean the current map view intersects some of the features, that would be slightly more complex, but still easily solved through another library like turf. Look for turf.intersect method. You would need to iterate over all your features, checked against a rectangle built from the current map view (probably something like: L.rectangle(map.getBounds()).toGeoJSON()).
Am working on a project where we have a Bing map being resized depending on whether or not a panel is shown/hidden on the left-hand side of the map. Because of this, and Microsoft's terms preventing overlaying anything over the logo/copyright, etc, I'm using the VEMap.resize method to resize the map, and then am moving the panel out of the way. The issue is that there's an awkward autopan that occurs as part of the resize - because we're declaring a center point to determine the resize, the map pans to include this point in the center without any control over it. Without declaring a center, the map doesn't pan, but it also doesn't pull the new data (map tiles) in our resize in either, resulting in an awkward grey bar on the right-hand side..
Is there a simple way to either resize the map and disable that autopan, moving the center prior to the panning, or to force the map tiles to be rendered upon the resize itself? Any help would be appreciated.
You may want to try the new version 7.0 as you could get rid of this annoyance by using "map.setView({center: map.getCenter(), animate:false})" after resizing; that should override the nice but annoying pan movement on resize.
However there are a few features (like infoboxes or client-side clustering) currently missing in 7.0 when migrating from 6.3 however and the classnames changed, so you may want to wait for now, however it would be the good moment to prepare yourself for 7.