nixta / clusterlayer-plugin-ios Goto Github PK
View Code? Open in Web Editor NEWA cluster layer extension to the ArcGIS Runtime for iOS
A cluster layer extension to the ArcGIS Runtime for iOS
Zooming out after continuously zooming in does not load tiles other than the current tile
The issue is inconsistent but here are the steps to repro:
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!
The cluster grid size for each zoom level needs to be smarter.
When using "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" service, the cluster function is normal, but when the "http://www.digitalcq.com/RemoteRest/services/CQMap_IMG/MapServer" service is used, there is always only one point in the cluster.I've been bothering me for a long time.
The current implementation provides methods for instantiating a cluster layer based off an existing AGSFeatureLayer.
We should add the ability to take an existing AGSGraphicsLayer as a source as well.
See https://geonet.esri.com/message/456633#456633 for the original request.
Clustering is not yet available in the new Runtime v100.
Update this plugin to work with Runtime v100
AGSFeatureCollectionTable
with AGSFeatureLayer
. Update: Performance is good. Going ahead with implementation.Tasks:
v.next
branch.Looks like both are internal.
Leaflet's cluster layer provides hierarchies of clusters and animation while zooming between them
Occasionally encountering delays while zooming in and out (particularly when coverages are being calculated). Only consider coverages for the visible extent.
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>";
}]
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.
I was wondering if we can rename this header to have a more descriptive name. Any suggestions?
Create tests!
My project needs this function, could you please update it to the new sdk?
Currently the ClusterLayer is strongly tied to a FeatureLayer. Allow input of:
What else?
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
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).
Spiderify?
Clustering upgrading to the new Runtime v100.2.1
Aren't ivars the ones created with a prefix underscore?
Referring to AGSCluster class here
Cau we use this for offline data also
AGSFeatureTableLayer? and is it possible to update.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.