POST
|
I am working on an application that uses the ArcGIS JavaScript API 3.x for a map. I have a default print service and secure map services that require a token for access. Both the print service and map services are in the same group in the portal. To handle token-based authentication, I have configured the proxy and included the following in my HTML: esri.config.defaults.io.proxyUrl = "../proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true; In my proxy.config file, I have the following entries: <serverUrl url="https://myserver.com/gis/rest/services/Utilities/PrintingTools/GPServer/" username="myUser" password="myPassword" matchAll="true" /> <serverUrl url="https://myserver.com/gis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" username="myUser" password="myPassword" matchAll="true" /> <!-- Uncommented the below if needed --> <!-- <serverUrl url="https://myserver.com/portal/sharing/rest/generateToken" username="myUser" password="myPassword" matchAll="true" /> --> <serverUrl url="https://myserver.com/gis/rest/services/Utilities/Geometry/GeometryServer" matchAll="true" /> <serverUrl url="https://myserver.com/gis/rest/services/MapsFeatureServer/" username="myUser" password="myPassword" matchAll="true" /> I’ve implemented the following logic to append a token to the FeatureServer URLs of the map layers before executing the print task: var token = 'your_token_here'; var params = new PrintParameters(); params.map = this.map; // Add token to each layer URL if it matches "FeatureServer" Object.values(params.map._layers).forEach(layer => { if (layer.url && layer.url.includes("FeatureServer")) { // Append the token as a query parameter if (!layer.url.includes("token=")) { layer.url += (layer.url.includes("?") ? "&" : "?") + `token=${token}`; console.log(`Token added to layer: ${layer.url}`); } } }); // Now proceed with the print task var printTask = new PrintTask(printURL); var ptemplate = new PrintTemplate(); ptemplate.exportOptions = { width: 500, height: 500, dpi: 96 }; ptemplate.layout = "MAP_ONLY"; params.template = ptemplate; // Execute the print task printTask.execute(params, lang.hitch(this, this.PrintComplete), lang.hitch(this, this.printError) ); Issue: Even though I’ve added the token to the FeatureServer layer URLs dynamically, the print task fails with the following error: Error executing tool. Export Web Map Task: Failed to create layer from service at <FeatureServer_URL>. Failed to execute (Export Web Map). What I’ve Tried: Adding the token dynamically to FeatureServer layer URLs before initiating the print task. Verifying that the token is valid. Ensuring that both the print service and map services are in the same group in the portal. Question: Is dynamically appending the token to the layer URLs before the print task execution the correct approach? If not, what is the recommended way to handle secure services in a print task? Any guidance or recommendations would be greatly appreciated!
... View more
11-22-2024
10:43 AM
|
0
|
0
|
115
|
POST
|
Product: I'm currently using ArcGIS Pro version 3.2. Backend Database: SQL Attached Image I am working on adding an attribute rule to a feature class using Arcade Expression. The feature class in question is 'FeatureClassA' with Point Geometry, and I am specifically looking to add an attribute rule named 'RuleA'. Within 'FeatureClassA,' there exists a field named 'countryCode.' Additionally, there is another feature class named 'CountryCodeFeatureClass' which contains the Polygon Geometry of all countries. Am trying to, upon inserting a record into 'FeatureClassA,' performs an overlay/intersection operation with the second feature class 'CountryCodeFeatureClass.' The resulting value should then be updated in the 'countryCode' field of 'FeatureClassA.' Thank you in advance for any guidance or assistance provided.
... View more
12-19-2023
11:33 AM
|
0
|
0
|
507
|
POST
|
With below code, am just trying to add a point/Polyline on the map Spatial Reference is 2881 for Example POINT (914723.27587074414 524669.72858949) and PolyLine(912367.09095057845 525239.943328321, 912374.28713041171 525217.16023740917) I tried, symbology is not showing up <!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>Shapes and Symbols</title> <link rel="stylesheet" href="https://js.arcgis.com/3.29/esri/css/esri.css"> <style> #info { top: 20px; color: #444; height: auto; font-family: arial; right: 20px; margin: 5px; padding: 10px; position: absolute; width: 115px; z-index: 40; border: solid 2px #666; border-radius: 4px; background-color: #fff; } html, body, #mapDiv { padding: 0; margin: 0; height: 100%; } button { display: block; } </style> <script src="https://js.arcgis.com/3.29/"></script> <script> var map, tb; require([ "esri/map", "esri/toolbars/draw", "esri/symbols/SimpleMarkerSymbol", "esri/graphic", "esri/geometry/Point", "esri/SpatialReference", "esri/Color", "dojo/domReady!" ], function ( Map, Draw, SimpleMarkerSymbol, Graphic, Point, SpatialReference, Color ) { map = new Map("mapDiv", { basemap: "streets", zoom: 3 }); var markerSymbol = new SimpleMarkerSymbol(); markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z"); markerSymbol.setColor(new Color("#00FFFF")); var symbol; symbol = markerSymbol; var point = new Point([524669.72858949, 914723.2758707441], new SpatialReference({ wkid: 2881 })); map.graphics.add(new Graphic(point, symbol)); }); </script> </head> <body> <div id="mapDiv"></div> </body> </html>
... View more
05-24-2023
05:18 PM
|
0
|
1
|
658
|
POST
|
I have a dashboard with 10 layers, By default web map properties layer 1 is selected. Requirement is, when a user select/deselect layer 8... result should be Layer 10 should be automatically selected. Is this functionality doable in dashboard actions or from embedded content javascript onChange events.
... View more
10-05-2022
05:57 AM
|
0
|
0
|
421
|
POST
|
in 10.3 server some of my apps configured to get token from httpGet with these sample format url, i used to generate token by passing values, https://abc.123.com/webAdapterName/tokens/generateToken recently we upgraded to 10.8 enterprise portal architecture https://Newabc.123.com/webAdapterName/tokens/generateToken the message i get is "HTTP GET is disabled" from this page Enable token acquisition through an HTTP GET request—ArcGIS Server | Documentation for ArcGIS Enterprise , i added " "allowHttpGet": "true"" and updated the token. after that, i get result as below Any suggestions please, for generating tokens, with the rest api, am trying to use it in c# Thanks
... View more
11-02-2020
11:41 AM
|
0
|
2
|
1958
|
POST
|
Shared a standalone table as hosted service in the arcgis portal. After publishing, i noticed data is copied to server and my data changes every week. how to create automate process in python or any other available options to update data. when i published a table, it created two items in my content section, Service Definition and Table(hosted) Any suggestions Thank you
... View more
07-22-2020
08:42 AM
|
1
|
0
|
749
|
POST
|
acgis 10.8 I have six services with table in it, no layers. I'm looking to combine six services into one service with six tables. performance wise will there a difference? Now: https://domain.com/rest/services/service1/MapServer/0 --table1 https://domain.com/rest/services/service2/MapServer/0 --table2 https://domain.com/rest/services/service3/MapServer/0 --table3 https://domain.com/rest/services/service4/MapServer/0 -- table4 https://domain.com/rest/services/service5/MapServer/0 --table5 https://domain.com/rest/services/service6/MapServer/0 --table6 Trying to https://domain.com/rest/services/Service1/MapServer/0 --table1 https://domain.com/rest/services/Service1/MapServer/1 --table2 https://domain.com/rest/services/Service1/MapServer/2 --table3 https://domain.com/rest/services/Service1/MapServer/3 --table4 https://domain.com/rest/services/Service1/MapServer/4 --table5 https://domain.com/rest/services/Service1/MapServer/5 --table6 Thanks
... View more
06-30-2020
07:10 AM
|
0
|
1
|
1068
|
POST
|
Arcade, Custom Attribute Expression, popup I used the below code to get the nearest one location from $feature, but i'm looking now to get nearest 4 records from $feature. I tried with json object, arrayList, but having syntax errors. Not sure about the limitations of customization in Arcade var searchDist = 6000;
var storeAddress = Intersects(FeatureSetById($map, "storeAddressFeaturelayer_2246"), Buffer( $feature, searchDist, "meters"));
var cnt = Count(storeAddress);
var x=0;
var nearestaddress;
var neardistance=0;
var addressDist=0;
for (var f in storeAddress {
addressDist = Round(Distance(f, $feature, "meters"),3);
if(x==0){
neardistance=addressDist;
nearestaddress = f.Address+", "+f.PhoneNumber;
}
if(neardistance>addressDist && x==1){
neardistance=addressDist;
nearestaddress = f.Address +", "+f.PhoneNumber;
}
x=1;
}
return nearestaddress; Any Suggestions
... View more
05-22-2020
10:25 AM
|
0
|
2
|
2006
|
POST
|
I used the similar code in arcade to find the nearest address point(Using Arcade to Find the Nearest Address Point ) My question is does the distance calculated by buffer and route service are same or almost same or is it possible to find nearest distance from $feature to address var searchDist = 200;
var addresses = Intersects(FeatureSetById($map, "Primary_Address_3482"), Buffer( $feature, searchDist, "feet"));
var cnt = Count(addresses)
Console("Total Number of addresses within buffer: " + cnt);
var nearestaddress;
var min_dist = 250;
for (var f in addresses){
var addressDist = Round(Distance(f, $feature, "feet"),2);
if (addressDist < min_dist) {
nearestaddress = f.FULL_ADDR;
min_dist = addressDist;
}
Console(f.FULL_ADDR + ": " + " " + addressDist);
}
return nearestaddress; Xander Bakker Thanks
... View more
05-21-2020
03:12 PM
|
0
|
1
|
1106
|
POST
|
I'm new to ArcObjects, not a GIS professional so please be patient with my lack of GIS knowledge. I have an .Net Web application with ESRI.ARCGIS.SOAP references, looking to update them with rest. I tried to use esri.arcgisruntime but it was not supported in Asp.net web application project How can I use REST in below code? ESRI.ArcGIS.SOAP.GeometryServerProxy serviceURL= new ESRI.ArcGIS.SOAP.GeometryServerProxy();
serviceURL.URL="Some Service URL";
ESRI.ArcGIS.SOAP.SpatialReference inputSpatialReference = new ESRI.ArcGIS.SOAP.ProjectedCoordinateSystem();
inputSpatialReference.WKID = 3857;
inputSpatialReference.WKIDSpecified = true;
ESRI.ArcGIS.SOAP.SpatialReference outputSpatialReference = new ESRI.ArcGIS.SOAP.GeographicCoordinateSystem();
outputSpatialReference.WKID = 4326;
outputSpatialReference.WKIDSpecified = true;
PointN pnt = new PointN();
pnt.X = X;
pnt.Y = Y;
Geometry[] inputGeometry = new Geometry[] { pnt };
ESRI.ArcGIS.SOAP.GeoTransformation geoTransformer = new ESRI.ArcGIS.SOAP.GeoTransformation();
geoTransformer.WKID = 2236;
ESRI.ArcGIS.SOAP.EnvelopeN envelope = new EnvelopeN();
envelope = null;
Geometry[] outputGeometry = serviceURL.Project(inputSpatialReference, outputSpatialReference, false, geoTransformer, envelope, inputGeometry);
foreach (PointN item in outputGeometry)
{
xyCoord= item.X.ToString() + "," + item.Y.ToString();
}
... View more
12-12-2019
10:18 AM
|
0
|
1
|
1071
|
POST
|
Dan My arcgis pro installed path is C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 and i installed pthon 3.7.3 that path is C:\python3.7.3\ my pyscripter python version in pyscripter is and my python path is to C:\python3.7.3\ Not the Pro installed path i tried to add path (C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 ) in pyscripter it gets added and when i ran the script and the settings agian changes to default can you suggest me Thanks
... View more
08-21-2019
11:29 AM
|
0
|
1
|
7611
|
POST
|
I logged in to My ArcgIS PRo, and in python section, i see version 1.4.1 is that right Thanks
... View more
08-20-2019
01:12 PM
|
1
|
1
|
7613
|
POST
|
Joshua Bixby Thank you for reply I didn't install myself, my team member did, he said it comes with pro and for import arcpy there is no error Thanks
... View more
08-20-2019
10:09 AM
|
0
|
3
|
7613
|
POST
|
I have ArcGIS API for Python installed and when I use below line, am getting error as ModuleNotFoundError: No module named arcgis from arcgis.gis import GIS
... View more
08-20-2019
09:09 AM
|
0
|
8
|
8505
|
Title | Kudos | Posted |
---|---|---|
1 | 04-22-2019 06:52 AM | |
1 | 08-27-2018 09:37 AM | |
1 | 08-20-2019 01:12 PM | |
1 | 12-18-2018 12:17 PM | |
1 | 03-28-2019 08:22 AM |
Online Status |
Offline
|
Date Last Visited |
11-22-2024
08:32 PM
|