Array of markers in ios - ios

In my application i have to display 15 places belong to city, if the user taps on any place i need to display the details of that place in a info window using some text and images.
I already tried and created a marker and info window using google documentation. But to create 15 markers what is the best way, to create the markers one by one 15 times or can we use arrays
THank YOu.

According to Google maps sdk documentation there is no way to add markers in a bulk fashion therefore you must add them one at a time.
See the following: https://developers.google.com/maps/documentation/ios/marker

Related

How to get rid of points of interests on Google Maps for iOS

is it possible to get rid of automatically assigned by Google (SDK for iOS) points of interest such as: schools, companies etc., on the map? Some of them are marked on the screenshot attached below.
For google maps you can hide using json styling
https://developers.google.com/maps/documentation/ios-sdk/hiding-features
I don't know a way to do that with the google maps API. I'd recommend to use MapKit instead.
There you could use the showsPointsOfInterest method to set wether the points-of-interest should be visible or not.
Documentation link
When this property is set to true, the map displays icons and labels
for restaurants, schools, and other relevant points of interest. The
default value of this property is true.
Easiest way:
mapView.pointOfInterestFilter = .excludingAll

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.

customizing info window for multiple markers

I have seen the google developers video on custom info window for google maps ios sdk and got it. But how to use it when we have multiple markers. In my application i have to point 10 place and have to use that custom infowindow
I got it, we just have to call the customInfoWindow class how many time we want with new set of parameters.
Not sure exactly if this is what the question was - but you can attach a piece of your own data to the marker using marker.userData. You can make this anything you want - an NSDictionary for example. In -markerInfoWindow:(GMSMarker *marker) you can retrieve the userData and based on that, you can decide what view you want to return. Make sure the userData contains sufficient data to decide what your view should contain and you are good to go.

grabbing a screenshot from gmaps4rails

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.

Resources