grabbing a screenshot from gmaps4rails - ruby-on-rails

So yeah we're trying to display a pretty small version of the map and all the user interface elements were getting in the way.. and we realized a screenshot would probably be just fine, so just wondering if it's possible to generate a screenshot of a map position and just have it display as an image instead of an interactable map.

You can use Google Static Maps to show a non-interactive map without user interface controls (zooming buttons etc.)
As they return an image file it is easy to cache. Please note that Google does not allow caching of maps due to copyright reasons of the map owner, but probably caching is not necessary with the static map.

Related

How do people have mobile apps that display maps with no logo

I have had a look at a bunch of different map APIs and all the ones I have found require you to display their logo
I have had a look on the IOS app store and there are loads of apps that display a map without any logo
Does anyone know how this is done?
I have noticed the Apple mapkit doesnt require a logo but that one doesnt allow you to customize the map much visually.
All that I have seen on the app store have a different design to what mapkit provides and no logo.
Apple's MapKit allows you to customize the map visually by using the class MKTileOverlay.
Basically what you have to do is init that class with the URL of a Tile server and then add the overlay to the map view.
let myOverlay = MKTileOverlay(URLTemplate: /*Tiles server URL*/)
myOverlay.canReplaceMapContent = true
self.mapView.addOverlay(myOverlay)
Here you can check some free tiles servers:
https://openmaptiles.org
https://wiki.openstreetmap.org/wiki/Tile_servers

Make MapView display normal Apple Maps when I don't have a tile in my MKTileOverlay set

I am working on an iOS map that uses a "custom" map, stored completley in my application so it can always be accessed offline. I am using a custom MKTileOverlay URL to my local file store to make this happen, etc.
However, as my application's map only covers a small geographic area, I would like to have have the MapView display the standard Apple Map in such cases. When I overlay the map and set "canReplaceMapContent" to true, I just get a blank white space for map tiles that aren't present.
I don't really want to set canReplaceMapContent to FALSE, because most of the time a user will be using my (custom) map, so I wouldn't want the overhead of rendering the Apple map that would be completely covered.
Is there any way I can return a "nil" to a function or something to tell MapKit to not use the TileOverlay, and just use the regular Apple map instead?
No, but here's an idea: have two MKMapViews with the same frame, one with your custom map and canReplaceMapContent = YES and the other without and NO. You can hide one and show the other, transferring annotations if necessary, and you might be able to produce a convincing swap.

iOS Custom InfoWindow Google Maps SDK 1.7.2

I have been searching and coding with the Google Maps iOS SDK 1.7.2
I need to build an app that displays custom InfoWindow after the marker is tapped.
Google posted a YouTube Video, that shows how to do it with just ONE marker.
The practical use scenario uses more than ONE marker, but if we follow the example of YouTube Video adding more than one marker, all the markers would show the same info inside the custom InfoWindows.
I did a iOS sample and uploaded to GitHub Sample Here
My Question is: Could anyone download the sample at GitHub and help me to implement that feature, display more than one marker with custom InfoWindow displaying different info for each marker ? In my sample inside the InfoWindow there is a WebView. For my use scenario I would need to load for each marker a different WebView(url) for each marker on the map but I couldn't load the WebView inside the custom InfoWindow. That WebView would be the size of the custom InfoWindow.I would load all the info for the markers as different webpages in the size of the info window.
It also would help a lot of other people that right now can't find a complete and fully working sample of that custom InfoWindow for iOS.
Thanks and Cheers!
Another vote for SMCalloutView. Check out my answer here for a quick start on implementing it.
Sorry to not actually answer your question per se, but Google's rendered UIView info windows are more hassle than they're worth, I think. You may be able to get a webview to load inside one of them, but the Maps SDK takes the custom UIView you set and then renders it into OpenGL, ignoring most (all?) updates you try to make.
Using SMCalloutView skips all of that and we put its view on top of the map, allowing you better control before and after drawing.
SMCalloutView helps you to custom the InfoWindow, you can download the Sample project and run it.
For displaying multiple InfoWindows, you have to treat GoogleMaps SDK (GMSMapView has a #property(nonatomic, strong) GMSMarker *selectedMarker property, which is not a Set), see the Sample project, in mapView:didTapAtMarker: delegate method.

adding annotations to offline map (tilemil)

I'm using tilemil to create offline map for my iPhone app. I've added annotation to map through GEOJSON, and everything works great, but i have one question: how can i create and hook up annotations that is created in offline map with app annotations. Because annotations that is created in offline map showing as dots in my app.
Example:
what i have:
what i want:
should i just parse GeoJSON and add annotations with data this way, or there's some better approaches to do this? Thanks!
If you have implemented the points in TileMill, then their imagery will be "baked into" the map raster tile imagery. You can still have callouts for these if you also add interactivity to the map in TileMill so that tapping the points can retrieve data. A good example of doing this for regions instead of points is in the third tab of this sample project, as shown in the screenshot:
https://github.com/mapbox/mapbox-ios-example
Another option, as you've mentioned, is to just parse the GeoJSON client-side using NSJSONSerialization and then adding the points in Cocoa as RMAnnotation objects.
A third option is to add the markers in the mapbox.com editor interface and save them with your map, then you can retrieve them as simplestyle data automatically as in the Weekend Picks sample project that you've included a screenshot of. The GeoJSON can be automatically retrieved, parsed, and added as annotations in the project by the iOS SDK.

Any potential issues using uitableview and uiwebview to show mini google map

Im looking into having a tableview and a custom cell that has a webview control. The purpose of the webview would to show a google map inside the webview at some lat/long.
Could there be problematic with this approach? Memory issues?
Another approach would be having a uiimage and use the google map static api to generate the image and store the image on my server and have the app request the image via a URL.
I was hoping to avoid generating the images and storing them on my server and using directly the google map in a web view, but not sure what kind of issues i could run into with this approach?
The only problem is speed. If your table view consists of rows and rows of MKMapViews, it will take time for each one to load as the user scrolls through them. However, if there is only one it shouldn't be a problem.
The static image approach has the same problem but I think it might be slightly faster.
I have an app in the App Store for a local festival that had many events at different venues. Given that the audience was from all over the world, and thus unknown in town, the app showed a map for each event. I solved this using an MKMapView inside a custom UITableViewCell and using an accessory disclosure button that would push a detailed map view onto the navigation controller. It worked well, but was a little slow. I would not recommend it for many such cells.
Screen shot:

Resources