POST
|
Thanks! This is the working code with inputes for script tool for Arcgis. I havent tested the error code function sinse it just worked.. import arcpy, os, os.path
Path = arcpy.GetParameterAsText(0)
Size = arcpy.GetParameterAsText(1)
CalSeize = ( int(Size) * 1024)
arcpy.AddMessage ("Path to search for files: " +(Path))
arcpy.AddMessage ("Min file seize to keep: " + (Size)+"Kb")
arcpy.AddMessage ("Calculatde min size: " + str(CalSeize) + " bytes")
for root, _, files in os.walk((Path)):
for f in files:
fullpath = os.path.join(root, f)
fileSize = os.path.getsize(fullpath)
if fileSize < CalSeize: # Calculate min file value to keep
try:
os.remove(fullpath)
arcpy.AddMessage ("Removed: " + f + " with the size: " + str(fileSize) + " bytes" )
print 'removed: ' + f + ' file size: ' + str(fileSize) + 'bytes'
except WindowsError as ex:
print "Error: " + fullpath
else:
print fullpath + f + ' is within min. File size: ' + str(fileSize) + 'bytes'
i
... View more
07-25-2022
03:20 AM
|
0
|
1
|
258
|
POST
|
Hi. I have some LAS files that contain nothing, but my sub program dosent like empty files, so I'm trying to write an script that removes all files smaller that ex. 10kb. But I cant get it to work, and I'm not good at python or any type of programming... This is the code I have been trying to get to work: import os, os.path for root, _, files in os.walk("C:/some/dir"): for f in files: fullpath = os.path.join(root, f) try: if os.path.getsize(fullpath) < 10 * 1024: #set file size in kb print fullpath os.remove(fullpath) except WindowsError: print "Error" + fullpath
... View more
07-19-2022
06:03 AM
|
0
|
3
|
317
|
POST
|
Yes you'r right, merging layer would loose their symbology and is not the solution I'm loocking for. I suspected that scripting is the solution... 😞 It would probably be less time consuming for me to add all layers in ffolder to TOC, Group them, Rename by Foldername manually and save the Group as an new LYR file then to learn python scripting..
... View more
09-01-2021
01:36 AM
|
0
|
0
|
467
|
POST
|
Many Lyr files in a folder to one new lyrfile - Possible in modelbuilder? I have 4000 folders with 11 lyrfiles in each, with their own symbology. I need to create one lyr file for each folder with all the 11 lyrfiles as input. Any ideas to do this? I'm using Desktop 10 and have, but not used PRO yet... -Nope, I can't script in python... Cuz I dont have the knowlage...
... View more
09-01-2021
12:44 AM
|
0
|
2
|
487
|
POST
|
I have gotten an shapefile witch I want to open in an other program, but there seams to be an misscount of features in the shp file and the db file, how to i fix this?
... View more
08-17-2017
02:10 PM
|
0
|
3
|
484
|
POST
|
After updating and applying some uppgrades/fixes it now works... strange but works...
... View more
07-31-2017
07:46 AM
|
1
|
0
|
284
|
POST
|
I have used this tool for the last year, and I had no problem, all the sudden the add raster tool has problems... Anyone know how to resolve this? The last uppdate of windows gave me hell with active x warnings, but OI think that is resolved now, but this came in the same time.
... View more
07-26-2017
12:30 PM
|
0
|
1
|
433
|
POST
|
OK, to answer myself. First of all Abdullah Anter was right. To do what I wanted I needed to understand how Join and Relate really works. Then just add fields and calculate them in modelbuilder as desired. 1. Join by spatial reference 2. Statistics based on a comon field attribute ex. "ObjectID" to get them to correspond to eachother. 3. Join Field from the statistics to the polygon. 4. Then add fields an do the nesseserry calculations.
... View more
02-22-2017
12:43 AM
|
1
|
0
|
676
|
POST
|
In this case the polygon feature only has unike field value in "OBJECTID", after spatial join "OBJECTID_1".
... View more
02-21-2017
06:02 AM
|
0
|
0
|
676
|
POST
|
Thanks Abdullah Anter. Not really what I thought to do... But its a step atleast to find the height distrubution that does the trick. But I leave that for now. I have points for all polygons. I want to do thease calculations and add the results to each polygon so that you easly can use the "info" tool to get this: Area - This is alredy in the polygon. Sum of points within each polygon Sum of points within each polygon / (devided) by Area Mean value of points within each polygon Avrage spacing of points: √10000/(Sum of points within each polygon / (devided) by Area) Not easy to understand how to really do this, peferly I would like to use modelbuilder so i can add this to the other analasys where i got this data from.
... View more
02-21-2017
04:51 AM
|
0
|
0
|
676
|
POST
|
Hi Dan. I hvent really tryed anyting aoccessfull.. Near tool on the point with the same point to get spacing between, this is also an factor that would be intressting, but not my focus right now. I had a quick lock at reports in the attribute tabel, but that dosent really give me what i want. Tryed avrage nearest naighbor report, but I diddent relly figure ut what I got back in that in the report. Scripting is'nt relly my thing, quite good at model builder.. Gonna have a lock at the links Anter. but to be abel to just print an paper or PDF would be the ting... /Johnny
... View more
02-20-2017
09:50 AM
|
0
|
0
|
676
|
POST
|
I want to create a clean and simpel report and diagram with: points per Hectars points mean value (Topheight), point per hectar and where I can see that amount of points that have (topheight) values. Exampel: Total points: 4000 point = 400/ha Mean (topheight): 6 meters 400 points per/Ha, where 100 are 2meter, 200 are 3meter, and so on.. How do I do this? Arcgis 10,4, spatial analyst, 3d analsyst. Attached shapefile of intrest. with polygon border. /Johnny
... View more
02-20-2017
04:40 AM
|
0
|
7
|
1171
|
POST
|
How do i tranform tabel values values rounded to steps of 0,5? ex. Value 2.66 to 2.5 and 8,76 to 9.0 in arcgis 10? I need them to be rounded in step by 0,5. Thers probably some easy solution, the only thing i found is round to nth. But not quite what I'm locking for.. Always greatfull for all the help we get here! /J
... View more
02-02-2017
01:36 PM
|
0
|
1
|
761
|
POST
|
Well.... I dont see what I'm doing wrong here.... with this code I just selects everything... gridcode >= ((SELECT MAX( GRIDCODE ) FROM PEAK_LO_111) ) *0.8
... View more
12-19-2016
07:32 AM
|
0
|
1
|
545
|
POST
|
Thats works fine if I have exported the shapefile to a database, but if I have a created feture class indide a database the same querry selects everything, What I'm I doing wrong here?
... View more
12-15-2016
03:45 AM
|
0
|
0
|
545
|
Title | Kudos | Posted |
---|---|---|
1 | 07-31-2017 07:46 AM | |
1 | 02-22-2017 12:43 AM |
Online Status |
Offline
|
Date Last Visited |
10-12-2023
03:12 AM
|