mbtiles: Is it possible to draw some lines on offline mbtiles map - ios

I have an .mbtiles file and I am using it for offline map (iOS MapBox SDK). But my .mbtiles doesn't have enough data (just simple green rectangle). I want to draw some lines(roads) between points (I download it from my rest API). I found the solution to use RMShape, but I want to use already drawn map. I create my .mbtiles from osm and TileMill. Help me out please.

WhirlyGlobe-Maply SDK can help you achieve this.
It has a mapview and a globe view which you implement on your viewcontroller.
Then you create a layer using your mbtile file as shown below:
let tileSource = MaplyMBTileSource(mbTiles: "your-mbtile-filename")
You add this layer on the globe or map to display the tiles.
And using SDK's function like addShapes(), you can add, circles, vectors, labels, text and icons on the map/globe.
I tried adding lat and long lines programatically. Also tried adding some labels and spheres.
This is how it looks ->
WhirlyGlobe-Maply using mbtile and drawing on top of it

Related

iPhone Xcode PDF MAP location GPS

I have a PDF map. What's the easiest way, to add a GPS "blue dot" with my location. Somehow to sync it with maps & add this PDF as a layer on top of that? Thanks
Here's a post on rendering a PDF to PNG. How to convert PDF to PNG efficiently?
You'll need to know the GPS coordinates at the top left and bottom right of the image that produces.
You can try creating an MKOverlay containing the image and define its MKMapRect based on those known coordinates.
If that doesn't work for some reason, you could use MKMapView's convert(_:toPointTo:) to tell you where those GPS coordinates are on a UIView that you manage yourself. (Heads up: that's more complicated than it seems)

It's possible to use any borderless custom marker for AR.js

I am using custom marker for AR.js which is working fine, But I need to create a black border less or margin less custom marker for my project but when i create it along with it's pattern it's not effected rather it's detect the old custom marker. Please help me if it's possible.

Draw a grid onto an MKMapView

I'd like to draw a grid into my map, that represents the size of a tile at a certain zoom level. So for example I'd like to have a grid on my mapview that shows the outline of a zoom level 10 tile. So the outline of where this tile would be. No matter if the mapview itself is at zoom level 5 or 15, it should display the outline of where that tile would be placed.
The problem I have is how to calculate the proper rect that represents each visible "tile".
Any help is sooo much appreciated!!!
Or maybe the answer to following question would help:
How can I convert a MKMapRect to a MKTileOverlayPath?
I find that MapKit is way too limited when you want to start doing more and more with maps.
I would reccomend using Google Maps SDK for iOS: https://developers.google.com/maps/documentation/ios/start
and then using GMSTileLayer for the tiles:
https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_tile_layer
In the long run, replacing MapKit with Google maps gives you far more features and options and has better geolocation and reverse geolocation than Apple
You can also look at Mapbox. Between using TileMill to create a grid layer by setting the Map background to a pattern image, you could then only export zoom level 10 and either host it on Mapbox or export it to MBTiles format (SQLite-based). Then one of the Mapbox mobile toolkits could serve the tiles out as an overlay on your map.

How to put my own map in MKMapView

I need create an app for iOS using the GPS and MapKit. The idea is create my own map of my house for example and add it to the UIView or MKMapView and see the current position into the map.
see the image
You can use custom overlay on the map. Here is nice example of image overlay on the mapView.
Apple has provided sample code to do this with map tiles. Using the MapKnitter website you can geoposition your floor plan and export it in a format that Apple's code will accept.

Drawing a circle on MapView with specifiec radius on Monondroid

I'm trying to draw a circle with specific radius in km (for example 2km) on a MapView at specific lat/lng. I've found some samples:
Creating Custom Overlay on the map
Draw A Circle On Android MapView
Draw circle of certain radius on map view in android
I think first and second of above are useful but these are in Java and I need code for Mono for Android (Monodevelop).
I can't find Projection class in monodroid.
And can't use com.google.android.maps.Projection.
Can somebody help me how to use these codes in monodroid?
com.google.android.maps.Projection is an interface, so it is made available in Mono for Android as Android.GoogleMaps.IProjection to keep with normal C# conventions.
Similarly, where you'd use mapView.getProjection() in Java, in C# it is made available via the Projection property on MapView.
Xamarin has some tutorials on their site that go over how to use these to create custom overlays, so I'd suggest checking them out.

Resources