ERS-Long / PointClustering

3 stars 1 forks source link

Default Clustered #1

Open nejohnson27 opened 9 years ago

nejohnson27 commented 9 years ago

We have need for a layer that can be configured to clustered by default instead of having to toggle it on in the layer widget. Is this possible?

ERS-Long commented 9 years ago

Hi, nejohnson27:

I have not done that because the CMV controller currently only support these layer type

csv: 'CSV', dataadapter: 'DataAdapterFeature', //untested dynamic: 'ArcGISDynamicMapService', feature: 'Feature', georss: 'GeoRSS', image: 'ArcGISImageService', imagevector: 'ArcGISImageServiceVector', kml: 'KML', label: 'Label', //untested mapimage: 'MapImage', //untested osm: 'OpenStreetMap', raster: 'Raster', stream: 'Stream', tiled: 'ArcGISTiledMapService', webtiled: 'WebTiled', wms: 'WMS', wmts: 'WMTS' //untested

However, for pointclustering, it is a customized feature type called ClusterFeatureLayer. So the CMV controller does not handle it now.

One thing you can do, if you don't mind to hardcode it, You can look into the file Controller.js search for

 this.map.addLayers(this.layers);

i think you should be able to add your layer there

you can follow the logic in method initClusterLayer, instead of getting the layer info from layer control, you can hardcode it there, then add the layer to the map.

Not very elegant solution, but i think it can be done.

Let me know if that helps

On Fri, Aug 7, 2015 at 1:50 PM, nejohnson27 notifications@github.com wrote:

We have need for a layer that can be configured to clustered by default instead of having to toggle it on in the layer widget. Is this possible?

— Reply to this email directly or view it on GitHub https://github.com/ERS-Long/PointClustering/issues/1.

ERS-Long commented 9 years ago

hold on, there should be a way to do it, just need to create a new widget, in this widget, you set the layer info, and add to map. I will try to get it implemented this weekend, will share with you.

Thanks.

On Fri, Aug 7, 2015 at 2:36 PM, Long Ma long.d.ma@gmail.com wrote:

Hi, nejohnson27:

I have not done that because the CMV controller currently only support these layer type

csv: 'CSV', dataadapter: 'DataAdapterFeature', //untested dynamic: 'ArcGISDynamicMapService', feature: 'Feature', georss: 'GeoRSS', image: 'ArcGISImageService', imagevector: 'ArcGISImageServiceVector', kml: 'KML', label: 'Label', //untested mapimage: 'MapImage', //untested osm: 'OpenStreetMap', raster: 'Raster', stream: 'Stream', tiled: 'ArcGISTiledMapService', webtiled: 'WebTiled', wms: 'WMS', wmts: 'WMTS' //untested

However, for pointclustering, it is a customized feature type called ClusterFeatureLayer. So the CMV controller does not handle it now.

One thing you can do, if you don't mind to hardcode it, You can look into the file Controller.js search for

 this.map.addLayers(this.layers);

i think you should be able to add your layer there

you can follow the logic in method initClusterLayer, instead of getting the layer info from layer control, you can hardcode it there, then add the layer to the map.

Not very elegant solution, but i think it can be done.

Let me know if that helps

On Fri, Aug 7, 2015 at 1:50 PM, nejohnson27 notifications@github.com wrote:

We have need for a layer that can be configured to clustered by default instead of having to toggle it on in the layer widget. Is this possible?

— Reply to this email directly or view it on GitHub https://github.com/ERS-Long/PointClustering/issues/1.

nejohnson27 commented 9 years ago

Awesome! With this method, would it be possible for it to have multiple cluster layers enabled at once? I got that working on a regular esri js map, but today is my first day messing with CMV and I'm still trying to figure out how it all works. Thanks!

nejohnson27 commented 9 years ago

Ok, so I got the multiple layers working by changing clusterLayer into an array and using clusterLayer[r.subLayer.id]. Just need to figure out the layers defaulting to clustered.

tmcgee commented 9 years ago

Hmmmm. So I am wondering how could we add ClusterFeatureLayer or other custom layer as a supported layer type in the cmv Controller.

Tim strokes his beard while contemplating the possibilities...

ERS-Long commented 9 years ago

I got a new widget it should show the cluster by default.

But i can only get one layer working, please see if you can make a change to show multiple layers at the same time. I would like to know.

put the attached file in the widget folder

also in the viewer.js

