GithubHelp home page GithubHelp logo

clusterlayer-plugin-ios's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clusterlayer-plugin-ios's Issues

How to load the local shp file?

Last week you have got a lot of help for me, this time there are some problems need to ask.

I worked with an Android developer to develop mobile applications for GIS, but I found that he implemented the local .shp file load and I could not find this method on OC.

He used this method:
" ShapefileFeatureTable shapefileFeatureTable=new ShapefileFeatureTable(shpPath);
featureLayer=new FeatureLayer(shapefileFeatureTable);
mMapView.addLayer(featureLayer)"
This is very easy to achieve the local shp file loading , so I would like to ask about the oc method(We only have local shp files)

Thanks!

Update for Runtime v100.0

Clustering is not yet available in the new Runtime v100.

Update this plugin to work with Runtime v100

  • Investigate performance of using AGSFeatureCollectionTable with AGSFeatureLayer. Update: Performance is good. Going ahead with implementation.

Tasks:

  • Implement clustering engine.
  • Implement cluster representation.
  • Bring work into v.next branch.
  • Implement unclustered feature representation.
  • Generically handle any spatial reference.
  • Calculate grid cell sizes properly.

Animate while zooming

Leaflet's cluster layer provides hierarchies of clusters and animation while zooming between them

Runtime-100: Feature attributes values are null on feature tap for online layer

Using https://public.gis.lacounty.gov/public/rest/services/LACounty_Dynamic/LMS_Data_Public/MapServer/6 this online feature layer to display the data on the map with cluster but when tapping the feature, the geoElements all attribute values are getting null except OBJECTID.

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        mapView.map = map
        displayLayerData()
    }
 func zoomToExtent() {
        let extent = AGSEnvelope(xMin: -1.321019993548013E7, yMin: 3989235.1184073277, xMax: -1.3153230481860003E7, yMax: 4074215.1398047437, spatialReference: AGSSpatialReference(wkid: 102100))
        let viewPoint = AGSViewpoint(targetExtent: extent)
        self.mapView.setViewpoint(viewPoint)
    }
    
    func displayLayerData() {
        zoomToExtent()
        
        let layerURLString = "https://public.gis.lacounty.gov/public/rest/services/LACounty_Dynamic/LMS_Data_Public/MapServer/6"
        
        if let fireHydrantLayerURL = URL(string: layerURLString) {
            let fireHydrantLayerTable = AGSServiceFeatureTable(url: fireHydrantLayerURL)

            fireHydrantLayerTable.load { [weak self](error) in
                if let errorObj = error {
                    print("Unable to load Fire Hydrant Layer: ", errorObj.localizedDescription)
                } else {
                    if fireHydrantLayerTable.loadStatus == .loaded {
                        let fireHydrantLayer = AGSFeatureLayer(featureTable: fireHydrantLayerTable)
                        fireHydrantLayer.isPopupEnabled = true
                        fireHydrantLayer.load { [weak self](error) in
                            if fireHydrantLayer.loadStatus == .loaded {
                                guard let viewObject = self else { return }
                                if let errorObj = error {
                                    print("Unable to load Fire Hydrant Layer: ", errorObj.localizedDescription)
                                } else {
                                    fireHydrantLayer.minScale = 0
                                    let clusterLayer = FeatureClusterLayer(mapView: viewObject.mapView, featureLayer: fireHydrantLayer)
                                    viewObject.mapView.map?.operationalLayers.add(clusterLayer)
                                    viewObject.clusterLayer = clusterLayer
                                }
                            }
                        }
                    }
                }
            }
        }
         mapView.touchDelegate = self
    }
    
    func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
        print("Map Scale: \(mapView.mapScale)")

        mapView.identifyLayers(atScreenPoint: screenPoint, tolerance: 20, returnPopupsOnly: false) { (results, error) in
            if let error = error {
                print("Error identifying! \(error.localizedDescription)")
                return
            }

            guard let results = results else { return }

            for result in results {
                for subLayerResult in result.sublayerResults {
                    print(subLayerResult.layerContent.name)
                    print(subLayerResult.geoElements.map({ (element) -> NSMutableDictionary in
                        return element.attributes
                    }))

                    let clusterResults = subLayerResult.geoElements.compactMap({ (element) -> AGSFeature? in
                        if let feature = element as? AGSFeature, feature.attributes["Key"] != nil {
                            return feature
                        }
                        return nil
                    })

                    let popups = clusterResults.compactMap({ (feature) -> [AGSPopup]? in
                        return self.clusterLayer.manager.cluster(for: feature)?.getPopups(popupDefinition: self.clusterLayer.sourceLayer.popupDefinition)
                    }).joined()

                    print("Found \(popups.count) popups")
                }
            }
        }
    }

Getting result like this on attribute print in console:

[{
    Name = "<null>";
    OBJECTID = 15;
    "POINT_X" = "<null>";
    "POINT_Y" = "<null>";
    addrln1 = "<null>";
    addrln2 = "<null>";
    cat1 = "<null>";
    cat2 = "<null>";
    cat3 = "<null>";
    city = "<null>";
    "date_updated" = "<null>";
    description = "<null>";
    "dis_status" = "<null>";
    email = "<null>";
    "ext_id" = "<null>";
    hours = "<null>";
    info1 = "<null>";
    info2 = "<null>";
    latitude = "<null>";
    link = "<null>";
    longitude = "<null>";
    "org_name" = "<null>";
    phones = "<null>";
    "post_id" = "<null>";
    source = "<null>";
    state = "<null>";
    url = "<null>";
    "use_type" = "<null>";
    zip = "<null>";
}]

Sample:
clusterlayer-plugin-ios-runtime-100 2.zip

Add option to calculate zoom-level by zoom-level

Allow grids for different zoom levels to operate independently on the same set of features.

Currently the system clusters using a hierarchy of grids. This is sometimes undesirable in terms of cluster representation, and can require a lot of pre-processing just to display the clusters for a given zoom level.

Allow configurable data sources

Currently the ClusterLayer is strongly tied to a FeatureLayer. Allow input of:

  • FeatureSet
  • QueryTask and Query
  • Array of Graphics

What else?

Memory issue

Hi @nixta,

Are you aware of any memory issues with this library? On every call of method +(AGSClusterLayer *)clusterLayerForFeatureTableLayer:(AGSFeatureTableLayer *)featureTableLayer the memory footprint of my app is increased by 9-10 megabytes which causes memory issues after multiple calls of this method. This method is called in our app whenever an item has been added to the map view - we refresh the map view and re-add all the layers, including the newly created clustering layer.
I've debugged this library and memory usage increases after -(void)addItems:(NSArray *)items has been called in method -(void)rebuildClusterGrid in -(void)dataLoadCompleted of -(void)featureLayerLoaded:(NSNotification *)notification.
Hope you can help me out.

Kind regards,
Ivan

Performance enhancements

I think the performance could be improved tremendously.

Need to do some analysis on the clustering algorithm to see if there are any bottlenecks or just plain silly bits of logic (note, I can say that because all the logic so far has been jammed in by me).

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.