|
POST
|
Hi Archit Hmm... an odd one. I checked validation in the Portal Admin Directory, and in the Server Manager. All were fine. I then decided to try to create a new Feature Layer, rather than bring in a zipped shapefile (which just published the shapefile before - it didn't create a hosted Feature Layer). However, even though I've done this quite a lot in ArcGIS Online, I couldn't find any option to create a new feature layer - or indeed anything like it! Instead, I just get the drag/drop option, URL, Application, and Data Store: Also, when I did add a zipped shapefile, it did not come up with an option to host it as a hosted feature layer/service: In terms of logs, I tried looking through the period when I added the above file and couldn't see anything.
... View more
07-23-2023
06:05 PM
|
0
|
0
|
3013
|
|
POST
|
Thanks Miguel. I've already tried restarting the datastore, with no avail, and looked through that topic (nothing in there that looks relevant to me). My describedatastore output is:
... View more
07-23-2023
05:11 PM
|
0
|
0
|
3014
|
|
POST
|
I've got a single machine that I'm using as an ArcGIS Enterprise server (with Portal) and have a data store on the same machine. I've just installed the data store (using the standalone installer, 10.9.1 - all my server elements are 10.9.1). In ArcGIS Pro, whenever I try to share a web layer and copy all of the contents to the server (so it can be used as a repository for data eg contours), the analyze/publish options are greyed out for anything other than a map image layer (which I don't want, I need it to be a feature layer). Also, in Portal, if I try to copy the zipped shapefile over, it simply copies the shapefile rather than giving me the option to create a HFS. Looking into the logs, I can see this in one of the server logs: <Msg time="2023-07-14T04:04:26,131" type="WARNING" code="110801" source="Data Store" process="13184" thread="1" methodName="" machine="MYMACHINE" user="" elapsed="" requestID="">Failed to start tile cache data store. Read from ArcGIS Data Store configuration store failed.</Msg> <Msg time="2023-07-14T04:04:26,135" type="SEVERE" code="110306" source="Data Store" process="13184" thread="1" methodName="" machine="MYMACHINE" user="" elapsed="" requestID="">Attempt to start 'tile cache' data store failed. Read from ArcGIS Data Store configuration store failed.</Msg> Anyone got any ideas? Thanks.
... View more
07-13-2023
09:59 PM
|
0
|
5
|
3393
|
|
POST
|
I'm trying to create a web tool which will access a layout. The layout contains a web map which already displays some layers, and I'd like to set the definition query on them to only show certain features. However, for some reason this isn't working. I've managed it in other scenarios, such as loading up a web map with a blank mapframe and adding the layers to that, but I'd like it to use a web map this time in order to make editing it easier. In any case, for some reason it seems to ignore the definition query and return the same number of features, as if the definition query isn't active (I have checked it, it is active, the layer supports definition queries and this is the only definition query on it). Code snippet below: lyt = aprx.listLayouts()[0]
mf = lyt.listElements("mapframe_element", "WEBMAP_MAP_FRAME")[0]
mfm = mf.map
myLayer = mfm.listLayers("UseThisLayer")[0]
myLayer.definitionQuery = "ThisId = 'abc'"
with arcpy.da.SearchCursor(myLayer, "Shape@") as cursor:
for row in cursor:
if row[0]:
arcpy.AddMessage(row[0]) As I say, I can put anything into the definition query and it still returns the same amount of values, as if it's not there. And I can interrogate the layer's definition query, see that it is active, supported and the only one there. I do have another way round this (which would be defining the layers outside of the layout, then adding them to the layout's mapframe) but as I say, I'd really like not to have to do this if I can avoid it. Edit - should point out that this is using ArcGIS Pro, but the layout (and web map and layers) are on my Portal. Eventually this will become a web tool. Another edit - using the below: arcpy.AddMessage(myLayer.listDefinitionQueries()) Gives us: [{'name': 'Query 1', 'sql': "ThisId = 'abc'", 'isActive': True}]
... View more
02-06-2023
08:36 PM
|
0
|
1
|
1646
|
|
POST
|
Huh, go figure. It may have been running all along, I'm unsure. In my latest code, I made a couple of little tweaks to my requestparams. It is instead: var requestParams = {
method: "post",
query: {
f: 'json',
username: 'MyUsername',
password: 'MyPassword',
client: 'requestip'
}
}; And added the token to my url, at the end. In any case, I'm still getting the signin screen, which I believe is because I'm calling the job wrong (at the moment I'm just using a window.open to call the url), but the job still calls and executes. I just assumed it wasn't because of the login screen. Now to find a better way to call the job... (eventually, because now other tasks have popped up)
... View more
10-17-2022
09:12 PM
|
0
|
0
|
1207
|
|
POST
|
Sure. Sorry I've only just gotten round to this now, been in the field a bit. See below for the edited version: var tokenUrl = "https://myserver.com/portal/sharing/rest/generateToken";
var requestParams = {
method: "post",
query: {
f: 'json',
username: 'MyUsername',
password: 'MyPassword',
referer: window.location.origin
}
};
var myRequest = esriRequest(tokenUrl, requestParams);
myRequest.then(function(response){
var token = response.data.token;
esriId.registerToken({
server: "https://myserver.com/portal/sharing/rest",
token: token
});
initMap();
}); As I say, I have a tool which I can call using the following: https://myserver.com/server/rest/services/MyPrintLayouts/ScriptX01_AGP2_9/GPServer/ScriptX01/submitJob?&MyId=%7B<MyIdAsGUID>%7D&FileDestination=C%3A%5Ctemp%5C%7B<MyFilename>%7D.pdf&env%3AoutSR=&env%3AprocessSR=&returnZ=false&returnM=false&returnTrueCurves=false&context=&f=html If I'm logged into the server already, then it works fine. If I'm not however, I get presented with a login screen. I'd like to be able to use the token to access it, which doesn't seem to work if I include it in the URL (which I assume I'm doing wrong).
... View more
10-17-2022
08:37 PM
|
0
|
0
|
1208
|
|
POST
|
I have a scripting tool on my Portal which works fine if the user is signed in. However, if the user is not signed in, the scripting tool obviously doesn't work. I also have a token, which has been generated earlier (though not much earlier - the token is still current). Is it possible to use this token to run my scripting tool, and if so, how should it be passed into the URL? This is a very basic version of how it works: window.open("https://myserver.com/server/rest/services/MyPrintLayouts/ScriptX01_AGP2_9/GPServer/ScriptX01/submitJob?Id=" + vId + "&FileDestination=" + vDestination + "&env%3AoutSR=&env%3AprocessSR=&returnZ=false&returnM=false&returnTrueCurves=false&context=&f=html", '_blank'); I've tried adding a &token=" + token Extra token parameter in there but that's not working. Each time it gets called, if the user isn't signed in, it will go to the sign in screen.
... View more
10-06-2022
10:08 PM
|
0
|
3
|
1276
|
|
POST
|
I'm trying to set up and use a folder data store, so that I can access a layout.pagx file stored on my server in code (specifically, in ConvertWebMapToArcGISProject). ArcPy code should be something like this: templatePath = "\\myserver.com\server\LayoutStorage"
templateFile = "layout.pagx"
templateFull = os.path.join(templatePath, templateFile)
result = arcpy.mp.ConvertWebMapToArcGISProject(data, templateFull) Where LayoutStorage is the name of my folder data store, and layout.pagx is my layout file (see convertwebmaptoarcgisproject and data-store-items) Now, I don't think I've set this up correctly. The folder I've set up to be my data store is located on the server, simply at C:\Datastore_Layouts. In here there is the layout.pagx file (so C:\Datastore_Layouts\layout.pagx). The folder is shared with the ArcGIS user accounts. The data store item, in my Portal, has been set to address the \\localhost\Datastore_Layouts folder. This has been validated. It can be accessed by my https://myserver.com/server server (with a green tick next to it for status). However, I keep getting: RuntimeError: Missing or invalid layout template file. I must say though that, for testing purposes, I am doing this on my local install of ArcGIS Pro (and not on the server machine). Any help would be greatly appreciated - this is (hopefully) the last thing I need to get on this. Either that, or if there is a way to address a layout.pagx file from the existing Portal?
... View more
10-03-2022
10:22 PM
|
0
|
0
|
1490
|
|
POST
|
That's definitely some useful code. However, my code *was* working, but my code hadn't been put together well. I was trying to address a layer which didn't exist because I hadn't given it a title in the json I'm putting the webmap together with.
... View more
10-03-2022
08:56 PM
|
0
|
0
|
1886
|
|
POST
|
I'm trying to narrow down a layer using the lyr.definitionQuery = ... method, as below: result = arcpy.mp.ConvertWebMapToArcGISProject(data, templateFull)
aprx = result.ArcGISProject
#get the map, layer, apply the definition query
m = aprx.listMaps()[0]
lyr = m.listLayers("MyLayer")[0]
lyr.definitionQuery = "GUIDId = '" + RequestedGUIDId + "'" Now, this works fine if I do it using my current project on my computer, with everything loaded locally (so I don't have to bother with the ConvertWebMapToArcGISProject). However, we're trying to implement this online, so we have to get a json containing the layers we need and convert it to a project in the code. Now, for some reason, the lyr.definitionQuery line is not working - or more rather, it's having no effect. No matter what, it always returns the same number of features, which is odd (as my layer contains about 20,000 features - yet it always returns 151, even if I enter different values, or even values that don't exist!). The layer does support definition queries (I've tested that), and it definitely recalls the definition query (I've given it a delay after the definition query is set, and checked it by outputting). It's getting set, but for some reason the layer isn't paying any attention to it.
... View more
09-29-2022
11:04 PM
|
0
|
2
|
1929
|
|
POST
|
I've got a layout file that I've copied to my Portal. The layout refers to a webmap (which contains a few layers). My intention is to print the layout, zoomed to a certain extent (which I'd pass through to it), and only showing certain features (which, again, I can pass to it, or provide in a definition query). How would I accomplish this? I managed it using a local project, but now I'm trying to do it via Portal and have to use the arcgis.gis module. I've got code that will log in to the Portal and get the required extent, so just need to know how to interact with the layout. My code, so far, is below: import arcpy, os, sys
from arcgis.mapping import WebMap
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
#get variables
RequestedId = arcpy.GetParameterAsText(0)
cUN = arcpy.GetParameterAsText(1)
cPW = arcpy.GetParameterAsText(2)
#connect
gis = GIS(r"https://mydomain/portal", cUN, cPW)
#try and load the webmap
wm_item = gis.content.get("WebMapId")
wm = WebMap(wm_item)
#try to access the layer
for lyr in wm.layers:
if lyr.title == "MyLayer":
#convert it into a feature layer for local use
flayer = FeatureLayer(lyr.url)
###some handy old code, no longer used
###for f in flayer.properties.fields:
### arcpy.AddMessage(f['name'])
#grab the extent
MyExtent = flayer.query(where="Id='" + RequestedId + "'", return_extent_only=True)
#now we're going to need our layout
lyt_item = gis.content.get("MyLayoutId")
arcpy.AddMessage(lyt_item) For reference, this was my original code, which worked fine using a local project. Basically, I'd like to replicate this: import arcpy
#select our current map, and then the layer we want, and grab our Id from parameters
aprx = arcpy.mp.ArcGISProject("CURRENT")
RequestedId = arcpy.GetParameterAsText(0)
m = aprx.listMaps("MyWebMap")[0]
lyr = m.listLayers("MyLayer")[0]
#set our definition query
lyr.definitionQuery = "Id = '" + RequestedId + "'"
#define our extents
extents = []
#loop through and add our shape extent
with arcpy.da.SearchCursor(lyr,'SHAPE@') as cursor:
for row in cursor:
if row[0]:
extents.append(row[0].extent)
#get our actual extent
eXMin = min([ext.XMin for ext in extents])
eXMax = max([ext.XMax for ext in extents])
eYMin = min([ext.YMin for ext in extents])
eYMax = max([ext.YMax for ext in extents])
#now go into the layout
lyt = aprx.listLayouts("Layout")[0]
mf = lyt.listElements("mapframe_element", "WEBMAP_MAP_FRAME")[0]
mf.map = m
myExtent = arcpy.Extent(eXMin, eYMax, eXMax, eYMin, 0, 0)
mf.camera.setExtent(myExtent)
mf.camera.scale = mf.camera.scale * 1.1
m.defaultCamera = mf.camera
lyt.exportToPDF("C:\\temp\\mylayout.pdf") I've seen some things saying that you need to know where in the DataStore the layout is saved, but I can't find any way to find this out.
... View more
09-27-2022
11:27 PM
|
0
|
0
|
1045
|
|
POST
|
Great, that works. My code is now: import arcpy, os, sys
from arcgis.mapping import WebMap
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
#get variables
RequestedId = arcpy.GetParameterAsText(0)
cUN = arcpy.GetParameterAsText(1)
cPW = arcpy.GetParameterAsText(2)
#connect
gis = GIS(r"https://mydomain/portal", cUN, cPW)
#try and load the webmap
wm_item = gis.content.get("webmapid")
wm = WebMap(wm_item)
#try to access the layer
for lyr in wm.layers:
if lyr.title == "MyLayerTitle":
#convert it into a feature layer for local use
flayer = FeatureLayer(lyr.url)
###some handy old code, no longer used
###for f in flayer.properties.fields:
### arcpy.AddMessage(f['name'])
#grab the extent
MyExtent = flayer.query(where="Id='" + RequestedId + "'", return_extent_only=True)
... View more
09-27-2022
11:17 PM
|
0
|
0
|
3107
|
|
POST
|
I'm currently trying to create a script which will do a few things, including loading a webmap, filtering it based on a definition query, zooming to the resulting shape extent, and then creating a PDF using a custom layout. I've managed to do all this using a local project in ArcGIS Pro, but had trouble exporting it (mainly because I was using the "CURRENT" project, and I'm now trying to do this via the Portal). In any case, I'm having to redo a fair bit of code. I'm getting stuck where I refer to the layer so I can perform a definition query on it. Basically, I'd ideally like the lyr object to refer to a layer, so I can do a "lyr.definitionQuery = etc" This is what I've got so far. I know the syntax is wrong, I'm just looking for the right one: import arcpy
from arcgis.mapping import WebMap
from arcgis.gis import GIS
#get variables
RequestedId = arcpy.GetParameterAsText(0)
cUN = arcpy.GetParameterAsText(1)
cPW = arcpy.GetParameterAsText(2)
#connect
gis = GIS(r"https://mydomain.com/portal", cUN, cPW)
#try and load the webmap
wm_item = gis.content.get("webmap_id_here")
wm = WebMap(wm_item)
#try to access the layer
arcpy.AddMessage(wm.layers)
lyr = wm.layers("ThisIsMyLayersTitle")[0] For reference, and probably to see more what I'm trying to do, this is my full (old) code that works on a local project: import arcpy
RequestedId = arcpy.GetParameterAsText(0)
#select our current map, and then the layer we want, and grab our Id from parameters
aprx = arcpy.mp.ArcGISProject("CURRENT")
RequestedForestId = arcpy.GetParameterAsText(0)
m = aprx.listMaps("MyWebMap")[0]
lyr = m.listLayers("MyLayer")[0]
#set our definition query
lyr.definitionQuery = "Id = '" + RequestedId + "'"
#define our extents
extents = []
#loop through and add our shape extent
with arcpy.da.SearchCursor(lyr,'SHAPE@') as cursor:
for row in cursor:
if row[0]:
extents.append(row[0].extent)
#get our actual extent
eXMin = min([ext.XMin for ext in extents])
eXMax = max([ext.XMax for ext in extents])
eYMin = min([ext.YMin for ext in extents])
eYMax = max([ext.YMax for ext in extents])
#now go into the layout
lyt = aprx.listLayouts("Layout")[0]
mf = lyt.listElements("mapframe_element", "WEBMAP_MAP_FRAME")[0]
mf.map = m
myExtent = arcpy.Extent(eXMin, eYMax, eXMax, eYMin, 0, 0)
mf.camera.setExtent(myExtent)
mf.camera.scale = mf.camera.scale * 1.1
m.defaultCamera = mf.camera
lyt.exportToPDF("C:\\temp\\mylayout.pdf")
... View more
09-26-2022
11:34 PM
|
0
|
2
|
3175
|
|
POST
|
Hi all I've got a Portal which has some secure content behind it. I'm currently able to access it via Azure Active Directory SSOs and an OAuth2 app, all through ESRI JS, which is great, works perfectly etc. However, we're building an environment in Dynamics 365. That doesn't seem to want to work with the OAuth2 app. Our developers tell me that the "code" and "state" parameters being returned with the redirect URI are invalid. So, a few questions if I may. First off, has anyone come across anything like this before, and is there a way (in anything, really) to fix it? Secondly, alternatives. Now, from the first reply on this topic (https://community.esri.com/t5/arcgis-enterprise-questions/unable-to-generate-tokens-using-saml-enterprise/m-p/1055538) which reads: When using an external identity provider via either SAML or OpenID Connect, Portal for ArcGIS (as the service provider) has no connection to the user's credentials. The authentication process is handled by the return of the properties within the SAML assertion/response and mapped to appropriate values within the Portal user's profile. With that being the case, token generation at the Sharing/REST endpoint is not possible for those users and would need to be generated via the OAuth2 mechanism. It seems we can't simply grab the username/password and feed it in to get a token, as they're all Azure AD users. Indeed, I've tried logging in through the login screen using my Azure AD username/password, and this doesn't work. Integrated Windows Authentication wouldn't work as we anticipate contractors using this too from outside our organisation. At the moment the only access I can see is having read-only credentials hard-coded in, which we really don't want to do. Does anyone have any ideas that would help? Thanks! EDIT - also, any way to remove these code and state parameters from the returned response (if they're not necessary)?
... View more
09-11-2022
10:39 PM
|
0
|
0
|
1185
|
|
POST
|
I'm using an ArcGIS Enterprise install, meaning we have our own server with "server" and "portal" webadaptors on one of our machines, which will serve our data. Our users go onto this and can sign on using a single sign on with Azure AD. They've been using this, along with an OAuth2 app, to sign in securely and view our data, and we've got various controls set up using ESRI JS. Unfortunately, a change in software has meant we cannot use the OAuth2 app any more, and the only way I can see of doing what we need is to use tokens. I've tried to make sense of this, but I'm struggling to find many good samples of what I want. I've gone into our Server Manager and copied out the Shared Key, but now I don't know what to do.
... View more
09-08-2022
11:34 PM
|
0
|
1
|
1035
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-23-2023 10:56 PM | |
| 1 | 07-25-2022 10:50 PM | |
| 1 | 07-27-2021 08:16 PM | |
| 1 | 07-27-2021 10:44 PM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|