Issue with MKOverlayView - ios

We are working on MKOverlayView, below is the expected functionality:
An image has to be overlaid on the map and has to be tilted by a certain angle (bearing).
Issue: When the map is zoomed to the maximum level, one of the corners of the overlaid image is getting truncated. But, Complete image is coming back when zoom out a little bit.
Please find the attached screenshot for reference.

I'm also getting overlaying text being clipped at any zoom level. What I noticed is that it clips at some vertical invisible lines. Those invisible lines, they look like as if they were the actual map tiles.
What it still works is other overlays I have on the map, they don't get chopped.
This started to happen with iOS 10.
In the image, the building outlines –colored- are overlays that don't get clipped, but the text overlays (drawn using drawInRect) they do get chopped. Texts are Very Long text1 to see if it truncates, changing text1 for text2 and so forth.

Related

Hiding label names in MapKit when using MKTileOverlayRenderer

I am using a MKTileOverlayRenderer to render my own tiles with MapKit. In areas where my tiles don't cover, the empty grid is shown, which is exactly what I'm looking for. However, all names of places (labels of landmarks) get also shown. I would like to hide these to provide an empty space beyond the confines of my tiles.
This is how I am initializing the mapView:
let overlay = MapOverlay(map: map)
// MapOverlay is my own subclass of MKTileOverlay, map is a Swift struct including url scheme to retrieve the tiles
overlay.canReplaceMapContent = true
// I intend to have empty content beyond my tiles
tileRenderer = MKTileOverlayRenderer(tileOverlay: overlay)
mapView.addOverlay(overlay, level: .aboveLabels)
// I want my tiles to be laid over all other content
This is how it shows around the borders of my tiles in MapKit:
I know it's possible to use a placeholder tile for areas beyond the region of interest, which would cover, in principle, the empty grid and the landmark label names. This is problematic though for 2 reasons:
When zooming in/out or panning, and for the split second it takes to load the tile, it shows the content below, which is disorienting
the placeholder tile doesn't blend seamlessly with the provided tiles of the region of interest, which leaves gaps through which you can still see the empty grid and the landmark label names
For these reasons, I chose to use a transparent placeholder tile.
Is there a way to hide the landmark label names?
I couldn't find a way to prevent MapKit from showing the label names for landmarks (and the canReplaceMapContent property hides the map content but not the labels), but I figured out why covering beyond the region of interest was leaving gaps: the original tiles had transparency around the edges of the region of interest.
A way to cover the landmark label names is to provide solid color in the edges of the region of interest in the generated tiles, and use a placeholder tile with the same solid color for areas beyond the region of interest. Therefore, no code changes needed, just to regenerate the tiles with solid color around the edges.
This still has the issue of small glimpses through the map when zooming, panning, which is not great, but I can't see no way around that.

Scaling SVG past unknown threshold causes elements to disappear

I'm using openseadragon with the excellent svg overlay plugin.
On Chrome, the app behaves as expected: users can tap to zoom in until a table rendered in SVG is fully visible, the note on the table is legible.
Here's the link to the demo. Zoom out to see the SVG version of the table appear, overlaying the fuzzy raster version of the background.
On Safari on iOS or OSX when zooming past a seemingly arbitrary threshold the table and everything on it start to disappear. The point of disappearance seems to depend on other factors I don't understand, hence this question for insight. For example, a orange circle drawn with two.js will disappear when the scale transform is precisely 51201 (at 51200 the circle is there). For the more complex table SVG, elements on the table will disappear at different scale levels, between ~23000 to 50000. Sometimes they'll disappear and then reappear upon a slight zoom in. Sometimes they'll disappear on zoom and then reappear as I pan around, the objects nearing the edge of the viewport.
IE 11 has a very similar issue.
Has anyone dealt with this before or solved it?
That's a really slick project!
In my experience, that kind of problem with SVG disappearing has to do with extreme amounts of zoom. The good news is you should be able to work around it by changing your viewport coordinates. By default the width of the image is a viewport value of 1, but you can set your image to be width 10,000 or some such, which will look exactly the same on the screen, but it means that the SVG thinks it's zoomed out a lot at first, so when you zoom in you can go a lot further.
If you're using two.js, another possible fix would be to switch over to canvas rendering and use https://github.com/altert/OpenSeadragonCanvasOverlay.
Btw, I'd love to share your project when it's done... please file a ticket at https://github.com/openseadragon/site-build/issues when you're ready and we can add it to http://openseadragon.github.io/examples/in-the-wild/.

Detect text in a scanned page

I'm trying to detect the text in a scanned page and get the coordinates of it.
See the attached image for an example of scanned page.
I need the vertical coordinates for spliting page from the useless parts, and then detect the text's coordinates.
What kind of tools could I use to split and detect text's coordinates?
Take a look at the Stroke Width Transform.
See also this SO answer.

Core-Plot CPTRangePlot filled area is distorted when scrolling (iOS)

Recently I have encountered a strange behavior from CPTRangePlot (I'm using Core-Plot 1.3).
I have a set of 365 data to display on the screen using CPTRangePlot. It works fine if all 365 points are displayed on the screen.
However, if I zoom in by using plotSpace:willChangePlotRangeTo:forCoordinate method to a certain level, the fill area will be distorted and the plot will be filled incorrectly. If I scroll to another plot range, the distorted area becomes fine and but another distorted area appears.
Everything goes back to normal if I zoom out.
Here are the images for your reference:
Before Zoom in:
After Zoom in:
Any idea what happening here? All other plot types (Scatter, Trading, Bar) work fine when I zoom in/out or scroll :-(
P/S: I tried the latest version of Core-Plot (1.4+) but no success.
This looks like a Core Plot bug—it is skipping points that fall outside the visible area when drawing the fill. Please report this on the Core Plot issue tracker.

iOS Maps - Grid Overlay

I'm looking for a way to overlay the iOS maps with a grid. The complete earth needs to be divided into squares. The location of the user doesn't effect the placement of the squares (In other words; the squares are always placed the same. On every iPhone, no matter where the user is).
I Looked into MKOverlay, but I've never used this so it's very new to me. Also, when zooming in/out should effect the overlay. It's very important that the squares are always covering the same area on the map (For example; A square should be 100mx100m in real world, when you zoom out, the square should cover the same 100x100).
Is there anybody that can point me in the right direction?
Is it possible to draw the grid from een .xml? Example given; On .XML is holding all squares with their coordinates on the map. When the user loads the map, the 100 squares around the user are loaded.

Resources