cmv / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
325 stars 278 forks source link

Clustering Point Features #587

Closed cmccullough2 closed 7 years ago

cmccullough2 commented 8 years ago

Has anyone tried to 'cluster' point features in the CMV?

tmcgee commented 8 years ago

@cmccullough2 Perhaps this contributed widget will meet your needs. https://github.com/ERS-Long/PointClustering

tmcgee commented 8 years ago

@cmccullough2 Did that widget meet your needs?

cmccullough2 commented 8 years ago

Sorry for the delayed response. This is not working for me. The only thing that is different in the config is buildImageParameters vs. ImageParameters based on the example. I am not sure if this is the issue.
I am not getting any error messages in the developer tools. I am building this with the CMV WAB template.
Viewer: { type: 'dynamic', url: 'https://{airliftstatus}/gis/rest/services/Logistics/AircraftStatus/MapServer/', title: 'Airlift Status', options: { id: 'airliftStatus', opacity: 1.0, visible: true, imageParameters: buildImageParameters({ }) }, identifyLayerInfos: { layerIds: [0] }, layerControlLayerInfos: { swipe: true, metadataUrl: true, expanded: false, menu: [{ label: 'PointClustering', topic: 'clusterMap', iconClass: 'fa fa-search fa-fw' },{ label: 'Remove PointClustering', topic: 'removeClusterMap', iconClass: 'fa fa-search fa-fw' }]
}, legendLayerInfos: { layerInfo: { hideLayers: [] } } }

Widget Configuration: clusterMap: { include: true, id: 'clusterMap', type: 'invisible', //titlePane, invisible canFloat: true, title: '  clusterMap', path: 'widgets/PointClustering', position: 30, open: false, options: { map: true, } },

ERS-Long commented 8 years ago

Hi, @cmccullough2

Please plug in your service to this

https://github.com/Esri/cluster-layer-js

to see if it works or not. I used that to find one of the my service's issue.

green3g commented 8 years ago

On the latest version of cmv, the topic changed in Layer Control :( this line the topic should be changed to layerControl/...

tmcgee commented 8 years ago

@roemhildtg good catch.

green3g commented 8 years ago

I just noticed that a couple of my widgets were no longer working

tmcgee commented 8 years ago

yep. as you noted in the original PR #503, this is a breaking change.

cmccullough2 commented 8 years ago

Is it safe to assume I need to make the same changes on line 143, topic.subscribe('layerControl/removeClusterMap', function (r) {

tmcgee commented 8 years ago

yes it is.

ERS-Long commented 8 years ago

Yes, confirmed, if using the updated layercontrol, then we need to adjust that topic to use (layerControl) instead of (LayerControl). Also need to test the map service, the GIS guy had to change something for one of the layers, otherwise it does not draw the cluster. I forgot what it was exactly, if i remember it correctly it is something about the underneath database thing.

image

Thanks

tmcgee commented 8 years ago

It is worth pointing out that in the cmv develop branch, you can add your own custom layers directly in the operational layers array. So in theory, you could add a ClusterLayer when the application initializes without using the sublayer menu item. Untested, so your mileage may vary...

green3g commented 8 years ago

I vaguely remember seeing something about that, are there cmv docs on adding a custom layer type?

On Sep 21, 2016 17:18, "Tim McGee" notifications@github.com wrote:

It is worth pointing out that in the cmv develop branch, you can add your own custom layers directly in the operational layers array. So in theory, you could add a ClusterLayer when the application initializes without using the sublayer menu item. Untested, so your mileage may vary...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cmv/cmv-app/issues/587#issuecomment-248759584, or mute the thread https://github.com/notifications/unsubscribe-auth/AFN7Zx4VJDRVTobqMY8TInXjOKzja-x2ks5qsa1MgaJpZM4Jl0Bf .

tmcgee commented 8 years ago

@roemhildtg documentation? surely you jest! ;)

https://github.com/cmv/cmv-app/blob/develop/viewer/js/config/viewer.js#L98

tmcgee commented 8 years ago

Here's another interesting implementation of point clustering that should be fairly easy to integrate within a CMV application.

ERS-Long commented 7 years ago

Thanks @tmcgee for the link about this very beautiful clustering example, did a quick test integration in CMV using the exact data, yes, it is very straightforward and it is working just fine.

To use this cluster method for map service, still need to get the json data from the map service, I guess.

image

green3g commented 7 years ago

:smile: I'll see if I can find some time to write some docs on that before the big 2.0 release

cmccullough2 commented 7 years ago

:+1: