POST
|
Tom, I guess you can use dojo/promise/all in this scenario. zoomToFeature(feature){
return this.map.setExtent(feature.geometry.getExtent()) //assuming geometry is polyline or polygon
};
var promises = [];
features.forEach(function(gFeature){
promises.push(this.zoomToFeature(gFeature)
.then(lang.hitch(this, this.sendToPrinter_SoilErosion))
.then(lang.hitch(this, this.zoombuffer))
.then(lang.hitch(this, this.sendToPrinter_SoilErosion)));
});
all(promises).then(function(results){
console.log("all features printed");
}); Hopefully this will work not sure though. Just give it a try. -Girish
... View more
01-13-2016
09:24 PM
|
0
|
1
|
496
|
POST
|
Chris, We have a Sign-In widget in WAB app which loads at the startup covering the app viewport. This widget ask for AGOL credentials and authenticate with the AGOL account that is set in the WAB configuration. _signIn: function(userName, password) {
if(!userName || !password) return;
var serverInfo = new ServerInfo();
serverInfo.server = this.appConfig.portalUrl;
serverInfo.tokenServiceUrl = this.appConfig.portalUrl + "/sharing/rest/generateToken";
var userInfo = {
username: userName,
password: password
}
var def = window.esri.id.generateToken(serverInfo, userInfo);
def.then( lang.hitch(this, this._signInComplete), lang.hitch(this, this._signInFailed));
} The benefits of using this design is that the user, roles and groups can be easily managed on AGOL or AGS. And Sign-In UI can be styled as desired. OAuth authentication can also be used but. We observed that OAuth authentication using IdentityManager does not provide much flexibility with the UI. Though IdentityManagerBase can be used to modify the style of the UI but it redirects to AGOL oauth, therefore the overlay effect is lost. -Girish
... View more
01-13-2016
08:54 PM
|
8
|
2
|
2384
|
POST
|
Mihkel, PrintTemplate.preserveScale = true; should solve this issue. -Girish
... View more
01-13-2016
12:48 AM
|
1
|
1
|
826
|
POST
|
Iris, Assign a layerDefinition to the MapServiceLayer. -Girish
... View more
01-13-2016
12:08 AM
|
1
|
0
|
299
|
POST
|
Shazia, The Legend dijit respect the layer visibility on the map. Therefore, if you just hide the FSM layer it should not be visible on the legend. The layer will NOT be removed from the map it will just be hidden. Layer.visible = false; OR Layer.hide(); -Girish
... View more
01-11-2016
05:39 PM
|
1
|
0
|
1277
|
POST
|
Tom, You need to remove the parentheses from the function call inside lang.hitch. Wrong notation: .then(lang.hitch(this, this.sendToPrinter_Test())); Correct notation: .then(lang.hitch(this, this.sendToPrinter_Test)); putting in parentheses is calling print function immediately. before the map extent gets change. -Girish
... View more
01-11-2016
04:02 PM
|
0
|
4
|
496
|
POST
|
Oh, Is there any useful message in the proxy log file? If you haven't yet enabled it do it as follows: <ProxyConfig allowedReferers="*" mustMatch="true" logFile="proxylog.txt">
... View more
01-11-2016
02:31 PM
|
0
|
1
|
1465
|
POST
|
If alwaysUseProxy is set to false then set the proxyRules. Add your secured service url to the proxy rules: esri.urlUtils.addProxyRule({ proxyUrl : "https://mygisserver/arcgis/rest/services", urlPrefix : "https://appserver/proxy/proxy.ashx" }) -Girish
... View more
01-11-2016
01:56 PM
|
1
|
4
|
1465
|
POST
|
Chris, esri.config.defaults.io.useCors should be false or the default value "with-credentials" . if its true it will prevent the AJAX calls through proxy. -Girish
... View more
01-11-2016
01:06 PM
|
0
|
7
|
1465
|
POST
|
Chris, In the chrome's Developer Tools go to Network tab and check if the call to feature layer is going through proxy or not? something lilke this: https://appserver/proxy/proxy.ashx?https://mygisserver/arcgis/rest/services/base_services/test/MapServer/0 Also, are you setting the proxy url in esriConfig esriConfig.defaults.io.proxyUrl = "https://appserver/proxy/proxy.ashx " -Girish
... View more
01-11-2016
10:50 AM
|
0
|
9
|
1465
|
POST
|
oh yes, I quickly just compiled this code to show how can you change the infoWindow. However following is more complete example: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Popup</title> <link rel="stylesheet" href="https://js.arcgis.com/3.15/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.15/esri/css/esri.css"> <style> html, body, #map { padding: 0; margin: 0; height: 100%; } /* Change color of icons to match bar chart and selection symbol */ .esriPopup.dark div.titleButton, .esriPopup.dark div.titlePane .title, .esriPopup.dark div.actionsPane .action { color: #A4CE67; } /* Additional customizations */ .esriPopup.dark .esriPopupWrapper { border: none; } .esriPopup .contentPane { text-align: center; } .esriViewPopup .gallery { margin: 0 auto; } </style> <script src="https://js.arcgis.com/3.15/"></script> <script> var map, defualtPopup; require([ "esri/map", "esri/dijit/Popup", "esri/dijit/InfoWindow", "esri/dijit/PopupTemplate", "esri/layers/FeatureLayer", "esri/symbols/SimpleFillSymbol", "esri/Color", "dojo/dom-class", "dojo/dom-construct", "dojo/on", "dojox/charting/Chart", "dojox/charting/themes/Dollar", "dojo/domReady!" ], function( Map, Popup, InfoWindow, PopupTemplate, FeatureLayer, SimpleFillSymbol, Color, domClass, domConstruct, on, Chart, theme ) { //The popup is the default info window so you only need to create the popup and //assign it to the map if you want to change default properties. Here we are //noting that the specified title content should display in the header bar //and providing our own selection symbol for polygons. var fill = new SimpleFillSymbol("solid", null, new Color("#A4CE67")); var infoWindow = new InfoWindow({}, domConstruct.create("div")); infoWindow.startup(); var popup = new Popup({ fillSymbol: fill, titleInBody: false }, domConstruct.create("div")); //Add the dark theme which is customized further in the <style> tag at the top of this page domClass.add(popup.domNode, "dark"); map = new Map("map", { basemap: "gray", center: [-98.57, 39.82], zoom: 4, infoWindow: popup }); defaultPopup = map.infoWindow; map.on("click", function(evt){ if(!evt.graphic){ map.setInfoWindow(infoWindow); //This line is only needed if you want to switch the infoWindow //Change the content only if do not want to change the appearance of infoWindow. map.infoWindow.setContent("<div>I am no where</div>"); map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); } map.setInfoWindow(defaultPopup); }); popup.on("show", function(){ infoWindow.hide(); }); var template = new PopupTemplate({ title: "Boston Marathon 2013", description: "{STATE_NAME}: {Percent_Fi} of starters finished", fieldInfos: [{ //define field infos so we can specify an alias fieldName: "Number_Ent", label: "Entrants" },{ fieldName: "Number_Sta", label: "Starters" },{ fieldName: "Number_Fin", label: "Finishers" }], mediaInfos:[{ //define the bar chart caption: "", type:"barchart", value:{ theme: "Dollar", fields:["Number_Ent","Number_Sta","Number_Fin"] } }] }); var featureLayer = new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Boston_Marathon/FeatureServer/0",{ mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"], infoTemplate: template }); map.addLayer(featureLayer); }); </script> </head> <body class="claro"> <div id="map"></div> </body> </html> Thanks, Girish
... View more
01-08-2016
03:16 PM
|
1
|
0
|
673
|
POST
|
Hi Tracy, The InfoWindow and Popup are essentially same things. Popup is an implementation of InfoWindow that has few more features. Both are just a container therefore in most cases just changing the content (InfoWindow/Popup.setContent()) is enough. But if you have a custom popup/InfoWindow that you want to switch. Then use Map.setInfoWindow(customInfoWindow) This method is not mentioned in the API documentation but its there. here is a small example: This attaches an event handler on map click and check whether its clicked on any feature or not. If its not on any feature it changes the info window and its contents. you can insert any logic here. Or if you want the same thing can be done on Layer's OnClick also. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Popup</title> <link rel="stylesheet" href="https://js.arcgis.com/3.15/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.15/esri/css/esri.css"> <style> html, body, #map { padding: 0; margin: 0; height: 100%; } /* Change color of icons to match bar chart and selection symbol */ .esriPopup.dark div.titleButton, .esriPopup.dark div.titlePane .title, .esriPopup.dark div.actionsPane .action { color: #A4CE67; } /* Additional customizations */ .esriPopup.dark .esriPopupWrapper { border: none; } .esriPopup .contentPane { text-align: center; } .esriViewPopup .gallery { margin: 0 auto; } </style> <script src="https://js.arcgis.com/3.15/"></script> <script> var map; require([ "esri/map", "esri/dijit/Popup", "esri/dijit/InfoWindow", "esri/dijit/PopupTemplate", "esri/layers/FeatureLayer", "esri/symbols/SimpleFillSymbol", "esri/Color", "dojo/dom-class", "dojo/dom-construct", "dojo/on", "dojox/charting/Chart", "dojox/charting/themes/Dollar", "dojo/domReady!" ], function( Map, Popup, InfoWindow, PopupTemplate, FeatureLayer, SimpleFillSymbol, Color, domClass, domConstruct, on, Chart, theme ) { //The popup is the default info window so you only need to create the popup and //assign it to the map if you want to change default properties. Here we are //noting that the specified title content should display in the header bar //and providing our own selection symbol for polygons. var fill = new SimpleFillSymbol("solid", null, new Color("#A4CE67")); var infoWindow = new InfoWindow({}, domConstruct.create("div")); infoWindow.startup(); var popup = new Popup({ fillSymbol: fill, titleInBody: false }, domConstruct.create("div")); //Add the dark theme which is customized further in the <style> tag at the top of this page domClass.add(popup.domNode, "dark"); map = new Map("map", { basemap: "gray", center: [-98.57, 39.82], zoom: 4, infoWindow: popup }); map.on("click", function(evt){ if(!evt.graphic){ map.setInfoWindow(infoWindow); //This line is only needed if you want to switch the infoWindow //Change the content only if do not want to change the appearance of infoWindow. map.infoWindow.setContent("<div>I am no where</div>"); map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); } }) var template = new PopupTemplate({ title: "Boston Marathon 2013", description: "{STATE_NAME}: {Percent_Fi} of starters finished", fieldInfos: [{ //define field infos so we can specify an alias fieldName: "Number_Ent", label: "Entrants" },{ fieldName: "Number_Sta", label: "Starters" },{ fieldName: "Number_Fin", label: "Finishers" }], mediaInfos:[{ //define the bar chart caption: "", type:"barchart", value:{ theme: "Dollar", fields:["Number_Ent","Number_Sta","Number_Fin"] } }] }); var featureLayer = new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Boston_Marathon/FeatureServer/0",{ mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"], infoTemplate: template }); map.addLayer(featureLayer); }); </script> </head> <body class="claro"> <div id="map"></div> </body> </html> Let me know if that help. Enjoy!
... View more
01-08-2016
01:13 PM
|
1
|
2
|
673
|
POST
|
To access ArcGIS secured services through proxy without prompting for credentials. In the proxy.config add the <serverUrl> with credentials <serverUrl url="https://yourGISServer.domain/arcgis/rest/services/" matchAll="true" username="siteadmin" password="siteadmin"/> Note: When doing this its important to set the allowedReferers property as well to limit the access to the proxy itself. These are the esri proxy configurations mentioned on github: allowedReferers="http://server.com/app1,http://server.com/app2" : A comma-separated list of referer URLs. Only requests coming from referers in the list will be proxied. See https://github.com/Esri/resource-proxy/issues/282for detailed usage. username: Username to use when requesting a token - if needed for ArcGIS Server token based authentication. password: Password to use when requesting a token - if needed for ArcGIS Server token based authentication. Thanks, -Girish
... View more
01-08-2016
11:34 AM
|
1
|
0
|
2130
|
POST
|
Yeah, promises are a really cool stuff and much cleaner way to write asyc code. Now its gonna be in limelight in ArcGIS JS API 4.0
... View more
01-08-2016
11:19 AM
|
0
|
0
|
496
|
POST
|
You need to lang.hitch the calls to these functions to set the execution scope. add "dojo/_base/lang" to the imports and onTest: function () { this.zoombuffer() .then(lang.hitch(this, this.zoomselected)) .then(lang.hitch(this, this.zoombuffer)); }, -Girish
... View more
01-08-2016
11:06 AM
|
1
|
7
|
1002
|
Title | Kudos | Posted |
---|---|---|
1 | 01-05-2016 09:37 PM | |
1 | 07-29-2016 02:46 AM | |
1 | 01-19-2016 05:54 PM | |
1 | 01-18-2016 10:51 PM | |
1 | 01-08-2016 11:34 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|