|
POST
|
If you know what the cartesian coordinates are (UTM? Albers? etc?) you can provide the details to the tool and the data will come right in. But you need to know the projection, parameters, datum of your cartesian coordinates.
... View more
12-10-2021
03:00 PM
|
0
|
0
|
1637
|
|
POST
|
When validation is an issue often a good workaround is to execute the tool (using arcpy) inside a Calculate Value Python code block.
... View more
12-10-2021
10:27 AM
|
0
|
0
|
2897
|
|
POST
|
@Sara_ I have seen this particular error thrown by raster tools when the raster can't be written for some some reason (example: problematic raster pathname). Perhaps you could share more of the geoprocessing message string to this thread (you can copy and paste it as text to get the whole thing), as it may be illuminating to what is wrong.
... View more
12-10-2021
10:22 AM
|
0
|
0
|
3244
|
|
POST
|
Right click the Project tool and to add the output coordinate system variable to the model.
... View more
12-10-2021
10:18 AM
|
0
|
0
|
854
|
|
POST
|
That's great! Could you mark the first (updated) post with the screenshot of the test model as the solution? I think the post with the ModelBuilder model would be most useful to people looking for an answer to this question.
... View more
12-10-2021
10:16 AM
|
1
|
1
|
3472
|
|
POST
|
My understanding is that raster functions are on the fly animals that process at a dynamic resolution and window, so seems to me the idea of a raster table wouldn't really apply, as you need a complete dataset to calculate cell counts and a list of unique values.
... View more
12-10-2021
08:22 AM
|
0
|
0
|
1822
|
|
POST
|
Improved, skipping the zip to avoid trying to write it into itself: import os
import glob
import zipfile
def zipshape(folder, name):
os.chdir(folder)
zipname = name + ".zip"
flist = glob.glob(name + ".*")
with zipfile.ZipFile(zipname, "w") as newzip:
for ff in flist:
if ff[-4:] != "lock" and ff != zipname:
newzip.write(ff)
return os.path.join(folder, zipname)
... View more
12-10-2021
08:02 AM
|
1
|
3
|
11836
|
|
POST
|
I've got an an idea for a small code change, modify the code I posted, try changing for ff in glob.glob(name + ".*"): to for ff in glob.glob(name + "*"):
... View more
12-10-2021
07:37 AM
|
0
|
6
|
3490
|
|
POST
|
That's really weird as it worked for me - but my test model didn't create the shapefile, I gave it a path to an existing one. Too bad the zip isn't valid as I can't imagine what it was trying to stuff in there. Thanks for the really detailed screenshot, I will look at the puzzle.
... View more
12-10-2021
07:32 AM
|
0
|
7
|
3491
|
|
POST
|
Honestly I can't think of an simpler way to do this. This is a plug and play python function, you don't need to edit it at all, just create a calculate value tool and paste the code in the code block, and make sure the variables (inside the %) match the model variables that have your folder and shapefile name. The function doesn't care as long as you give it the correct folder and shapefile root name, which is easily found with Parse Path. I suppose you could enter your folder and shapefile name directly in the Calculate Value tool expression in place the model variables...but Parse Path makes it pretty easy to avoid having to hard-code it.
... View more
12-09-2021
03:01 PM
|
1
|
12
|
8381
|
|
POST
|
If you use parameter validation, the user would not need to notice - the tool would not run and would give them a reminder why it won't run.
... View more
12-09-2021
09:04 AM
|
0
|
0
|
1055
|
|
POST
|
UPDATE: added check to loop to avoid trying to write the zipfile into itself and causing an infinite loop (!) (discussed downthread) UPDATE: this function requires the two inputs folder (path to the shapefile) and name (shapefilename, for example if your shapefile is foo.shp, the name should be foo (without the extension) import os
import glob
import zipfile
def zipshape(folder, name):
os.chdir(folder)
zipname = name + ".zip"
with zipfile.ZipFile(zipname, "w") as newzip:
for ff in glob.glob(name + ".*"):
if ff[-4:] != "lock" and ff != zipname:
newzip.write(ff)
return os.path.join(folder,zipname)
... View more
12-09-2021
08:36 AM
|
3
|
1
|
8398
|
|
POST
|
You can do this using the Calculate Value tool, with a python function that uses glob and zipfile. You may want to run Parse Path first to get the info you need to create the zip (folder, shapefile root name).
... View more
12-09-2021
08:05 AM
|
2
|
18
|
8411
|
|
POST
|
arcpy.mp doc on the Map object says: Note: arcpy.mp does not provide access to map views within the application; it only provides access to MapFrames. So I'm not sure this is possible from arcpy.mp - hopefully someone else will chime in soon. Your solution may be to provide an error message to tell the user to select the correct map before running the tool. Better yet, do this in the parameter validation to keep the user from running the tool when the wrong map is active.
... View more
12-09-2021
07:54 AM
|
0
|
0
|
1061
|
|
POST
|
That is strange. I'd look carefully at path names to make sure they are not problematic. Hard to suggest anything else without more information.
... View more
12-08-2021
08:16 PM
|
0
|
0
|
2080
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|