POST
|
Hi Items in ArcGIS Online can have their extent defined. What would be very useful is a tool that uses a polygon as input, looks for the extents of all items in a particular folder of ArcGIS Online, and returns the items if their extent intersects with the input polygon. This would be very useful for non-spatial items in AGOL such as PDFs, Excel spreadsheets and the like, because then these documents can be searched for based on the geographical area they are relevant to. For example a PDF about a national park can have its extent defined within the park area, so that it only will be returned when the input polygon is coincident with the park area. Of course in a map you can search for items "only within the map area" but that means that for every search you have to create a map with a particular extent. In addition the items returned are limited to those that can be added to the map such as feature layers. In a web application there are widgets that return items found within a drawn polygon, but these are limited to items already in the map that is sourced by the application, not PDFs for example. I am wondering if it is possible to write a python script to select items that way. What I am not sure about is how to get the extents of items. And of course ideally the input polygon would be drawn on an AGOL map, which requires a JavaScript widget. At the momemt I cannot make widgets published in AGS available to AGOL, so for now perhaps something written using the arcgis.gis API would be useful i.e. something that can be used in Jupyter. Anybody has attempted something like this? Any hints how to go about it? Thanks Hugo
... View more
12-13-2018
12:30 AM
|
0
|
0
|
279
|
POST
|
Hi I also have this problem: I would like to allow full editing on the related table, but the geometries of the feature class the table is related to, to be left untouched. I tried to set "allowGeometryUpdates": false, but this also relegates the related tables to updates only (no new records can be added and no records can be deleted). This is a common scenario, especially with related tables. Can I ask Esri implements what is asked for above, namely "Allow editing of feature attributes and related table records, but no editing of feature geometry" In a web app you can set an editing widget to exclude geometry from editing, which is something. But as mentioned by other people in this post, it is Collector that is the problem. So an alternative is to have functionality at a "higher level" of control in Collector itself where people can fully edit all attributes (including adding and deleting of entries in related tables) but make no changes whatsoever to geometries of the feature class the other table is related to. That would be great. Thanks Hugo
... View more
11-15-2018
06:54 PM
|
0
|
0
|
284
|
POST
|
Hi Irrespective of what I try I cannot do an intersect between multiple points and multiple polygons and neither can I save the results from the intersect as a new feature layer collection in AGOL. Here is what I do: From my AGOL folder I get a polygon layer "cadastre_layer" and a point layer "poi_layer" (both are layer objects). My aim is to generate an output FeatureSet object from all intersects between 3 points and 3 polygons, but I cannot seem to do this. All the examples I have found only use a single point as the object to select with. So I tried this: I create a query object from the point layer: poi_queryResult = poi_layer.query() for poi_geom in poi_queryResult.features: cadastre_filter_result = cadastre_layer.query(where='1=1', geometry_filter=filters.intersects(poi_geom.geometry),return_all_records=True) But then "cadastre_filter_result" merely only contains the result of the last point geometry passed through the loop. So I tried to create a geometry object that would contain all three points and also ensures the right projection: output_geometry = geometry.project(geometries = [f.geometry for f in poi_queryResult.features],in_sr = 3857, out_sr =3857, gis = gis) But I cannot pass output_geometry into the geometry_filter (above). I tried several other things, but nothing seems to work. So my first question is: how do you do a spatial intersect between several points and several polygons? The second problem is that I would like to use gis.content.import_data to import the FeatureSet (cast to a DataFrame) so I end up with a new Feature Layer Collection in my home folder. However that does not work either: gis.content.import_data(df=cadastre_filter_result.df, target_sr =3857,title="Cadaste Spatial Query Results" ) There is a new object in my home folder in AGOL, but it contains no data. Indeed the error from executing the above line is: "The following rows could not be written to the table: 0" But if I try to save the results of the spatial query to a shape file, I get (at least) one polygon (presumably the one that intersected with the last point). So this works: cadastre_filter_result.save(out_name='my_layer',save_location=r'C:\Data') So my second question is, how do I get gis.content.import_data to work on the results of the spatial intersect? Thanks Hugo
... View more
11-05-2018
12:55 AM
|
0
|
0
|
879
|
POST
|
Hi I want to find out which AGOL groups particular objects belong to, and in doing so seem to have come across a python "group" object within a dictionary, which is difficult to access. I looked it up and the only "group type" object in python I find reference to is h5py "group" objects, but that is not it. So this is what I am trying to do: I have an AGOL item, and I want to know what AGOL groups this item belongs to. This information can be found when calling "shared_with", which returns a dictionary: print (item.shared_with) This returns: {'everyone': False, 'org': False, 'groups': [<Group title:"Group name" owner:some_user>]} I thought that what is (within the dictionary) in the list i.e. between [ and ] is a string i.e I though that this is a string: <Group title:"Group name" owner:some_user> But when I use some string functions on it, like split, it complains that this is not a string object: AttributeError: 'Group' object has no attribute 'split' (I know the use of the term "group" is confusing here, I am looking for AGOL groups and the name 'group' also appears in what is returned between < >), but what I think is what is between < > is also some sort of a python "group" object.) So whatever is between < and > is a python "group" object? To be honest I have never heard of it and googling does not help either. Anyone knows what kind of object this is and how to access it? It is not a string, that's for sure. Thanks Hugo
... View more
10-29-2018
01:33 AM
|
0
|
1
|
1142
|
POST
|
Hi I looked extensively in this forum but I cannot get to decipher the answer. If I create a polygon (this is from an example in here) and want to make that into a feature layer, how can this be done? This would be useful for me to do. So, say I create a polygon from bufferin an initial point: import arcpy,json x = 116.6735507 y = -31.28888386 point = arcpy.Point(float(x),float(y)) sr = arcpy.SpatialReference(3857) ptGeometry = arcpy.PointGeometry(point,sr) length = 1 buff_geometry = ptGeometry.buffer(length) densify = buff_geometry.densify('DISTANCE',1,1) shape = densify.JSON newshape = json.loads(shape) So now i have a "newshape" polygon geometry object. I cannot seem to display this as a visual item in jupyter, but moreover, I cannot find a way to save this permanently as a feature layer. I think you have to create a feature layer collection first and I looked at the arcgis.gis api but could not find anything that would do this. Any ideas on how to save a polygon (or point or line feature) created this way as a feature layer? And once I have created the layer, how would I add additional polygons to it? Thanks Hugo
... View more
10-24-2018
11:38 PM
|
2
|
0
|
786
|
POST
|
Thanks for your help, your code is much better (and elegant) than mine. I am now formatting the colour schemes manually, seeing I have clear confirmation this cannot be done in Arcade. I have looked into using JSON for defining drawinginfo for webmaps before. So this is what I am doing now also for the new results from the categories resulting from the arcade code. First I use the arcgis.gis API to search for the webmap in question, and get the mapitem. Then I do this: mapitem.get_data(). The resultant JSON output is then put in a JSON formatter, after which I use everything that belongs to drawingInfo into a python progam as a variable. After that I search for layers in the other webmap, and copy the new JSON variable over by doing this: layer ['layerDefinition'] = mysavedJSON Thanks again for your help. Cheers Hugo
... View more
10-23-2018
09:52 PM
|
2
|
1
|
3145
|
POST
|
Hi Carmel Thanks for your reply. Yes this is what I have done i.e. I defined the colour manually, as you point out in your email. The issue is that I need to create 24 maps that look exactly the same, but have different content (different areas). I was hoping to set all this up with a script so I could just use the same Arcade script in all 24 maps. One question I have (and this may sound a little stupid): in the blogs there is continuous reference to JavaScript and embedding Arcade in JavaScript. So can you use JavaScript with (if needed) embedded Arcade in a custom expression, either for rendering a map in AGOL or customising pop-ups in AGOL? I thought the expression fields only take Arcade, but perhaps they also take JavaScript with Arcade in it? If this is the case I suppose it might be possible to define the colors programmatically? Thanks Hugo
... View more
10-22-2018
06:16 PM
|
0
|
3
|
3145
|
POST
|
Hi In a map I use a "Custom Expression" to change the rendering style of a polygon layer, and use Arcade to make a custom expression. In Arcade, I combine all possible combinations of two fields. One field is named PIP and the other BIOSECURITY. Both use the same domain, namely a simple YES/NO choice where the code for "NO" = 0 and the code for YES = 1. However both fields can also be empty. The logic is that I use decode to change the values of PIP differently from those of BIOSECURITY so they can never be the same. Once that is done, I add them up. Because the values are always different, each addition should be unique. I use a WHEN statement in which I add up the unique combinations of the values in the two fields. WHEN (Decode($feature.PIP, 0, 2, 1, 4, 5) + Decode($feature.BIOSECURITY, 0, 22, 1, 32, 55) == 60,'Unique Color Code', Decode($feature.PIP, 0, 2, 1, 4, 5) + Decode($feature.BIOSECURITY, 0, 22, 1, 32, 55) == 59, 'Another Unique Color Code', 'Default Value ') But where I write 'Unique Color Code', and ''Another Unique Color Code' I would actually like to instruct Arcade to render those layers with a particular color, e.g. green or red. I found some examples, but I think is for when you embed Arcade in JavaScript Decode($feature.PIP, 0, 2, 1, 4, 5) + Decode($feature.BIOSECURITY, 0, 22, 1, 32, 55) == 60, 'background-color:ff984f' I also tried: Decode($feature.PIP, 0, 2, 1, 4, 5) + Decode($feature.BIOSECURITY, 0, 22, 1, 32, 55) == 60, '#ff984f' Is there any way in Arcade to directly assign colors to a polygon layer, based on a WHEN statement, as in the code snippet above? Thanks Hugo
... View more
10-22-2018
01:48 AM
|
0
|
8
|
4293
|
POST
|
Hi In ArcGIS Online I would like to create one web application and then copy it several times. The purpose is to have a standard interface and number of widgets, but with each web application sourcing a different web map. I have to do some reconfiguration of some of the widgets to account for different layers but this is nothing compared to each time reconfiguring the web app from scratch from a standard template. I have done a copy with ArcGIS Online Assistant, and it works up to a point i.e. I can copy the web application and rename it. However when I want to add it to the same folder as the one I copied it from it says that the item already exists. This is strange as the name as well as the item ID are different. So I can only use the copied web application if I keep it in a different AGOL folder. Is there any way make such a copy differently, i.e. programatically. And is there any way around the problem that you cannot keep the copy in the same folder as the original? Thanks Hugo
... View more
10-09-2018
09:45 PM
|
0
|
0
|
237
|
POST
|
Hi I am using Portal 10.5 and it seems I have come across a limitation. I have a polygon layer which has a one-to-many relationships to a related table. When editing, people are able to record several entries into the table against a single polygon (i.e. multiple visits made). As long as I publish the polygon feature class and the related table from ArcMap, the relationship holds true in Portal (this is not the case when uploading the File geodatabase as a zipped file and then publishing the feature layer). So this one-to-many relationship works in my Portal web map and also in my Portal app using a standard editing widget. It also works in Collector as long as Collector is online. But when I download a map extend in Collector to a local copy ("on device"), the polygon layer, although showing up in the layer list, is not visible in the map and can no longer be edited. If I do not have a one-to-many relationship for the polygon layer to a table, the offline version works. I created a parallel set up in AGOL. There everything works: one-to-many editing works in the web map, in Collector online and Collector offline. Is this a limitation between the Portal version I have (10.5) and AGOL (10.6)? Or is there a solution to this in Portal 10.5? Thanks Hugo
... View more
09-12-2018
12:02 AM
|
0
|
0
|
403
|
POST
|
Hi I am trying to use the export functionality for an item in Portal, to export to a File geodatabase and then download the File geodatabase to the local drive. However I want to use a where clause so I only download certain records. The method for exporting to a File geodatabase is described here: arcgis.gis module — arcgis 1.4.2 documentation with a further link to this page where the JSON for using a where clause is described: Export Item—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers However, the JSON, as described above does nor work. I have tried the format { "layers" :[ {"id" : 0 }, {"id" : 1, "where" : "POP1999 > 100000"} ] } and applied this to my own situation i.e. using the same format, but specifying that a field named "pip" should have value 1 (after checking that the field name is 'pip', in the layer, that it is an integer and has values 1. Note however that this is a domain field. So I have also tried the domain description where 'Yes' is used instead of 1, and even have used the field alias instead of the field name. The where clause is to be applied to layer 0. So I have: exportParameters = [ {"id" : 0, "where" : "pip = 1"}] Then I export (where "fl" is my feature layer collection) exportfgdb = fl.export(title=feature_layer+'_Export', export_format='File Geodatabase', parameters=exportParameters, wait=True) And download: exportfgdb.download(save_path=download_location) But I always get all the data, never what is specified by my where clause. I even tried "where": "OBJECTID < 10" But that does not work either. Note that I have a related table in the feature layer collection, which is listed in Portal as layer 1. So even if I just try to download layer 0 and not layer 1 (without any where clause), that does not work either: exportParameters= {"layers" : [ { "id" : 0 } ] } So I am thinking that the JSON is simply not read because it is all wrong. But what is the right syntax for the JSON when doing an export? There seems to be no documentation on this apart from the above link, so I have been trying just about all the combinations that can be made, but nothing works. Any help will be greatly appreciated. Thanks Hugo
... View more
08-06-2018
09:50 PM
|
0
|
0
|
421
|
POST
|
Hi I am using python for geoprocessing and am interacting with layers in a Portal Web Map, using the WAB geoprocessing widget in a web application. It works OK but I am concerned about the actual data I am using in the geoprocessing widget. In order to publish to Portal, I first I run the python script from a toolbox in ArcMap. Then I publish the result of running the script tool as a geoprocessing service in Portal. For my data sources in ArcMap I bring in the hosted feature layers from Portal, which of course are located in the managed database. However when I publish the geoprocessing service it always warns me that the layers I am using for input for geoprocessing will be uploaded to the server. The only way that they are not uploaded is when I use data sources either in a registered folder or database. The point is that I do not want to have two data sources: one which is the Portal map using hosted feature layers in the managed database and another set of data either uploaded to ArcGIS Server or located in a registered folder or database. It means that it will look like my geoprocessing service is interrogating that hosted feature layers in the map but in fact it is, for example, using feature classes in a registered File geodatabase. What if the data in the web map and those in the File geodatabase get out of sync? So in short, my question is how to have a geoprocessing service that truly interacts with the data people see in the web map i.e the hosted feature layers. Is there any way to make the managed data store also a registered data store in order to achieve this? I looked in ArcGIS for Server but there seems to be no button or anything to make the managed database also a registered data source. Thanks Hugo
... View more
07-05-2018
06:32 PM
|
0
|
0
|
342
|
POST
|
Hi I am having a lot of difficulties in configuring input and output parameters for a geoprocessing service to be accessed by the geoprocessing widget in Portal. I have tried for two days now and it looks like I have exhausted all options and yet, what I am trying to do seems rather straightforward. I would like to source a single input polygon from a web map in a Portal application as my input. Then I would like to create a PDF and save it, using the attributes that belong to that particular polygon. Firstly input: I run my python script in a toolbox with an input parameter set to "Layer" type - I also tried "Feature Layer". I have tried publishing this after running the tool directly as a python script in a toolbox, but also have put the script in a model and then set the input parameter of the model dynamic with the "P" option. In the desktop environment, the script and the model work and allow me to dynamically choose the input layer in ArcMap. Once I have run this, I either use the results from running the script or from running the model, and select "Share as a geoprocessing service" and publish to Portal. When publishing to Portal, for the input mode I choose "Choice List" (the documentation says that this allows you to select dynamically from a map) . But I have noted that in all cases there is a warning that during publishing the data will be uploaded to the server. That is not a good sign but there seems to be no way to avoid this (except using a registered folder I suppose). Once the geoprocessing service is published, I access the rest geoprocessing URL from the geoprocessing widget in WAB. But when I try to use dynamic input in the geoprocessing tool in WAB, I cannot choose anything from the map. During publishing I also tried "User Defined Value" and "Constant Value" as publishing options but none of this allows me to do anything interactively in the map afterwards. Ideally I would like to highlight one polygon and use that as my input (single polygon to be processed by the geoprocessing tool). How can this be done? Note that in the original python I have my input parameter as Layer = arcpy.GetParameterAsText(0) and in the toolbox, I specify as my input type "layer" or "feature layer". Is this wrong? Secondly output: I am afraid this is quite frustrating. I would like to save the output as a file to a folder location. I know that AGS and Portal have issues with saving things out (because on the server, local paths on the desktop may not be known) but surely there must be a way. I simply do not seem to find any way at all to achieve that. There is some mention that you can save geoprocessing output back to the desktop after zipping up the output file (e.g. a PDF or a CSV zipped up) but I could not make that to work at all (and believe me I have tried). Specifically, when publishing a geoprocessing service, it is impossible to use a folder or a File geodatabase as an used-defined choice input parameter. I also tried to set a variable to "output" in the toolbox before publishing. Lastly, in the script I have tried to set my output to arcpy.env.scratchFolder. Although all this works on the desktop, none of this works after publishing the same script as a geoprocessing service. So there seems to be no options to provide me with saving a file to some location when running the geoprocessing service in WAB. It seems the output file simply disappears or is not generated at all. I have no visibility on that. So in short any help in particular a code example (plus publishing instructions) would be most welcome, to 1. enable the geoprocessing tool to dynamically select a polygon from an input layer in a web application and 2. enable file output to be saved to a location of the user's choice Anybody's help will be greatly appreciated. Thanks very much Hugo
... View more
07-04-2018
12:35 AM
|
0
|
2
|
832
|
POST
|
Hi I have searched through the API and the examples, but it looks to me you can only publish a Feature Layer in Portal, when uploading content from the local desktop, using gis.content.add() and then gis.content.publish(). However, I would like to upload a feature class from a zipped File geodatabase and publish it as an Map Image Layer. Once I have done this, in Portal I will then manually configure the tile levels and generate the map tiles. I need raster tiles because in Collector for ArcGIS you can only see labels if they have been created as raster tile images. The closest I got was this information, which lets you create vector tiles from a layer package: publishing_packages_as_web_layers | ArcGIS for Developers You can also access an map image layer or even an Image service from a URL. But that supposes that service has already been published. It is the automated publishing of a Map Image Layer I would like to do. It is at all possible to upload and publish a feature class from a zipped File geodatabase directly as a Map Image Layer, using the arcgis.gis API? If that is not possible, is is feasible to first create a Feature Layer and from that somehow create a Map Image Layer as a secondary item, perhaps using the arcgis.mapping export_map function (not sure how that would work though). Thanks Hugo
... View more
07-02-2018
12:03 AM
|
0
|
3
|
1640
|
POST
|
Hi It looks to me that if you only have ArcGIS Pro on your desktop, you can no longer upload a map service to ArcGIS Server. The options for publishing to Portal for ArcGIS are also limited. Firstly if you want to load and configure a map manually in ArcGIS Pro you can only publish to Portal or to ArcGIS Online, because in ArcGIS Pro you cannot make a direct connection to ArcGIS for Server any more. If you want to publish a map using python, the old arcpy.mapping.CreateMapSDDraft in ArcMap is now replaced by arcpy.mp.CreateWebLayerSDDraft. However, firstly you have to access a Project from python (use arcpy.mp.ArcGISProject to set up your environment) which in a shared setup you may not want to do. Secondly CreateWebLayerSDDraft only allows you to publish to ArcGIS Online, i.e. you cannot even create an sddraft that is configured to publish to your own internal Portal. Strange! So the first question is, how are people going to publish to ArcGIS for Server if they only have ArcGIS Pro on their desktop? In ArcGIS Pro, you cannot connect to ArcGIS for Server for "manual" publishing from a map, and neither can you connect to ArcGIS for Server with arcpy.mp.CreateWebLayerSDDraft to use python for publishing. I had a look at the arcpy.sharing functionality, but there also, publishing is limited to Portal or ArcGIS Online. Is this an oversight? Now imagine I forget about publishing to ArcGIS for Server, it seems I am also limited in publishing to Portal. Say I want to use python in ArcGIS Pro to publish a map tile service directly to Portal for ArcGIS. This cannot be done because creating an SDDraft in python can only connect to ArcGIS Online. I have tried all options, but to me it looks like this is no longer possible. So in ArcGIS Pro my options are limited as follows: 1. Use python: can only publish to ArcGIS Online 2. Manually publishing from a map: can publish to Portal and ArcGIS Online (but I want to automate things) 3. Publishing to ArcGIS for Server: not possible manually or with python. Is this true? If my aim is to automate things and publish using python to Portal or ArcGIS Server, is there any way around this? Thanks Hugo
... View more
07-01-2018
11:15 PM
|
0
|
3
|
2523
|
Title | Kudos | Posted |
---|---|---|
1 | 10-06-2020 11:24 PM | |
2 | 10-24-2018 11:38 PM | |
1 | 06-08-2018 01:50 AM | |
2 | 10-23-2018 09:52 PM | |
1 | 06-21-2018 06:05 PM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|