cmv-widgets icon indicating copy to clipboard operation
cmv-widgets copied to clipboard

Adding service in layer control through dnd widget

Open deepal13 opened this issue 9 years ago • 19 comments
trafficstars

Hello Brian,

I am using your dnd widget to add shape file and services. Is it possible to show the added service in the layer control menu? The purpose is to turn on/off the layers in the service.

Thanks

deepal13 avatar Jul 07 '16 17:07 deepal13

@deepal13 Support for adding layers/services to the layerControl widget using topic publish/subscribe was added to cmv in the current develop branch in the cmv repo. If you are using that version of cmv with the layerControl widget and the dnd widget, the layer/service will be added automatically.

tmcgee avatar Jul 07 '16 19:07 tmcgee

@tmcgee I just downloaded the code from https://github.com/BrianBunker/cmv-widgets and tried it. It didn't add it to layer control. Am I referring the wrong link?

deepal13 avatar Jul 07 '16 19:07 deepal13

That DnD widget is the correct version. However, at present this will only work with the layerControl widget found in the un-released develop branch of cmv.

tmcgee avatar Jul 07 '16 19:07 tmcgee

@tmcgee I downloaded the code from the link you provided. The widget adds the service but in layerControl widget it doesn't expand to show all its layers.

dndscreenshot

deepal13 avatar Jul 08 '16 00:07 deepal13

@deepal13 I have a few changes to both the layerControl and Dnd widgets to handle more Service types and better error handling. I will be submitting PRs for both in this repo and in the cmv repo.

tmcgee avatar Jul 08 '16 18:07 tmcgee

@deepal13 PR #34 which has already been committed addresses the changes needed to the Dnd widget.

tmcgee avatar Jul 08 '16 19:07 tmcgee

@deepal13 Here's the pending PR in the cmv repo that addresses the changes needed to the layerControl widget.

tmcgee avatar Jul 08 '16 19:07 tmcgee

@tmcgee I tried the updated code, it still adds in drag-n-drop widget. Can you please check once? Thanks

deepal13 avatar Aug 05 '16 20:08 deepal13

@deepal13 Do you have an example service that demonstrates the issue?

tmcgee avatar Aug 05 '16 22:08 tmcgee

@tmcgee I added the following service: http://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/guidance_model_ocean_grtofs_offsets/MapServer image

deepal13 avatar Aug 05 '16 22:08 deepal13

@deepal13 I don't see any issues with adding that service with DnD:

image

tmcgee avatar Aug 05 '16 22:08 tmcgee

I downloaded the code from: https://github.com/BrianBunker/cmv-widgets.

Can you please share the code link?

deepal13 avatar Aug 05 '16 22:08 deepal13

@deepal13 That is correct for the DnD widget. For the layerControl widget, you will need to use the code from the develop branch of cmv. Here is a working example that will be running for a few days.

tmcgee avatar Aug 05 '16 22:08 tmcgee

@tmcgee It is working now but as soon as I turn on/off any layer of the added service, the service vanishes from map and doesn't turn back on. I am using everything from develop branch and have added dnd folder in viewer/dijit.

deepal13 avatar Aug 05 '16 23:08 deepal13

@deepal13 I see the behavior you describe. This is because the DnD widget assigns the url of the service as the layer id. Instead of using the url, I think it would be better to assign a random id such as what happens for other types such as shape files or exclude the id and let the map assign one like Layer123.

tmcgee avatar Aug 06 '16 00:08 tmcgee

@deepal13 Try again with the latest DnD widget. Yesterday I added code to create layer IDs instead using the url.

tmcgee avatar Aug 08 '16 18:08 tmcgee

@tmcgee It works fine now. Thank you so much. I want to request you to please add a feature to change color/symbols of layer. Thanks again.

deepal13 avatar Aug 08 '16 19:08 deepal13

@tmcgee I am having trouble with printing. When I am using a secure service with proxy setup, the print fails giving error. error Error: Unable to complete operation. at Error (native) at Object.g.load (https://js.arcgis.com/3.17compact/init.js:663:426) at https://js.arcgis.com/3.17compact/init.js:87:450 at c (https://js.arcgis.com/3.17compact/init.js:103:393) at d (https://js.arcgis.com/3.17compact/init.js:103:182) at resolve.callback (https://js.arcgis.com/3.17compact/init.js:105:10) at c (https://js.arcgis.com/3.17compact/init.js:104:96) at d (https://js.arcgis.com/3.17compact/init.js:103:182) at resolve.callback (https://js.arcgis.com/3.17compact/init.js:105:10) at https://js.arcgis.com/3.17compact/init.js:92:118

deepal13 avatar Aug 10 '16 18:08 deepal13

@deepal13 This is not the right place for new requests or asking for support other than for @BrianBunker widgets. Please submit your issues at the cmv-app repo or post questions on gis.stackexchange.

tmcgee avatar Aug 10 '16 18:08 tmcgee