Git Product home page Git Product logo

Comments (4)

anand-y avatar anand-y commented on May 16, 2024

@nitisha1 I to am facing similar kind of problem #40

from google-maps-ios-utils.

nitisha1 avatar nitisha1 commented on May 16, 2024

@yadavanand
well,i just added self.view = gmsmapView but it is not the acceptable solution i guess atleast in my case.it is because of delegate i found and update my code.
` //[THis method contains Show Google Map Logic for the properties! that are synch]
func loadGoogleMap(){

    dispatch_async(dispatch_get_main_queue()) {

        print(" GOOGLE \(self.googleMapView)")
        if(self.googleMapView != nil){

            self.clearMap()
            self.googleMapView!.clear()
            self.googleMapView.clearsContextBeforeDrawing = true

            let path = GMSMutablePath()
            var count = 0

            self.delay(seconds: 0.1) { () -> () in


                    count = 0

                for Prop : Property in self.properties!
                {

                    if Prop.propLat != ""
                    {
                        let latStr = Prop.propLat
                        let latDbl : Double  = Double(latStr.floatValue)
                        let langStr = Prop.propLang as NSString
                        let langDbl : Double = Double(langStr.floatValue)
                        path.addCoordinate(CLLocationCoordinate2DMake(langDbl,latDbl))

                        if(count == 0)
                        {

                            // Set up the cluster manager with default icon generator and renderer.
                            let iconGenerator = GMUDefaultClusterIconGenerator()
                            let algorithm = GMUNonHierarchicalDistanceBasedAlgorithm()
                           // let renderer1 = MyCustomRenderer(mapView: self.googleMapView, clusterIconGenerator: iconGenerator)

                            let renderer = GMUDefaultClusterRenderer(mapView: self.googleMapView!, clusterIconGenerator: iconGenerator)
                            self.clusterManager = GMUClusterManager(map: self.googleMapView!, algorithm: algorithm, renderer: renderer)
                            }

                        let marker:GMSMarker = GMSMarker()
                        marker.position = CLLocationCoordinate2DMake(langDbl,latDbl)
                        marker.appearAnimation = kGMSMarkerAnimationPop
                        marker.title = Prop.propBuildingName as String
                        marker.snippet = Prop.propCode as String
                        //    marker.infoWindowAnchor = CGPointMake(0.44, 0.45)

                        let markerIcon:UIImage = self.generateSpot(Prop)
                        marker.icon = markerIcon

                        //marker.map = self.googleMapView
                        self.markersArray!.append(marker)

                        let spotObje:Spot = Spot()
                        spotObje.location = marker.position
                        spotObje.marker = marker

                         self.clusterManager.addItem(spotObje)

                    }
                    count = count+1

                    }

                let bounds = GMSCoordinateBounds(path: path)

                if(self.googleMapView != nil)
                {

                    // transaction animaton inreases memory usage
                    CATransaction.begin()
                    CATransaction.setValue(NSNumber(float: 3.0), forKey: kCATransactionAnimationDuration)
                    self.googleMapView!.animateWithCameraUpdate(GMSCameraUpdate.fitBounds(bounds, withPadding: 200.0))
                    CATransaction.commit()

                    self.googleMapView.delegate = self
                    // Call cluster() after items have been added to perform the clustering and rendering on map.

                    if(self.clusterManager != nil)
                    {
                    self.clusterManager.cluster()


                    // Register self to listen to both GMUClusterManagerDelegate and GMSMapViewDelegate events.
                    self.clusterManager.setDelegate(self, mapDelegate: self)
                    }
                 }

            }

        }
    }
}`

from google-maps-ios-utils.

mountainvat avatar mountainvat commented on May 16, 2024

Can you please attach a screenshot? How many items are there in self. properties? How is it populated?

Can you do a pod try Google-Maps-iOS-Utils and select the Swift demo app to see if it works for you and take it from there?

Alternatively if there is a git repo for me to take a look it would be easier for me but I understand that it may not be possible.

Unrelated but I do not think you need the create a marker for each spotObje. The ClusterManager will take care of creating the marker for you.

from google-maps-ios-utils.

domesticmouse avatar domesticmouse commented on May 16, 2024

Closing this out as stale. If this is still an issue, please re-open this issue with a link to a minimal reproduction case in a GitHub repository. Thanks!

from google-maps-ios-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.