0
votes

Is there is a way to do custom markers in Google Maps Street View (GMSPanoramaView) in Xcode? I can find tutorials for doing custom markers in regular mapView but cannot find a way to do custom markers in street view. Is this possible?

I need to overlay text at specific locations, and there is (as far as I know) no way of displaying the snippet automatically in street view, so I was going to have a custom marker where the marker icon would be an image of the text label. Are there any other ways to get the text overlay at location effect? I am working with Maps SDK for iOS and Xcode (Swift).

If you are able to offer any insight, I would really appreciate this!! Thank you so much. (By the way, I am a relatively new at coding, so please be specific in advice!)

1

1 Answers

0
votes

First of, if you want to use Street View in Maps SDK for iOS, you must read the Google Maps Platform documentation regarding the service to learn more.

Here is a sample snippet of the code where I create a marker to the StreetView Panorama:

import UIKit
import GoogleMaps

class ViewController: UIViewController, GMSMapViewDelegate {

 override func loadView() {
    let panoView = GMSPanoramaView(frame: .zero)
    self.view = panoView

    panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: 48.858, longitude: 2.294))
    panoView.camera = GMSPanoramaCamera(heading: 200, pitch: -10, zoom: 1)

    let position = CLLocationCoordinate2D(latitude: 48.858, longitude: 2.294)
    let marker = GMSMarker(position: position)

    // Add the marker to a GMSPanoramaView object named panoView
    marker.panoramaView = panoView
    marker.icon = UIImage(named: "marker_image")
 }
}

You can notice the line marker.icon = UIImage(named: "marker_image"), this is where you put the name of the image that you want as your marker. In my case I made a New Image Set in my Assets and put the image I want to use as my custom marker.

Hope this helps!