How to Set Map Zoom Settings to 20 - Skobbler map - swift

I want to zoom in on the map as much as possible when the app starts.
Right now, I can zoom in only to level 16, and then I have to manually pinch to zoom even more.
SKRoutingService.sharedInstance().mapView?.animateToZoomLevel(16.0)
What I've tried but didn't work out was to set up mapZoomLimitmax to 20.0:
SKRoutingService.sharedInstance().mapView.settings.zoomLimits.mapZoomLimitMax = 20.0
SKRoutingService.sharedInstance().mapView?.animateToZoomLevel(20.0)
But that didn't work.
I see the entire planet Earth after I do this.
I know that there must be a way for zooming in more than level 16, because I can pinch-to-zoom after I zoom it in on level 16 programatically.
How can I achieve that?

The max zoom level is 18.999001 (although in the SkDefinitions header file it's indicated that kMaximumZoomLimit has a value of 19.0f I found that setting the zoom level to 19.0 did not really work, whereas 18.999001 worked).
At most what you can do is:
mapView.animateToZoomLevel(18.999001)
The mapZoomLimitMax should be 19.0 (leaving this property untouched also worked in my case). Setting it to higher values won't change anything.

Related

How to control what markers are displayed by mapbox-gl-js

I am loading a bunch of geojson points. I can see that I am loading about 40 points but which ones get displayed on my map seems random and somehow connected to the zoom level. Below you can see that only 2 points of ~40 are displayed.
What criteria does mapbox-gl-js use to decide what to display?
Is there a way to control what points are being displayed? (All of them? Some based on an attribute?)
This is likely occurring because you are using the default text-allow-overlap value of false. The text-allow-overlap documentation reads
If true, the text will be visible even if it collides with other previously drawn symbols.
Because your symbols overlap each other, some are hidden. You can disable this behavior by setting text-allow-overlap to true.
You might find marker clustering to be useful.

Rendering OpenStreetMap in OpenLayers 3 with more detail and higher DPI

I'm using OpenLayers 3 and OpenStreetMap to print maps on paper, and for this I'd need to render the maps with more details and higher DPI than are shown on the screen. I'm using CSS to set the size of ol.Map's target in centimeters to the desired size for the printout (.map { width: 7cm; height: 6.3cm; }).
By default OpenLayers shows one of my maps like this, which is too low detail for my needs:
By changing the map size with map.setSize(map.getSize().map(function (x) { return x*2; })); I'm able to increase the detail closer to what I need:
But the problem with this hack is that when the window is resized, the size is reset and it will look wrong like this:
How would I be able to control the OSM zoom level and map DPI independently of the map's size on screen to achieve the desired outcome (the second picture) reliably?
A solution I've found is to put the map inside two nested divs. The inner one has, for example, width: 200%; height: 200%, and the outer one would have transform: scale(.5) translate(-50%,-50%);. This would double the resolution the user sees.
This approach changes the pixel zoom level relative to the zoom level on screen. However, it needs to be recalculated and updated whenever the user zooms the map.

ios-charts - problems using autoScaleMinMaxEnabled

I try to auto scale the y-axis for an LineChart. If I set the option autoScaleMinMaxEnabled, followed by an notifyDataSetChanged no auto scale occurs.
Also toggeling autoScaleMinMaxEnabled in ChartsDemo seems not to work. Is there a special trick?
Many thanks! - Tino
The "trick" is that min/max of the Y-axis is determined dynamically, during scrolling, depending on the y-values that are contained in the visible x-range.
If you want to see it working in the demo, then zoom in, enable autoScaleMinMaxEnabled, and then scroll to the right. Watch the Y-axis.

Leaflet.js fitBounds with padding?

I'm trying to set the fitBounds option in a leaflet map like this:
var bounds = new L.LatLngBounds([[Math.max(lat, borneLat), Math.max(lng, borneLng)], [Math.min(lat, borneLat), Math.min(lng, borneLng)]]);
map.fitBounds(bounds, { padding: [20, 20] });
However this doesn't seem to add any padding ? at least the map "zoom level" doesn't change, and it's always showing the two points in the edges (i.e. one is top far right and the other is bottom far left). For some marker sets, it works ok, the zoom is at a decent level away and you can see everything nicely. However when the items are quite close to each other, it seems it zooms in a bit too much unless I can fit it with some "padding."
Also I'm unsure if the bounds would be correct like that? Should I use instead just:
var bounds = [[Math.max(lat, borneLat), Math.max(lng, borneLng)], [Math.min(lat, borneLat), Math.min(lng, borneLng)]];
map.fitBounds(bounds, {padding: []}) should work. I suggest you to change padding to eg. [50, 50], maybe your padding values are too small.
Check out this JSFiddle example.
Leaflet only zooms between integer-value zoom levels by default. Past version 1.0.0, "fractional zooms" are available with the "zoomSnap" parameter:
var map = L.map('map', {
zoomSnap: 0.1
});
This will allow smaller padding values to be visible, but will also affect scrollWheelZoom behavior.
I came across this problem. As I understand the padding is controlled by the zoom. In my example all padding settings under 10 make no difference. As soon as the padding goes to 10 the map is zoomed out one level and there is padding. Furhter increasing the padding value has no influence, until it is so big that another zoom-out level is reached.
FWI, you can also set a max zoom level to the map like so:
var map = L.mapbox.map('map', 'mapbox.emerald', {
maxZoom: 16
});
this way you can avoid the map zooming in too much in case the markers are too close togther.

Slider settings for GPUImage

I'm making an app which allows the user to apply GPUImage filters to still photos using a UISlider. I'd like for the slider to initially start at the zero point for each filter (i.e. the value at which none of the filter has been applied yet) and I'm wondering how this can be determined? I've used some of the values that are listed in the GPUImage documentation and for certain sliders they start at 0, but others it's hard to determine (and for some, the min and max values are way off for me). The values for something like GPUImagePosterizeFilter seem to be way off for me (set min to 1, max to 128 and initial to 1). I've also checked some of the values in the FilterShowcase test project which are different than the documentation, but still don't always start at 0. Am I just completely missing the point here? Or is there some setting I maybe have to turn on to be in line with the slider values?
Nope, no setting for this. All I can really recommend is that to make this as efficient as possible make a switch statement in a single method and determine what to do by index of the currently selected filter.
From there, I would leave the min/max values of the slider the same so that you don't have to animate from one calculated point to another if the filter changes and mathematically convert the slider's value into units that the current filter understands. i.e. 0-1 --> 1-128
I think I might have been approaching this the wrong way. Rather than looking for a "zero point" on a filter, I think I should focus on applying the filter only when the user applies it, and trying to find a good starting point that is close to how the image looks without the filter for the initial value on the slider.