POST
|
I downloaded a couple. They're definitely 3 band RGB (tested with GDAL and QGIS as well) with no attributes. I think it's just a poor choice of output format by the authors. However, it's a very simple classification: 255,0,0 = Building 133,133,133 = Road 128,236,104 = Grass/Shrub 34,139,34 = Tree canopy etc...
... View more
09-05-2023
01:15 AM
|
0
|
1
|
1311
|
POST
|
@TobiasWalter wrote: I have a DEM raster for Germany with about 2000 pixels. A "value" that describes the altitude below or above the sea level is attached to each individual pixel in the attribute table that I gained access to when I converted the raster from float to integer using the Int-tool. You probably have more than 2000 pixels. Have a look at the attribute table, you'll see value and count columns. The count column has the number of pixels in the raster that have the corresponding value. Unless every one of the 2000 records has a count of 1, then you have more than 2000 pixels (sum up the counts to get the total, excluding any nodata pixels). If your attribute field is integer or string, just specify it as the field to copy to the output in the Raster to Polygon tool. If your attribute field is neither integer or string, after you convert the raster to polygon, use the Join Field tool to copy the field across, you don't have to have the same number of rows. Alternatively, you can run Dissolve (or Pairwise Dissolve) on the output, then join.
... View more
09-02-2023
01:13 AM
|
0
|
0
|
355
|
POST
|
I think feature class names need to use ascii characters only. From the help:
... View more
08-30-2023
09:23 PM
|
0
|
0
|
428
|
POST
|
@AlfredBaldenweck wrote: Each feature dataset is considered its own environment by arcpy, so functions like Walk() and ListFeatureClasses() will ignore stuff in a feature dataset if run on a geodatabase. Not quite right for Walk. You just need to keep iterating through the Walk results. Any feature datasets are considered workspaces, so Walk will recurse to them and return their contents.
... View more
08-30-2023
02:52 PM
|
0
|
1
|
442
|
POST
|
Works for me in ArcMap 10.8.2. Given a FGDB with 2 FCs, "A" and "B" with "B" in feature dataset "FD": import arcpy
for parent, workspaces, datasets in arcpy.da.Walk("Default.gdb"):
print("parent: %s"%parent)
print("workspaces: %s"%workspaces)
print("datasets: %s"%datasets) Output showing that "B" is listed correctly in the feature dataset "FD": parent: Default.gdb
workspaces: [u'FD']
datasets: [u'A']
parent: Default.gdb\FD
workspaces: []
datasets: [u'B']
... View more
08-30-2023
02:45 PM
|
0
|
1
|
442
|
POST
|
Perhaps try running the Check (or Repair) Geometry tool.
... View more
08-28-2023
03:31 AM
|
1
|
1
|
396
|
BLOG
|
Hmmm "Python in Excel runs on the Microsoft Cloud with enterprise-level security as an M365 connected experience". What about people who don't have a M365 subscription who receive a Python powered spreadsheet....? More info including some limitations here.
... View more
08-24-2023
03:37 PM
|
0
|
0
|
169
|
POST
|
Yes, it's because you are trying to open data that you don't have stored on your computer (or is stored in a different location than the layer is looking for the data in). A layer file (*.lyrx") does not contain the data, it just contains a link to the datasource (e.g shapefile, geodatabase feature class or raster etc) plus the symbology, definition query, labelling etc. The exclamation point is telling you that Pro can't find the datasource the layer file is linked to. It doesn't mean that Pro can't find the layer file itself. You should ask the 3rd party to share their data as well as the layer file, either in it's original format or as a layer package (*.lpkx).
... View more
08-24-2023
01:50 PM
|
2
|
0
|
1745
|
POST
|
@BlakeTerhune wrote: Oh, that's an interesting idea. Could you share a sample of your calling script? Script tool (scripttool.py) import arcpy
def main(parameter1, parameter2):
#do something with parameters
return
if __name__ == "__main__":
#this won't get run when imported
param1 = arcpy.GetParameterAsText(1)
param2 = arcpy.GetParameterAsText(2)
main(param1, param2) Test script (test.py) import scripttool
# Some hardcoded path for debugging
parameter1 = "D:/Temp/test2.shp"
parameter2 = "D:/Temp/test2.shp"
scripttool.main(parameter1, parameter2):
... View more
08-11-2023
05:19 PM
|
2
|
0
|
1203
|
POST
|
As you get into more complicated scripts, one way is to do all your testing and debugging in a proper IDE such as PyCharm or Visual Studio Code. Keep all the logic in functions (just as you've got in your screenshot) and then either in the if __name__ == "__main__": block comment out the arcpy.GetParameterAsText lines and replace with hardcoded values and run in the IDE debugger, or leave your script as-is, create a test/debug script that imports your script and calls the function with hardcoded values and run the test/debug script in the IDE debugger.
... View more
08-11-2023
03:42 PM
|
2
|
3
|
1212
|
POST
|
Yes. But you need to understand scope. At it's simplest, functions (and variables) are objects and objects are only "visible" at (or below) the scope in which they are created. So by creating a function inside the local scope of a method (e.g. __init__ or execute), you can only use that function inside the method you defined it in. E.g. class Tool(object):
def __init__(self):
def func_in_init():
return "init"
def execute(self):
def func_in_exec():
return "exec"
print(func_in_exec()) # this will work
print(func_in_init()) # this will raise NameError
If you want to use a function anywhere, define it globally, if you want to use it anywhere in your Tool class and not outside the class, make it a method.
... View more
08-11-2023
03:32 PM
|
0
|
0
|
302
|
POST
|
You can also use the string.lstrip (left strip) method. This will remove the given character from the start of a string, leaving the string untouched if it doesn't start with that character. layers = [l.lstrip("T") for l in act_map.listLayers()]
... View more
08-06-2023
05:37 AM
|
2
|
0
|
422
|
POST
|
Do you have a getParameterInfo method defined? def getParameterInfo(self):
"""Define parameter definitions"""
params = None
return params
... View more
08-02-2023
02:24 PM
|
0
|
0
|
285
|
POST
|
Really the only way you might get the pixel values actually changing is if the output coordinate system is different and the raster gets resampled when it is reprojected.
... View more
07-27-2023
04:49 PM
|
0
|
1
|
740
|
POST
|
@JohnBranum wrote: In all my tests, what appears to happen is that the clipping process reevaluates the clipped raster, reassigning values from min to max, which will change those values if, for example, the removed portions were higher and/or lower values than what remains. I think what you are referring to there is what happens to the symbology which is just a visual representation. It doesn't change the underlying values though.
... View more
07-27-2023
04:36 PM
|
1
|
0
|
740
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
2 | 2 weeks ago | |
1 | 03-04-2024 02:05 AM | |
1 | 07-11-2022 05:26 PM | |
3 | 02-19-2024 01:54 PM |