|
POST
|
I've updated it to arcpy.sa.Con... I've tested it with dummy data on my system and it works. If this doesn't work i'd suggest it's a corruption of your raster(s) or a file naming or path issue. import arcpy
import os
arcpy.CheckOutExtension("Spatial")
arcpy.env.workspace = r"D:\test"
out_workspace = r"D:\output"
#InMask = r"E:/JASTTpaperWork/Data/Shapefile/KRG.shp"
# Get a list of grids in the workspace.
rasters = arcpy.ListRasters("","TIF")
for raster in rasters:
# Set the outputname for each output to be the same as the input.
output_path = os.path.join(out_workspace,raster)
#create raster object
raster_path = os.path.join(arcpy.env.workspace,raster)
raster_object = arcpy.Raster(raster_path)
#return conditional raster
con_raster = arcpy.sa.Con(raster_object <= -1, 0, raster_object)
#save it
con_raster.save(output_path)
arcpy.CheckInExtension("Spatial")
... View more
03-18-2020
01:25 PM
|
2
|
1
|
1180
|
|
POST
|
Try hardcoding a different path as the out workspace. look at your path formatting and check against examples in the esri help. There's no need to keep adding those modules - sys, string, arcgisscripting, math. it just slows down your process.
... View more
03-18-2020
11:01 AM
|
0
|
5
|
2762
|
|
POST
|
I've changed this to arcpy.Raster if that doesn't work try arcpy.Raster(raster)
... View more
03-18-2020
03:11 AM
|
0
|
7
|
2762
|
|
POST
|
import arcpy
import os
arcpy.CheckOutExtension("Spatial")
arcpy.env.workspace = r"E:/JASTTpaperWork/Data/Processed/TIFF/"
out_workspace = r"E:/JASTTpaperWork/Data/Processed/TIFF/ArcGIS02"
InMask = r"E:/JASTTpaperWork/Data/Shapefile/KRG.shp"
# Get a list of grids in the workspace.
rasters = arcpy.ListRasters("","TIF")
for raster in rasters:
# Set the outputname for each output to be the same as the input.
output_path = os.path.join(out_workspace,raster)
#create raster object
raster_path = os.path.join(arcpy.env.workspace,raster)
raster_object = arcpy.Raster(raster_path)
#return conditional raster
con_raster = Con(raster_object <= -1, 0, raster_object)
#save it
con_raster.save(output_path)
arcpy.CheckInExtension("Spatial")
def ty(name):
return print("Thanks" + name)
ty("Dave")
... View more
03-17-2020
02:36 PM
|
2
|
9
|
2762
|
|
POST
|
I'm not familiar with this tool so I'm going to offer some very vague and probably incorrect advice! The output seems to be a group layer which might be causing the issue, could you package it up into a zip file to download or does it need to be added as an operational layer or add some code to add the individual layers? Have you looked at all of the options for the output in the publishing window?
... View more
03-16-2020
03:30 AM
|
0
|
0
|
1218
|
|
POST
|
Hi Jeremy, In the desktop environment (written as code to run as a script or script tool) one way this could be implemented is to set up you mxd at the required scale, including all the data and labelling you would expect/like to see if you manually zoomed or panned around the map. In the code I would use a query to select your address feature and grab its SHAPE@ geometry token. Using this I would then use the pantoextent method of your current dataframe with arcpy.Mapping. Hopefully this would then centre your dataframe on the address whilst keeping the required scale. Then an ExporttoPDF to create your report. In a server environment, this could be published as a geoprocessing task, allowing users to open up a Wep Mapping Application you have designed, then type the address into a geoprocessing widget which spits out the pdf. Another implementation might be to let the user zoom to the address using a geocoding service (address locator etc), then set up their own bespoke labelling and use a custom print service to export what's on the screen.
... View more
03-16-2020
03:10 AM
|
0
|
0
|
1536
|
|
POST
|
#import modules
import arcpy
import os
##parameters##
#change this but keep the r'' enclosing the path
mxd_path = r'c:\desktop\mymxd.mxd'
#what dataframe do you want to copy the symbology of
symbol_dataframe_name = "Miami"
#dont change this bit
symbol_layer_name = symbol_dataframe_name + "Transit"
#make a list of the cities you want to update symbology of
#a list in python is enclosed in square brackets
#e.g. [Birmingham, Boston, Chicago, Dallas]
update_dataframe_list = []
##main##
#get the map document object from your mxd path
map_doc = arcpy.mapping.MapDocument(mxd_path)
#make a list of the dataframes in the mxd
df_list = arcpy.mapping.ListDataFrames(map_doc)
#find the dataframe which matches the city name
#eg Maimi
template_df = ''
for df in df_list:
if df.name == symbol_dataframe_name:
template_df = df
else:
print("Not Found")
#for the matching dataframe, look through its layers
#and find the layer which matches Transit
#e.g if layer_name = "MaimiTransit"
template_df_layers = arcpy.mapping.ListLayers(template_df)
template_layer = ''
for layer in template_df_layers:
if layer.name == symbol_layer_name:
template_layer = layer
else:
print("Not Found")
#get all the layers to be updated using the template_layer
#using the dataframe list we created earlier
#excluse our template dataframe, != is syntax for not equal to
#make a list of lists containing layer and dataframe objects
layers_to_update_df_list = []
for df in df_list:
if df.name != symbol_dataframe_name:
for layer in arcpy.mapping.ListLayers(df):
if layer.name in update_dataframe_list:
layers_to_update_df_list.append([layer, df])
#use update layer to change symbology of layers in
#layers_to_update_list using template_layer
for layer in layers_to_update_df_list:
arcpy.mapping.UpdateLayer(layer[1], layer[0], template_layer, True)
#save to a new mxd
map_doc.saveACopy((mxd_path[:-4])+"UpdatedSymbology.mxd"))
del map_doc
... View more
03-14-2020
12:47 PM
|
0
|
0
|
1163
|
|
POST
|
It seems the updateRow(row) must be applied a the end to effect the deletion: with arcpy.da.UpdateCursor (in_table="RoadsAnno", field_names=["Status","TextString"]) as cursor:
for row in cursor:
row[0] = 0
if row[1] is None:
cursor.deleteRow()
cursor.updateRow(row)
... View more
03-13-2020
04:25 AM
|
1
|
0
|
4836
|
|
IDEA
|
It seems like a big oversight not to have this exposed as a parameter.
... View more
03-08-2020
07:04 AM
|
0
|
0
|
1563
|
|
POST
|
If it's just being passed as a parameter, try = 'RESNET34'
... View more
03-08-2020
03:55 AM
|
0
|
1
|
4056
|
|
POST
|
From a purely python perspective it's not understanding your class name 'models'. Try pytorch.models.resnet34 or whatever module you imported.
... View more
03-08-2020
03:31 AM
|
1
|
3
|
4056
|
|
POST
|
Hi Tom, It may be some profile data remaining in your AppData folder (mine is C:\Users\DaveP\AppData). If you cant see this folder in your C:\ drive, it may be hidden, just go to 'view' and tick the 'show hidden items' box. This is dependant on OS though. Before you delete or rename the Esri folders, try to install the software on a different profile to check this is causing the problem. Bonjour Tom, Il se peut que certaines données de profil restent dans votre dossier AppData (le mien est C:\Users\DaveP\AppData). Si vous ne pouvez pas voir ce dossier dans votre lecteur C:\, il peut être masqué, allez simplement dans 'voir' et cochez la case 'afficher les éléments cachés'. Cela dépend cependant du système d'exploitation. Avant de supprimer ou de renommer les dossiers Esri, essayez d'installer le logiciel sur un profil différent pour vérifier que cela cause le problème.
... View more
03-07-2020
08:45 AM
|
0
|
1
|
4543
|
|
POST
|
Hi Krissy, Maybe a rough-and-ready representation of the dorms, rooms and their rough position would actually be better and easier to interpret than a full-on CAD for each dorm? Much like the London Underground (tube) map. I think that could be knocked up very quickly.
... View more
03-07-2020
07:48 AM
|
0
|
2
|
1445
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-13-2025 01:08 PM | |
| 1 | 09-25-2025 03:19 PM | |
| 1 | 09-24-2025 02:35 PM | |
| 1 | 09-17-2025 02:42 PM | |
| 1 | 09-10-2025 02:35 PM |
| Online Status |
Offline
|
| Date Last Visited |
01-14-2026
12:10 PM
|