|
POST
|
To my knowledge there isn't an easy way to do this. You can create usage reports on how much content is being created but usage on individual services is not straightforward, though Portal or ArcGIS Online. There is an Esri idea where people are asking for something similar: Create Detailed AGOL Usage Report for Every Item If this is for an ArcGIS Enteprise deployment, rather than AGOL then you can get access to ArcGIS Server statistics in Server Manager. There you can view the number of requests for given services. It's not exactly what you are after but it allows you to see which services are getting requests and which are not.
... View more
05-13-2020
07:14 PM
|
2
|
0
|
2605
|
|
POST
|
One thing to check is that your service allows for updates. Go into ArcGIS Server manager and examine the service properties to see if the update operation is permitted. It is usually switched on by default for Feature services, so it would be only if you or someone turned it off.
... View more
05-13-2020
06:59 PM
|
0
|
0
|
2002
|
|
POST
|
I'm presuming you are using v4 of the API? If so, you can hide the Edit feature option through configuration: Editor | ArcGIS API for JavaScript 4.15 const editor = new Editor({ view: view, allowedWorkflows: ["update"] // allows only updates and no adds }); The title of widget buttons is held in strings files within the API. Given that you are probably getting the API from a CDN then you will have to find some way to override the html.
... View more
05-11-2020
10:39 PM
|
1
|
0
|
1045
|
|
POST
|
Is one extent just zoomed in slightly more than the other extent? This can happen when using different sized screens or one browser window is smaller than another. The API does its best to fit the extent into the available screen real estate. This can result in different zoom extents when moving between different screen/browser window sizes.
... View more
05-10-2020
11:40 PM
|
0
|
0
|
718
|
|
POST
|
To my knowledge, I don't believe there is anything in the API (3 or 4) that is going to do exactly what you want, out of the box. I believe it would require some custom effort to achieve. Essentially you want to copy a polyline feature between 2 points, from what I understand. You could do something like the following: - Capture the start and endpoints from the user - Intersect them with features from a given layer to find the closest feature - Make a copy of that feature's geometry - Edit the geometry to start and finish at the start and end points chosen by the user - Apply those edits to your copy layer
... View more
05-07-2020
04:30 PM
|
0
|
1
|
1084
|
|
POST
|
I'm not sure you can choose to use just version 4 of the Javascript API for WAB. Version 4 of the JS API is markedly different from version 3 and requires different code to support it. If you look at the following link it shows that WAB uses v4 for 3D but v3 for 2D: About release versions—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers The link you are referencing is for changing the site of the JS API CDN. For instance, you may host the CDN yourself or choose one that is in a closer locale to your application.
... View more
05-07-2020
12:02 AM
|
1
|
2
|
1241
|
|
POST
|
Are you asking if the ArcGIS for JavaScript API has functionality that allows users to draw a line that automatically snaps to an existing polyline by just selecting the 2 endpoints? If that is your question then I believe that it is not possible (out of the box). Snapping is not currently implemented for editing under version 4 of the API: Functionality matrix | ArcGIS API for JavaScript 4.15 Under version 3, the Editor widget supports snapping but you would need to click on each of the polyline's vertexes to overlay your polyline exactly. You can see the Editor widget snapping in action at this line (press Cntrl to enable snap): ArcGIS API for JavaScript Sandbox Mark
... View more
05-06-2020
11:32 PM
|
0
|
3
|
1084
|
|
POST
|
While it might be possible to find a way to do this in model builder I would recommend that you use Python for complex iterations, such as recursion. You have much more programming flexibility there.
... View more
05-06-2020
05:30 PM
|
0
|
0
|
1652
|
|
POST
|
From my understanding, Spatial Join only takes 2 feature classes/layers, so you would end up with one for every point fc. Perhaps you could merge your point fcs into a temporary fc and then do a spatial join it to Ug?
... View more
05-05-2020
11:57 PM
|
0
|
2
|
1652
|
|
POST
|
Are your map service layers using views or feature classes?
... View more
05-05-2020
11:38 PM
|
0
|
1
|
1077
|
|
BLOG
|
Hello, Recently I needed to upload a file to a geoprocessing service using the ArcGIS JavaScript API V4 but had trouble finding a concise road map on how to achieve this. After knocking my knees on the undergrowth I am writing this blog post so you can travel the road in comfort. I note that others have provided information for this using v3 of the API but there are some differences that this post explores relating to v4. The Problem: Need to upload a file to a geoprocessing service Using the ArcGIS JavaScript API v4 on the client The Solution Overview: Create a geoprocessing tool that takes a file as a parameter Publish the tool as a geoprocessing service with the option to Upload enabled In the JS code have a way of prompting the user to upload a file using a document form Create a request to the Upload endpoint of the geoprocessing service, whose body is the contents of the form An item ID will be returned from the request. This ID is then passed as the file parameter to the geoprocessing service job The geoprocessing service reads the ID from the file parameter and automatically translates that to the path to the uploaded file location Solution Details Python: There isn't anything special from the Python side of things. Simply grab the file parameter as text: file_path = arcpy.GetParameterAsText(0) The parameter will be a string that represents the path to the file. Once you have the path to the file you can manipulate the file as required for your purposes. Geoprocessing Tool: Create a geoprocessing tool in ArcMap or ArcPro with a parameter for a file with a data type of 'File'. Matching the order of the parameter in the tool with the parameter index in the Python script is essential. If the file parameter is first in the toolbox list then this parameter has an index of zero in the Python parameter list. This translates to the following in Python: arcpy.GetParameterAsText(0) Geoprocessing Service: Run the tool in ArcMap or ArcPro so that it completes successfully. In ArcMap, go to Geoprocessing Results, right click on the successful job and select Share As > Geoprocessing Service In ArcPro, go to History, right click on the successful job and select Share As > Web Tool To enable Upload capability: ArcMap: In the service editor, under the Parameters section, tick the Upload box ArcPro: In the share as web tool dialog, in the Configuration tab, tick the Upload box Check the tool parameters are correct and add descriptions. Publish the tool, which now has the ability to upload files. JavaScript & HTML 1. Use a document form to allow the user to nominate a file for upload: <form enctype="multipart/form-data" method="post" id="uploadForm"> <div class="field"> <label class="file-upload"> <span><strong>Add File</strong></span> <input type="file" name="file" id="inFile" /> </label> </div> </form> 2. Create a request to the geoprocessing service upload endpoint, that uses the form as the body: document
.getElementById("uploadForm")
.addEventListener("change", function(event) {
var fileName = event.target.value.toLowerCase();
if (fileName.indexOf(".zip") !== -1) {
//is file a zip - if not notify user
uploadFile(fileName);
}
}
});
function uploadFile(fileName) {
var name = fileName.split(".");
// Chrome and IE add c:\fakepath to the value - we need to remove it
// see this link for more info: http://davidwalsh.name/fakepath
name = name[0].replace("c:\\fakepath\\", "");
var upload = esriRequest(
fileUploadUrl,
{
body: document.getElementById("uploadForm"),
method: "post",
responseType: "text" //Ideally would return as json but that doesn't seem to work for me
}
).then(uploadSucceeded, errBack);
}
3. Handle the response of the request and extract the item ID, passing it as a parameter to the geoprocessing service: function uploadSucceeded(result) {
//Ideally the result would come back as json but as it is coming back as html it will need to be parsed for the itemid
var element = document.createElement('html');
var itemID = "";
var itemURL = "";
element.innerHTML = result.data;
var tdElements = element.getElementsByTagName('td');
for (let tdElement of tdElements){
if (tdElement.innerHTML == "Item ID:"){
itemID = tdElement.nextElementSibling.firstChild.innerHTML;
}
}
if (itemID == ""){
console.log("Could not get file item id");
return
}
console.log("itemID: " + itemID)
var params = {
FileName: "{'itemID':'" + itemID + "'}" //Replaces the need for the DataFile object
};
gp.submitJob(params).then(handleResult, errBack, progTest);
} Note that the JS API documentation recommends that you create a DataFile object, which you then pass as the parameter value. I could not get that to work and so constructed the object from JSON myself based on what I could see the geoprocessing service required. I determined the format of the JSON object by executing the geoprocessing service from the REST endpoint. I have attached my full sample JS code for reference. This code not only uploads a file but also gets a response in the form of an object id of the uploaded feature. The feature is zoomed to and then a FeatureForm for that feature is opened for editing. One caveat is that at the time of writing I could not get the update button to work on the FeatureForm, probably due to an unresolved asych issue.
... View more
10-21-2019
09:58 PM
|
5
|
3
|
6119
|
|
POST
|
Closing the loop on this one with a blog post I wrote here: https://community.esri.com/people/MDonnellyesriaustralia-com-au-esridist/blog/2019/10/17/js-api-v4-uploading-a-file-to-a-gp-service
... View more
10-17-2019
05:17 PM
|
0
|
0
|
1350
|
|
POST
|
Hello, I have created a geoprocessing service, with upload enabled, that takes a file as a parameter. I am attempting to call this service from a web application created using Javascript 4.12, however, I have a problem. The first problem happens when I use the esri request module to transact with the service's upload endpoint. The response will always be returned as html rather than JSON. If I nominate the responseType as "json" I get an error saying there was an unexpected character '<'. If I nominate the responseType as "text" the request succeeds but the response is in html. var gpUrl = "https://myserver.com/arcgis/rest/services/ImportFileToGDB/GPServer/ImportFileToGDB";
var fileUploadUrl = "https://myserver.com/arcgis/rest/services/ImportFileToGDB/GPServer/uploads/upload";
document
.getElementById("uploadForm")
.addEventListener("change", function(event) {
var fileName = event.target.value.toLowerCase();
if (fileName.indexOf(".zip") !== -1) {
//is file a zip - if not notify user
uploadFile(fileName);
} else {
document.getElementById("upload-status").innerHTML =
'Add shapefile as .zip file';
}
});
var gp = new Geoprocessor(gpUrl);
var fileForm = document.getElementById("mainWindow");
var expand = new Expand({
expandIconClass: "esri-icon-upload",
view: view,
content: fileForm
});
view.ui.add(expand, "top-right");
function uploadFile(fileName) {
//upload the zip file and get back the itemID (via uploadSucceeded)
var upload = esriRequest(
fileUploadUrl,
{
body: document.getElementById("uploadForm"),
method: "post",
responseType: "json"/*,
query:{f:"json"},
headers: {"Content-Type": "application/json"}*/
}
).then(uploadSucceeded, errBack);
}
function uploadSucceeded(result) {
document.getElementById("upload-status").innerHTML = "File uploaded"
var itemID = result.item.itemId;
//Create the DataFile object you will assign your itemID to
var dataFile = new DataFile();
//The itemID points to the zip file, which is why I assign it the dataFile object
dataFile.itemID = itemID;
var params = {
"Import_File": dataFile
};
gp.submitJob(params).then(handleResult, errBack, progTest);
}
function progTest(value) {
document.getElementById("upload-status").innerHTML = "Job status: " + "'" + value.jobStatus + "'";
console.log(value.jobStatus);
}
function handleResult(result) {
//Handle the querying, zooming and opening the FeatureForm
document.getElementById("upload-status").innerHTML = "Success";
console.log('here');
}
function errBack(error) {
document.getElementById("upload-status").innerHTML = "Error: " + error;
console.log("gp error: ", error);
}
});
... View more
09-17-2019
05:40 AM
|
0
|
1
|
1772
|
|
POST
|
Hi Dave, I have seen something like this due to mixed HTTPS and HTTP traffic. Make sure you mandate SSL on both Portal and ArcGIS Server. Don't worry if you just have self signed certs, it's just about aligning the protocols on the requests. Mark
... View more
08-04-2019
05:19 PM
|
1
|
0
|
822
|
|
POST
|
Thanks Robert, Thought by waiting for the web map to load that the underlying sub layers would've already loaded. Got caught out on the classic asynch web programming catch: your object's not fully loaded yet dummy! I have since been able to confirm that the sub layers are indeed loading if I give them enough time. Mark
... View more
07-30-2019
05:50 PM
|
0
|
0
|
1389
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-12-2021 03:26 PM | |
| 3 | 09-09-2021 04:19 PM | |
| 3 | 09-12-2021 04:54 PM | |
| 1 | 09-08-2021 09:42 PM | |
| 2 | 09-09-2021 05:31 PM |
| Online Status |
Offline
|
| Date Last Visited |
01-27-2022
03:29 PM
|