Giter VIP home page Giter VIP logo

fbannotationclusteringswift's People

Contributors

antoinelamy avatar ast3150 avatar bogdan-razvan avatar chenr2 avatar dandalf avatar freemiumdev avatar javialgaba avatar jhildensperger avatar lucasromanomr avatar nmdejamobile avatar pahnev avatar pasevin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fbannotationclusteringswift's Issues

Min amount of pins to cluster

Hi,

Does anybody know how to set minimum amount of pins which being clustered.
In other words, sometimes, i have cluster with only 2 pins in it, how to change a code in the way which will make a cluster with min 5 pins inside. Thanks everyone in advance.

Do not "clusterize" an annotation

How can I have an annotation exception? Like, a search pin annotation representation between places annotations. Currently, they all become a cluster, I want just the places to become a cluster. Adding the Search Pin Annotation to the mapView directly is not working(not appearing).

How to increase/decrease the distance for a cluster merge

How do I specify the distance needed for annotations to merge into a cluster? For example, I have an annotation in Chicago and a cluster annotation of two in Texas. When I zoom out completely, they both merge and create a cluster of three over Texas. However, I don't want annotations at that distance to merge. Any Ideas?

Dynamic annotation count

Hi

My app every time the user scrolls the map gets lats,longs from my server and add new annotations to the map, so my question is can I use this library with dynamic annotations? I thought that I can somehow empty clusteringManager.

Thanks in advance.

Cluster displayed number is not accurate

Hi,
When I use our lib, cluster displays a wrong number because it counts subclusters as one annotation instead of a cluster.
For instance, when I have a cluster A indicating "2" ans one annotation B, when unzooming, the annotations well disappears (I commented the lines indicated in #42) but the new cluster C still indicates 2. I tried with more clusters and annotations ant it seems that it counts each cluster for 1 annotation. So in my case, when my cluster A and the annotation B are grouped in cluster C, C displays 2 instead of 3.
Any tips to fix this ?
Thanks.

Annotations at maximum zoom level are not visible

If I have annotations at the same map coordinates and I expand the map at maximum zoom level, those annotations remain into a FBAnnotationCluster and are not visible as single annotations.
Is there a way to allow displaying single annotations at maximum zoom level? @chenr2

How to set default location to current?

hi
I am using this for clustering the locations, it works great, But i want to set the set location on loading the map. But it tends to full zoom out cluster view. i want how to set the initial location to current location and then i want to show the cluster only on zoom out and the zoom in.

How not to decluster annotations that are close enough to each other

Hi, first of all, I love your work.
I want to know if there's a way not to decluster when they are really close to each other(coordinate-wise). I'm thinking of manipulating the zoom scale somehow but i'm not sure how to go about it. Any clues would be really really appreciated. Thanks!

Clear Tree

I have found that if I try to repopulate my map, it doesnt erase the pins that are already there. Is there a clear() function or something of the sort that just wipes the map and starts over?

FBClusteringManager holds strong reference to delegate

In its current implementation, setting the FBClusteringManager delegate to a class that references the FBClusteringManager class (e.g., clusteringManager.delegate = self in the ViewController that displays the map) causes a retain cycle. Setting the delegate to a weak var and the delegate protocol to a class-protocol fixes the issue.

Remove annotation and then add new ones.

Hi,
i want to remove all the annotation from my mapView and then according to filter add a new ones.
"arrOfPinsOnMap.removeAll()"
Will hide them, but soon as i move with map they will show again because of "displayAnnotations"
is there a way to achieve what i want?

Xcode 8.1 Swift 3.0 Issues

Hi, we had to finally update to Xcode 8.1 from 7.3.1 which now we are facing a big pain in dealing with the pods we are using and the fact that some of them are not updated for the proper syntax.

Here is what Im seeing so far..

image

Any ideas how to get around this.. we prefer to migrate all to 3, and not 2.3 for our project.

Google maps

Hi, Is there an example with google maps? Is it compatible?

Title of PIN is too long to display.

I have a long title in pin. Need to adjust

  1. size of the PIN title View.
    OR
  2. size of the PIN Label to sizeToFit()
    Do u have any idea how to achieve this?
    I think the problem is in
let mapBoundsWidth = Double(self.mapView.bounds.size.width)
            let mapRectWidth:Double = self.mapView.visibleMapRect.size.width
            let scale:Double = mapBoundsWidth / mapRectWidth
            let annotationArray = self.clusteringManager.clusteredAnnotationsWithinMapRect(self.mapView.visibleMapRect, withZoomScale:scale)

Thanks for respond :-)

