IDEA
|
This is also relevant when a new feature gets added. For example, arcpy.metadata what version of ArcGIS pro can I use that at? It doesn't say on the help: Metadata—Metadata module | Documentation The only way I can work it out is searching the release notes. What's new in ArcGIS Pro 2.5—ArcGIS Pro | Documentation Note that the above link is also just the "latest" I can't direct link to the 2.5 release notes because they are the latest (I can link to 2.4). It would be best if the help said what version the feature was added at
... View more
03-09-2020
02:36 PM
|
3
|
0
|
925
|
POST
|
Circumstances are slightly different, I ran into this issue when trying to set defaults in updateParameters. But I imagine the solution is the same and since this has been around since 2013 and nobody has replied I thought I would! I'm using ArcGIS Pro and tested your script and it appeared to work Try setting it as a string like so s_val = "{0} {1}".format(point.X, point.Y)
parameter.value = s_val
... View more
12-17-2019
09:59 PM
|
0
|
0
|
367
|
POST
|
Øystein, I realised there was an issue with the NLS if you were using the "add from file" option. updated here Dropbox - AddDataPortal.zip - Simplify your life
... View more
12-02-2019
06:36 PM
|
0
|
0
|
1957
|
POST
|
Sorry try again. If this doesn't work drop me a PM on linked in (I don't think you can PM on geonet? Dropbox - AddDataPortal.zip - Simplify your life https://www.linkedin.com/in/davidjwilton/
... View more
11-21-2019
03:58 PM
|
1
|
2
|
1957
|
POST
|
Completely hacked together, but it it should work at least Dropbox - AddDataPortal.zip - Simplify your life
... View more
11-20-2019
02:58 PM
|
2
|
4
|
1957
|
POST
|
The problem here is that when you publish a widget into Portal its hosted outside the WAB and you run into issues with paths. Widgets/MyWidget will no longer work. I'm not 100% sure on i18n, it always seems to work differently with paths to other dojo require items. Anyway I ran into the same issue with the AddData widget so here is what I think. With the geoprocessing widget I see: RecordSetEditorChooser.js: 26 'dojo/i18n!../nls/strings', Here there is a path and it is failing to find it, the error message is misleading I think its actually looking for it in the WAB. There should be a way to make it work as a relative path but I'm not sure what it is. I ended up just requiring the js file relatively (so no i18n): './nls/strings', then using the .root property: RecordSetEditorChooser.js: 38 lang.mixin(this.nls, gpNls.root); This means your localisation won't work, but at least the widget may work... With the add data widget there were lots of data-dojo-type within the templates. Remember "widgets" no longer works as a path, this is looking in the widgets folder of the WAB, not local to your widget. To fix this I ended up removing the data-dojo-type and creating the widgets within widget.js. Hoepfully you won't have to do this and it will be the simple one line fix above (because this is a nightmare) data-dojo-type="widgets/AddData/search/ScopeOptions" The main point is that you have to get into the mindset that everything must work relatively if you are going to host the widget for portal
... View more
11-19-2019
07:46 PM
|
1
|
11
|
1957
|
POST
|
I have added an updated to this case after receiving a response from Esri: https://community.esri.com/thread/216962-apply-lyrx-file-symbology-via-python
... View more
08-26-2019
04:47 PM
|
0
|
0
|
1160
|
POST
|
I can confirm this works: import sys, os, arcpy
import arcpy
inputLayer = 'lakes'
symbologyLayer = r"C:\Temp\symbologyBug\Polygon_Styles.lyrx"
# Symbolize the input by FIL_COLOURfield
symbologyFields = [["VALUE_FIELD", "FIL_COLOUR", "FIL_COLOUR"]]
arcpy.ApplySymbologyFromLayer_management(inputLayer, symbologyLayer, symbologyFields)
arcpy.SetParameterAsText(0, inputLayer)
... View more
08-26-2019
04:47 PM
|
2
|
1
|
3634
|
POST
|
I just got an email from the bug saying that the way to fix this is to set the output as derived. Not had chance to test it thought I'd post in case someone wanted to Public Explanation: To fix this issue: After adding the arcpy.ApplySymbologyFromLayer_management(layer, lyrfile) Python command, add the arcpy.SetParameterAsText(2, layer) parameter. Save the script. ArcGIS Pro > Catalog Pane > Toolbox > Right click Script > Properties. Properties Window > Parameter Tab > Add a new parameter of type Layer, and set it to derived output Documenation: https://pro.arcgis.com/en/pro-app/arcpy/geoprocessing_and_python/setting-script-tool-parameters.htm#GUID-59C4A61C-AC33-4BA3-8453-AC8328E34453
... View more
08-26-2019
04:18 PM
|
0
|
0
|
3634
|
POST
|
Also worth noting that the image needs to be set to "Resource" not "addin content".
... View more
08-19-2019
09:17 PM
|
0
|
0
|
968
|
POST
|
I ran into this issue so I wrote an iterator class to do this. In my case I wanted to return the X,Y,Z values but you could easily modify to return the numpy array. It can be used simply like this: for block in RasterBlockIterator(raster, no_data_val=self.no_data_val):
for point in block:
x = point[0]
y = point[1]
z = point[2] The iterator class. If you want the numpy array just return the arr on line 62. By default it works in blocks of 1000*1000 class RasterBlockIterator:
"""Iterator that extracts tiles of data from a Esri Raster."""
def __init__(self, raster: arcpy.Raster, tile_size=(1000, 1000), no_data_val=np.nan):
"""
:param raster: Raster to iterate
:param tile_size: size of each block/tile to extrac to numpy array
:param no_data_val: value in the raster which should be treated as no data
"""
self.tile_size = tile_size
self.raster = raster
self.no_data_val = no_data_val
self.cell_size = raster.meanCellHeight
self.pos = 0
# work out the size of all the block to create. They won't be extracted at this point
t_rows = raster.height
t_cols = raster.width
x_min = raster.extent.XMin
y_min = raster.extent.YMin
self.tiles = []
for row in range(0, t_rows, tile_size[1]):
for col in range(0, t_cols, tile_size[0]):
colend = min([t_cols, col + tile_size[0]])
rowend = min([t_rows, row + tile_size[1]])
xstart = x_min + (col * self.cell_size)
ystart = y_min + (row * self.cell_size)
self.tiles.append(namedtuple('tile', 'colstart colend rowstart rowend xstart ystart')(
colstart=col,
colend=colend,
rowstart=row,
rowend=rowend,
xstart=xstart,
ystart=ystart
))
def __iter__(self):
return self
def __len__(self):
return len(self.tiles)
def __next__(self) -> List[Tuple[float, float, float]]:
try:
tile = self.tiles[self.pos]
except IndexError:
raise StopIteration
lower_l = arcpy.Point(tile.xstart, tile.ystart)
ncols = tile.colend - tile.colstart
rnrows = tile.rowend - tile.rowstart
arr = arcpy.RasterToNumPyArray(self.raster, nodata_to_value=np.nan,
lower_left_corner=lower_l,
ncols=ncols, nrows=rnrows)
# Loop over rows and extract X,Y,Z
output_data = [
(j * self.cell_size + tile.xstart, i * self.cell_size + tile.ystart, value)
for i, row in enumerate(arr)
for j, value in enumerate(row)
if not self.no_data_val == value and not np.isnan(value)
]
self.pos += 1
return output_data ```
... View more
08-05-2019
11:45 PM
|
0
|
0
|
229
|
POST
|
I reported this as a bug, I will update with Esri's response
... View more
05-29-2019
04:48 PM
|
0
|
1
|
894
|
POST
|
Found this post as I've hit the same issue. Did you submit a bug? I found it was an issue when trying to add scale dependency for a symbol layer. Like I think you say this works: But this does not
... View more
05-22-2019
10:25 PM
|
0
|
2
|
894
|
POST
|
I had some simple user drawn data and I was able to do this by using the following two libs: https://github.com/Esri/arcgis-to-geojson-utils https://github.com/mapbox/shp-write // convert it to geojson ready for saving // parse ArcGIS JSON, convert it to GeoJSON this.geojson = esriUtils.arcgisToGeoJSON(graphic); // download the data shpwrite.download({ type: 'FeatureCollection', features: [ this.geojson ] }); Currently an issue with mapbox which I had to manually fix: https://github.com/mapbox/shp-write/issues/48
... View more
04-03-2019
08:45 PM
|
1
|
0
|
385
|
Title | Kudos | Posted |
---|---|---|
1 | 11-19-2019 07:46 PM | |
1 | 06-15-2023 03:40 AM | |
1 | 08-23-2022 10:43 PM | |
3 | 08-19-2021 09:58 PM | |
2 | 08-18-2020 08:10 PM |
Online Status |
Offline
|
Date Last Visited |
08-04-2023
04:20 AM
|