add the following config setting

        clusterMap2: {
            include: true,
            id: 'clusterMap2',
            type: 'titlePane', //titlePane, invisible
            canFloat: true,
            title: '<i class="icon-large

icon-road">  clusterMap', path: 'widgets/PointClustering2', position: 18, open: false, options: { map: true, url: ' https://gis.AAAAAA.net/AAAAA/rest/services/AAAFacilities/Facilities_Prgm/MapServer/0 ' } },

basically in the initClusterLayer method, instead of getting the layer info from topic, you can get that using this.url

I tried to use an array, but no success, the map only shows the first layer cluster

On Fri, Aug 7, 2015 at 3:02 PM, nejohnson27 notifications@github.com wrote:

Ok, so I got the multiple layers working by changing clusterLayer into an array and using clusterLayer[r.subLayer.id]. Just need to figure out the layers defaulting to clustered.

— Reply to this email directly or view it on GitHub https://github.com/ERS-Long/PointClustering/issues/1#issuecomment-128819635 .

ERS-Long commented 9 years ago

Yes, that is a good enhancement. Please let us know if it is possible. Thanks.

On Fri, Aug 7, 2015 at 3:50 PM, Tim McGee notifications@github.com wrote:

Hmmmm. So I am wondering how could we add ClusterFeatureLayer or other custom layer as a supported layer type in the cmv Controller.

Tim strokes his beard while contemplating the possibilities...

— Reply to this email directly or view it on GitHub https://github.com/ERS-Long/PointClustering/issues/1#issuecomment-128831487 .

tmcgee commented 9 years ago

@ERS-Long FYI: There was no file attached.

ERS-Long commented 9 years ago

Hi, Tim:

The attachment is for the following email, approached to show a cluster map by default.

---------- Forwarded message ---------- From: Long Ma long.d.ma@gmail.com Date: Fri, Aug 7, 2015 at 7:59 PM Subject: Re: [PointClustering] Default Clustered (#1) To: ERS-Long/PointClustering < reply@reply.github.com

I got a new widget it should show the cluster by default.

But i can only get one layer working, please see if you can make a change to show multiple layers at the same time. I would like to know.

put the attached file in the widget folder

also in the viewer.js

add the following config setting

        clusterMap2: {
            include: true,
            id: 'clusterMap2',
            type: 'titlePane', //titlePane, invisible
            canFloat: true,
            title: '<i class="icon-large

icon-road">  clusterMap', path: 'widgets/PointClustering2', position: 18, open: false, options: { map: true, url: ' https://gis.AAAAAA.net/AAAAA/rest/services/AAAFacilities/Facilities_Prgm/MapServer/0 https://gis.aaaaaa.net/AAAAA/rest/services/AAAFacilities/Facilities_Prgm/MapServer/0 ' } },

basically in the initClusterLayer method, instead of getting the layer info from topic, you can get that using this.url

I tried to use an array, but no success, the map only shows the first layer cluster

On Sat, Aug 8, 2015 at 10:26 AM, Tim McGee notifications@github.com wrote:

@ERS-Long https://github.com/ERS-Long FYI: There was no file attached.

— Reply to this email directly or view it on GitHub https://github.com/ERS-Long/PointClustering/issues/1#issuecomment-128989799 .

green3g commented 9 years ago

@tmcgee with regards to adding custom layer types would something like this be a possibility:

Config:

{
            type: 'custom',
            path: 'gis/layers/CustomLayerType',
            url: 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0',
            title: 'San Francisco 311 Incidents',
            options: {
                //custom layer options
            }
  },

Also the controller would have to be changed:

array.forEach(this.config.operationalLayers, function (layer) {
    if(layer.type == 'custom') {
        require([layer.path], lang.hitch(this, 'initLayer', layer));
    } else {
        var type = layerTypes[layer.type];
        if (type) {
            require(['esri/layers/' + type + 'Layer'], lang.hitch(this, 'initLayer', layer));
        }
    }
}, this);
velcroMustacho commented 7 years ago

@ERS-Long I don't see an attachment for the default cluster option... Can you please share?

ERS-Long commented 7 years ago

That widget is kind of old, as an alternative, please try Tim’s new approach using esri js api feature service layer new method in that regard. It is in the current develop branch of cmv code. I tried and it works very well, all you have to do is to config it.

Sent from my iPhone

On Oct 30, 2017, at 3:04 PM, velcroMustacho notifications@github.com wrote:

@ERS-Long I don't see an attachment for the default cluster option... Can you please share?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

velcroMustacho commented 7 years ago

@ERS-Long thanks! do you have a link?

ERS-Long commented 7 years ago

It is in the cmv git hub page, select the code tab

Sent from my iPhone

On Oct 30, 2017, at 4:15 PM, velcroMustacho notifications@github.com wrote:

@ERS-Long thanks! do you have a link?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.