FYI - Refactored version available: AnnotationClustering

I didn't know how to inform you guys other than creating a new issue: i've started to refactor the code of this repo to use it in a project of mine. Along the way i decided to put the refactored version in a new repo instead of creating a fork and a pull request.

So in case anyone is interested, here's my version:
AnnotationClustering

Note: i use only Carthage for package management, so i dropped CocoaPod support.

When cluster covers user's location - it gets impossible to select, is there any workaround for that?

In the didSelectAnnotationView method I have this code:

func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) {
        mapView.deselectAnnotation(view.annotation, animated: true)

        if view.annotation!.isKindOfClass(FBAnnotationCluster) {
             print("cluster selected")
        } else {
            if !(view.annotation is MKUserLocation) {
                  print("single pin selected")
            }
            else{
                  print("MKUSERLOCATION selected")
            }
        }
}

now the problem is when user zooms out the map and cluster is in the same location as user's default location. Then, when I touch the cluster, instead of seeing "cluster selected" I see "MKUSERLOCATION selected". Is there any way of completely ignoring mkuserlocation selection and select cluster then?

This happens of course when I'm displaying user's location:

mapView.showsUserLocation = true

Possibility for max cluster zoom level

Thanks for the Swift translation.
Is there any possibility to set a max zoom level for the clustering? If I achieve zoom level 14, I would like to see all annotations without clusters.

Unclustering as map zooms out

My annotations will merge and un-merge as I zoom out creating a kind of glitchy looking display. Ideally, I'd like the annotations that are within a cluster to remain there as the map zooms out. I've messed with several different variable on the FBClusteringManager's "FBZoomScaleToZoomLevel" switch statement with no luck. Below is what I have to display annotations on the map on my viewcontroller:

func mapView(mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
let array: [MKAnnotation] = self.createAnnotationsForVideos(self.mapVideos)
self.clusteringManager.addAnnotations(array)
let mapBoundsWidth = Double(self.mapView.bounds.size.width)
let mapRectWidth: Double = self.mapView.visibleMapRect.size.width
let scale: Double = mapBoundsWidth / mapRectWidth
let annotationArray = self.clusteringManager.clusteredAnnotationsWithinMapRect(self.mapView.visibleMapRect, withZoomScale: scale)
self.clusteringManager.displayAnnotations(annotationArray, onMapView: self.mapView)

}

Annotation disappear after dropping a pin with gesture recognizer on Mapkit

I have some trouble using UIgesture recognizer and this project

the pins disappear instantly when I drop them.

when I remove animated on viewdidload, I can drop them but they will disappear when I zoom out or in and the cluster is not doing his job too when i'm doing a UIgesture Recognizer.

What I'm doing wrong ?

Fatal error: FBZoomScaleToZoomLevel

Hi, I found the problem:

I'm trying to map the 3600 points.

In proetsesse job application takes off on error

Functions "FBZoomScaleToZoomLevel"
The text of the error: "fatal error: floating point value can not be converted to Int because it is either infinite or Nan"
Line 169
File "FBClusteringManager.swift".

err

I noticed that this error is presented not every time, sometimes the point of time will be displayed correctly.

What could be the problem?
Thank you

Clusters Refresh rate

Whenever I zoom in or out the Clusters recalculate where they should be but there is major flashing going on while they do this. All the annotations flash on and off the screen. This would be a really bad experience for the users. Do you have any suggestions on how to fix this? Thanks!

How can I use MKAnnotationView insted of MKPinAnnotationView?

I need to customize pin's images, so I have to use MKAnnotationView, not MKPinAnnotationView. But MKAnnotationView is always displayed as cluster. Here is my viewForAnnotation method:

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {

    if annotation.isKindOfClass(FBAnnotationCluster) {
        var clusterView = mapView.dequeueReusableAnnotationViewWithIdentifier("pin")
        clusterView = FBAnnotationClusterView(annotation: annotation, reuseIdentifier: "pin")
        return clusterView
    } else if annotation.isKindOfClass(MKUserLocation) {
        return nil
    } else {
        let anno = annotation as! StatusPin

        let pin = mapView.dequeueReusableAnnotationViewWithIdentifier("pin") ?? MKAnnotationView(annotation: anno, reuseIdentifier: "pin")

        if let infoView = StatusView.instanceFromNib() as? StatusView {
            infoView.status.text = anno.subtitle!
            pin.detailCalloutAccessoryView = infoView
        }

        pin.image = UIImage(named: "pinIcon")

        pin.canShowCallout = true

        return pin
    }
}

