I'd like to overlay a custom map using MapKit. I've currently implemented the TileMap sample from WWDC10. However, my overlay map is in vector form (pdf) and it seems like a terrible waste to rasterise it and convert it to tiles (also takes up about 10megs as opposed to 300KB).
Is there a way to either:
a) overlay a pdf using MKOverlay, or
b) easily convert a vector graphic into MKPolygons, lines etc., so I can recreate my overlay map in MapKit?
Notes: The map I'm trying to overlay is pretty simple but geographically huge. It does need to work offline.
You can overlay a PDF using MKOverlay. In the drawMapRect:zoomScale:inContext: method of your MKOverlayView just use standard PDF drawing functions. You can find those functions here.
The problem with this approach is that for each maprect that is sent to that drawing method you will have to draw the entire PDF each time. This will be really slow. I think you will see the best performance by rasterizing the PDF and converting it to tiles. 10 MB is not too large of a dataset to ship with an iOS app.
Related
I need to use a PNG as custom map of an indoor place. I don't need navigation but some places should be clickable like what we have in built in map. In android this is possible with MapView but I didn't find anything for iOS to do that. Can someone help me out how to start and do this?
A while back Apple added the ability to provide custom map overlay tiles. It isn't as simple as providing a PNG. You will need to create a database of map tiles at different scales, following a specific naming convention, and then provide a tiled map overlay.
I suggest looking at this blog post:
Custom and Offline Maps Using Overlay Tiles from VIGGIOSOFT
It goes into quite a bit of detail on what's required.
I'm trying to extract some a data (a map image) from a PNG file which is tiled somehow. The file itself is only 256x256 pixels (according to 'get info' on the mac) but is is 23MB. It is from an iPad app called Mud Map and it contains a map that I purchased but I've lost the original that I converted to this format. When I view this file (renamed to a .PNG) I see one section of the map - 256x256px.
I'm asking this question on StackOverflow because I want to know more about these tiled images. How does one create a tiled PNG and what is the software that will open and or create these things. I'm interested in what metadata is required too. I'm loving the outdoors and mapping!!
The answer to this question, is that it cannot be done in manner I have described.
The images in the PNG are not tiled, the the files are just merged together which is no doubt an individual feature of the program as is it does not appear to be any kind of standard.
I have no access to application you mentioned in IPad. Just share some thought about possible situation here.
1) Map tiles are commonly used in GIS web application such as Google maps and so on. It is used to improve the performance especially when user pan very often. A map displayed typical map window is divided into for instance 4*4 separate calls. So maybe only 4 call will be made when user just pan a little bit instead of get the whole map for the 16 tiles.
The source image for this tiles can be in pre-generated tiles or just one static map.
2) Assemble separate images to one in GIS is called image mosaic function. GIS server can read a collection of images and mosaiced them into one with the overlapping part handle based on a certain rule. And the images are in pre defined grid format which are seamless and no overlapping, then it is called tiled images. We could pre-generated the tiles from one mosaiced image, or we can server it on the fly. Some GIS server/library/application does have the tile server function built in.
I would love to reproduce GoogleHeart-like 3D map flyover even when offline.
As of iOS 7 MapKit allows us to draw custom offline tiles. It also allows us to set a Camera in order to see the map in 3D or 2.5D as you may wish to call it.
I was wondering: can I draw a 3D shape like Apple does for its flyover feature, on my custom tiles?
I need to apply a "bump-map" to the map in order to get a GoogleHeart-like 3D view and I was wondering if Apple would allow me to do just that with iOS 7 and custom tiles rendering + camera settings.
Thanks
I have experimented pretty extensively with this, but there is no supported way to do this. Right now, Apple only offers raster tile-based overlay, albeit with automatic 2.5/3D transformation when overlaid on a map. Hopefully in the future they will support 3D API and/or custom, say, OpenGL-based augmentation to the map.
I'm overlaying the contents of a third-party shapefile. Some of the polygons consist of 138,000 points, most of them of about 3,000-8,000. In total there are 125 polygons.
Is that normal? Can I in some way, reduce the granularity of the polygons? CPU consumption peaks at over 190% on iPhone 5, and it takes a few minutes before the first overlays pop up.
One thing you might consider is using TileMill to render the Shapefile down into raster tiles with alpha transparency. You can then use that in either MapKit or the Mapbox iOS SDK. It will be highly performant, plus you can still use interactivity going the Mapbox route. Take this map, which was made from Shapefile data in TileMill: https://a.tiles.mapbox.com/v3/newamerica.motw_poverty/page.html#6/40.086/-95.471 The same way that the mouseovers work on the web, you could use Mapbox's RMInteractiveSource API to query and show on tap or other gestures.
I want to be able to load a list or an array of tiles and displayed them on a map.
Cocos2D offers a possibility to load tiles on a map. But for my case, I have to load just a specific part/range of tiles (which I define) and this changes dynamically during the run time. I never want to load the whole map at once. Is this possibile? Maybe an alternative to Cocos2D on iOS? The map details come from a server. It should be done in a quite large multiplayer environment, that's why each player/client should only load his relevant parts of the map.
You can definitely do this, and there are many different ways. For example, swapping scenes or layers during run time, with different tile maps on them, or by creating tile maps your own way with a custom set of methods using CCSprite (for example, it is common to create your own parallax scene instead of using the built-in Parallax scene methods in Cocos2d, and you could do the same with tile maps, if desired). The options are really limited only by creativity.