Extent bounds not respected on zoom - openlayers-3

I came across a strange ol3 behaviour using the extent property of the ol.View to restrict the map navigation bounds.
To reproduce the error you should create a Map with a limited extent of the ol.View, like this..
var map = new ol.Map({
layers: layers,
target: 'map',
view: new ol.View({
center: [-10997148, 4569099],
extent: [-13884991, 2870341, -7455066, 6338219]
})
});
Here an example with a modified version of the "WMS custom tile grid 512x256" example on jsfiddle [ http://jsfiddle.net/dpynhg67/1/ ]
The extent is limited to the US, follow this steps to reproduce the bug:
Zoom out to see also the europe
Position the pointer somewhere in europe and zoom in with mouse wheel (you will be able to zoom outside the extent)
As soon you try to pan, the view is moved to the extent configured in the View
Is this the wanted behaviour of the map?
Do you have any suggestion on how to force the View to the extent?
Because as I remember OL2 behaved differently, while zooming the map was also panned to respect the extent.

The issue you observed should be fixed now. The first release with the fix will be v3.21.0. The related ticket with links to the pull requests that fixed the bug is #5824.

Related

Disable interim tiles for tile layer

When creating a map like this:
var map = new ol.Map({
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true
})
OpenLayers 3 uses interim tiles (i.e., previously loaded lower resolution tiles) when zooming and panning until it has finished loading the new tiles.
The interim tiles are placed behind the real tiles. Which is very clever, and is great for opaque layers, but much not so great for mostly transparent layers.
We currently have a layer which consists of just a few lines, only a few pixels think. Slightly panning the map makes these into huge blobs, causes a lot of flicker.
Is there a way to disable creating of these interim tiles, just for a specific layer? It would be disappointing if I'd need to disable both loadTilesWhile* properties just because of a single layer.
For an example, see: http://imgur.com/RbtmkpT
The left is normal (the red line is mine), right is after panning slightly.
This is with cacheSize 0 on the source and useInterimTilesOnError false.
Update:
OpenLayers 3.12 behaves differently. In that version, only unloaded tiles are blurry (which is to be expected), but already loaded tiles are left alone. Starting from 3.13 or 3.14, this behavior changed.
See my pull request in the OpenLayers GitHub repository for a solution / workaround:
https://github.com/openlayers/ol3/issues/5251#issuecomment-212322292

OpenLayer3 overlays displayed only on one map

Im working with OpenLayer3 nad overlays. I created a few of them but when I zoomed out ( a few world maps are displayed), the overlays are displayed only on one one world map. But on the others world maps, they are not displayed.
How to fix it?
This is currently a limitation in OpenLayers 3 - vector layers do not support wrapping the world. A workaround would be to configure your tile layers to not wrap the world, using the wrapX: false config option.
wrapX, is now part of the current release of OpenLayers (v 3.2.0).
So if you want your layer to prevent multiple worlds. Just put it on your layer-source. See the example below:
tileLayer = new ol.layer.Tile({
source: new ol.source.OSM({
wrapX: false
})
});

MapBox Marker Size on Zoom (ios sdk)

I'm trying to change the size of the marker image during a zoom event, so the image scales nicely while pinching/zooming.
I can't find anywhere how to do this, the closest I have come is to resize the marker image after the zoom event is completed (when the zoom level changes)
It would look a lot nicer if it would resize during the zoom event instead of after.
Any ideas?
Look into using RMMapLayer directly (RMMarker's superclass) which should scale when zoomed. RMShape and RMCircle are also a good, albeit not directly related, models for this since they represent shapes that "stick" to the map instead of points that don't scale. But the short answer is there is not built-in functionality for this.

ios sdk MKMapView overlapping pins?

I have map view and many pins on it.
When the map view is zoomed out, I group overlapping pins into 1 (and show in label total count of pins in it).
But what to do, if map view is max zoomed in, and pins are still overlapped?
How can I shift them while they do not overlap each other ?
Something like this:
Or is there another solution?
In a slightly different solution to the same problem, the demo in the WWDC 2011 #111 - Visualizing Information Geographically with MapKit video (the demo is a little more than 18 min into the video) illustrates an example of how you can prevent overlapping annotations (including some nice animation revealing and hiding more detailed annotations as you zoom in and out).
What they do is to break the mapview into a grid of a particular size (I think they use 60px), and if they are too close, they pick one for that grid and hide the others. They also do a graceful hiding of the annotations as you zoom out (so you can see the annotations that are being hidden fly into the visible annotation for that group). As you zoom in the annotations are unhidden, you see it fly out of the one central annotation for that grid.

LocationToViewportPoint issue

I have an issue with this where LocationToViewportPoint for Bing Maps is calculating based on current viewport of the map as opposed to calculating the target viewport point.
The reason is because if the user is panning/zooming the map, this method will return inconsistent results.
I've tried reflecting this method but to no avail, does anyone have any more insight on how to solve this problem?
Solved this:
What I had to do was turn off the AnimationLevel for (panning/zooming) and explicitly SetView to the target bounding rectangle and then performed whatever calculations I needed to calculate the Map's new center point.
I then changed the AnimationLevel back on and then setting the new Map's center point for the map to zoom/pan to.
Apparently the LocationToViewportPoint had a dependency on AnimationLevel and "current" view.

Resources