Hi Guys
I am very new to arcgs and have a couple of questions.
1. I am accessing a saved arcgs map using the call back for function createmap. I have added the basemap gallery to the map and this works and changes the base map without any problems. The only issue is that the basemap image gallery is not displaying the thumbnails. Are there any known issues with his?
2. Is there a way / widget for the layer selector that can be added?
3. Is there a way / widget for the search box?
4. Is there an example of passing the username and password to create map to avoid the authentication challenge. Have seen some posts about using OAuth but could not quite get that to work.
The map looks like attached
[ATTACH=CONFIG]34178[/ATTACH]
Ta,
D
Hi Guys
I am very new to arcgs and have a couple of questions.
1. I am accessing a saved arcgs map using the call back for function createmap. I have added the basemap gallery to the map and this works and changes the base map without any problems. The only issue is that the basemap image gallery is not displaying the thumbnails. Are there any known issues with his?
2. Is there a way / widget for the layer selector that can be added?
3. Is there a way / widget for the search box?
4. Is there an example of passing the username and password to create map to avoid the authentication challenge. Have seen some posts about using OAuth but could not quite get that to work.
The map looks like attached
[ATTACH=CONFIG]34178[/ATTACH]
Ta,
D
Hi Guys
I am very new to arcgs and have a couple of questions.
1. I am accessing a saved arcgs map using the call back for function createmap. I have added the basemap gallery to the map and this works and changes the base map without any problems. The only issue is that the basemap image gallery is not displaying the thumbnails. Are there any known issues with his?
2. Is there a way / widget for the layer selector that can be added?
3. Is there a way / widget for the search box?
4. Is there an example of passing the username and password to create map to avoid the authentication challenge. Have seen some posts about using OAuth but could not quite get that to work.
The map looks like attached
[ATTACH=CONFIG]34178[/ATTACH]
Ta,
D
ready(function () { parser.parse(); var basemapGallery = new BasemapGallery({ showArcGISBasemaps: true, map: map }, "basemapGallery"); basemapGallery.startup(); // The web map id would need to be pulled from the database in a callback function arcgisUtils.createMap("mapid", "map").then(function (response) { // Update HTML display fields dom.byId("title").innerHTML = response.itemInfo.item.title; // + ' - ' + response.itemInfo.item.snippet; dom.byId("subtitle").innerHTML = response.itemInfo.item.snippet; var map = response.map; map.setBasemap('aa'); //////////////////////////////////////////////////////////////////////////////////// // Add map controls var scalebar = new Scalebar({map: map, scalebarUnit: "english"}); var home = new HomeButton({map: map}, "HomeButton"); home.startup(); // Assign to map to basemap basemapGallery.map = map; var geocoder = new Geocoder({map: map}, "search"); geocoder.startup(); var legendLayers = arcgisUtils.getLegendLayers(response); var legendDijit = new Legend({map: map, layerInfos: legendLayers}, "legend"); legendDijit.startup(); //////////////////////////////////////////////////////////////////////////////////// // Do the layers tick boxes var layers = response.itemInfo.itemData.operationalLayers; array.forEach(layers, function (layer) { new CheckBox({ id: "cb_" + layer.id, name: "cb_" + layer.id, checked: true, onChange: function (bool) { bool ? map.getLayer(this.id.split("_")[1]).show() : map.getLayer(this.id.split("_")[1]).hide(); } }, domConstruct.create("input", { id: "lyr_" + layer.id })).placeAt(dom.byId("layertoggle")); // create a label for the check box var label = domConstruct.create('label', { "for": "cb_" + layer.id, "id": "lbl_" + layer.id, "innerHTML": layer.title }); domConstruct.place(label, dom.byId("layertoggle")); domConstruct.place(domConstruct.create("br"), dom.byId("layertoggle")); domConstruct.place(domConstruct.create("br"), dom.byId("layertoggle")); }); }); });
I am guessing item 1 is a bug because when I look at the source of the image src I get an error saying the request is not run over ssl. Changing the url to https then retrieves the image.
If I move the basemap image gallery outside of the createmap call back then it works (obviously requires a valid map for this to work).
Ideas?
Ta,
D
glad to hear you were able to sort yourself out daniel! thanks for taking the time to share the solutions.
daniel,
it would definitely be simpler, but it wouldn't be very secure to store usernames and passwords in your application source. 🙂
if you'd like to authenticate on behalf of your end users, you should be using a proxy.
the sample below doesn't spin up using createMap(), but comparable logic is used to force requests to a subscription routing service through a proxy which generates a token dynamically.
directions
https://developers.arcgis.com/javascript/jssamples/widget_directions_basic.html
Hi John
Well they would not have to be stored in the source code as they would come from a database. In this case it does not really matter though as all the users know the logins (app is internal use only, that said they do not know someone else's login). Anyway does not matter if it can't so long as there is a way as having the challenge would really annoy my end users.
Will have a look at the proxy and re-post later.
Thanks for taking the time to respond,
D