BrianBunker / cmv-widgets

Widgets based on the Esri jsapi, configured for the Configurable Map Viewer. Widgets include Drag and Drop, Goto, Map Navigation Hash, and Nearby.
https://brianbunker.github.com/cmv-widgets
MIT License
18 stars 24 forks source link

Adding service in layer control through dnd widget #33

Open deepal13 opened 8 years ago

deepal13 commented 8 years ago

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

tmcgee commented 8 years ago

@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.

deepal13 commented 8 years ago

@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?

tmcgee commented 8 years ago

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.

deepal13 commented 8 years ago

@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

tmcgee commented 8 years ago

@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 commented 8 years ago

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

tmcgee commented 8 years ago

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

deepal13 commented 8 years ago

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

tmcgee commented 8 years ago

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

deepal13 commented 8 years ago

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

tmcgee commented 8 years ago

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

image

deepal13 commented 8 years ago

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

Can you please share the code link?

tmcgee commented 8 years ago

@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.

deepal13 commented 8 years ago

@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.

tmcgee commented 8 years ago

@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 commented 8 years ago

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

deepal13 commented 8 years ago

@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 commented 8 years ago

@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

tmcgee commented 8 years ago

@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.