dequeuing FBAnnotationClusterView

In your example app in mapView(, viewForAnnotation: ) you dequeue your clusterView but then create a new one

    var clusterView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
    clusterView = FBAnnotationClusterView(annotation: annotation, reuseIdentifier: reuseId)

I could be wrong, but pretty sure you shouldn't be reinstanciating after dequeuing it.

Heres how I dequeue your clusterView which seems to be working well:

    func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
        if let fbAnnotation = annotation as? FBAnnotationCluster {
            var reuseId = "Cluster"
            var clusterView: FBAnnotationClusterView?
            if let dequeuedClusterView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? FBAnnotationClusterView {
                clusterView = dequeuedClusterView
            }
            if clusterView == nil {
                clusterView = FBAnnotationClusterView(annotation: annotation, reuseIdentifier: reuseId)
            }
            else {
                clusterView!.annotation = fbAnnotation
                clusterView!.setTheCount(fbAnnotation.annotations.count)
            }
            return clusterView
        }
    }

Pods issue

Im using your library in an iOS 8.0 project but get and error when trying to move to cocoa pods
My pod file has "platform :ios, '8.0'"

[!] Unable to satisfy the following requirements:

- `FBAnnotationClusteringSwift` required by `Podfile`

Specs satisfying the `FBAnnotationClusteringSwift` dependency were found, but they required a higher minimum deployment target.

Not exactly sure what causes this - maybe you need: s.ios.deployment_target = '8.0'...

Support for Swift 2.3

I have a project where I use this and I can't use Swift 2.2, and I can't use Swift 3.0. So I need to use 2.3, but this does not have the support for it.

I would appreciate so much if someone could add support for 2.3. I've got it running on 2.3 by commenting out some small changes, but I have no idea if the changes are legit.

Select annotation only work for cluster

Hi,

I have an issue with select detection. It work with clusters and phone location pin but not with simple pins (added in cluster manager but not in cluster). I think I made a mistake, so I tested against you exemple and it fail too :

func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView)
{
print("Selected annotation")
}

-> log only for user location pin and clusters

and/or :

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView?
{
if annotation.isKindOfClass(FBAnnotationCluster)
{
reuseId = "Cluster"
var clusterView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
clusterView = FBAnnotationClusterView(annotation: annotation, reuseIdentifier: reuseId, options: nil)
clusterView?.canShowCallout = true
return clusterView
}
else
{
reuseId = "Pin"
var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? MKPinAnnotationView
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView!.pinTintColor = UIColor.blueColor()
pinView!.canShowCallout = true

return pinView
}
}

-> show callout only for cluster and user location pin but pins are blue so they've been affected by the code

Pod install older version

From pod install, i get versions 1.0.1

Which is wrong because in your example you have completely different files.

Group annotations

Hi,

First off all, I love this pod. It works extremely well. I do have a question. What I would like to do, is toggle groups of annotations on and off. So for instance, we have 3 different annotation groups. One group has hotels, the other has stadions, and yet another holds bars. I would like to switch those different groups on and off, without rebuilding the annotations. Is this possible?

Custom images

How i can set custom image as pin and how can i change default green color?

Reuse current cluster

First thank you @chenr2 for your work. I wouldn't have been able to translate this wonderful library by myself.
Unfortunately I am facing an issue that is somewhat common in the objective-c version: reusing the current cluster. A solution has been posted here infinum/FBAnnotationClustering#2 but I am not able to translate it in swift. Does anyone know how to do it?

Thank you very much.

How to hide cluster count when we do full zoom out.

Hi,

I am using this framework and i loved it. I want to hide the cluster count when did full zoom out. Actually when more than one device in same position , i want to hide cluster count in full zoom out . Is this any way to do that.

No Annotations

I have added all 7 swift files manually and added the FBViewController file. When I run it there is no annotations and no clustering.

Clusters never turn into pins

Regardless the amount of zoom I apply on the map, the clusters never "explode" into pins. I am using the latest version of FBAnnotationClusteringSwift, and my code pretty much looks like what is in example code.

However, the images bellow show the progression of the clusters as I zoom in on the map, reaching the maximum zoom actually increased the size of the cluster inside the visible region:

What is likely to be this problem? Where I should look into my code to narrow down this problem. For information, I am using the Xcode Simulator to run the app.

Thank you for any suggestion or comment on that.

1
2
3
4
5
6
7
8
9

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.