How to stop user seeing gray grid?

676
3
12-18-2017 09:34 AM
NikolayYekimov
New Contributor II

Attaching a screenshot of map being zoomed out to min level so the whole world map is visible. Also a gray grid is visible. I want to stop user seeing the gray grid similar how google maps handles it. However can't see any easy way. If I set explicitly AGSMap.minScale, then I have to check every device to choose appropriate scale and still user can pan to north/south and see the gray grid. 

I read that in 10.2 AGSMapView.maxEnvelope was helping with this by allowing to provide xmax ymax xmin ymin but there is no replacement in 100.0. What is about 100.1? Is there any workaround except listening to pan/zoom KVO and when user goes out of bounds scale him back? This sounds like a bad UX pattern.

Tags (1)
0 Kudos
3 Replies
MarkDostal
Esri Contributor

Thank you for your question.  As you stated, there currently is no "maxEnvelope" or "maxExtent" property on either the MapView or the Map in 100.1 or the latest 100.2 release.  This is something that is under discussion for a future release.

I know it's not optimal, but it is possible to customize the display of the background grid to your liking.  See the "backgroundGrid" property on AGSMapView.

Mark

0 Kudos
RajHole0077
New Contributor

@MarkDostal How to achieve this in iOS ?

0 Kudos
MarkDostal
Esri Contributor

You can use the "backgroundGrid" property on "MapView".  It is an object of type "AGSBackgroundGrid".  You can see it in action in the iOS Sample App here.

Here's the relevant code:

// Create a background grid with default values.
let backgroundGrid = AGSBackgroundGrid(color: .black, gridLineColor: .white, gridLineWidth: 2, gridSize: 32)
// Assign the background grid to the map view.
mapView.backgroundGrid = backgroundGrid

Let me know if you need more help! 

0 Kudos