|
POST
|
Hi Gina, ArcGIS has no problems with underscores in the output field name. If you use DIST_BUFF instead of BUFF_DIST it simply works.BUFF_DIST is the default name assigned in the normal buffer tool (not multi-ring). The Help of the normal Buffer tool states: The output feature class will have a field, BUFF_DIST, that contains the buffer distance used to buffer each feature, in the linear unit of the input features' coordinate system. If a field named BUFF_DIST exists in the input, it's values will be overwritten in the output. The BUFF_DIST is sort of a system field in the buffer process (although it shouldn't be for the multi-ring tool). It get's even nicer if your input features have a field called "BUFF_DIST". This field will be removed from the output when doing a multi-ring buffer... I guess there is room for enhancement here... Kind regards, Xander
... View more
12-22-2014
07:05 PM
|
0
|
2
|
2538
|
|
POST
|
What version of ArcGIS are you using? Just did a test on ArcGIS 10.2.2 and had no problems (called the output field "theDist".
... View more
12-22-2014
04:29 PM
|
0
|
4
|
2538
|
|
POST
|
Was your question replied? In that case you should mark the post that answer your question as "Correct Answer". Personally I believe the post by Alexander Nohe answered your question.
... View more
12-22-2014
03:47 PM
|
0
|
1
|
2171
|
|
POST
|
Hi Amy, The InitializeParameter method is not the place, I think, since at that point you don't know what the layer is that will be selected, and clearing all where clauses is not a good thing to do. I think you will need to pump in some more code in the updateParameters method, where you access the layer in the TOC and clear any where clause. The other option would be to determine the source of the featurelayer and access the featureclass instead of the featurelayer, since a featureclass does not have a where clause applied to it. Kind regards, Xander
... View more
12-22-2014
03:44 PM
|
0
|
0
|
3078
|
|
POST
|
Hi Stefan, After we had contact through mail I send you a complete shapefile of the 46+K features. For those of you that may have a similar question I'll include an explanation of the steps that I followed. What I did was: Through REST a query for all the ID's of the hydrants Access the list of ObjectIDs Sort this list of ObjectIDs Create chunks with less than 1000 elements For each chunk (list of sorted ID's), determine the min and max Query the service for ID's in the range of each min and max. Now at home, where I don't have an eval proxy to fight against, the code posted earlier seems to work after I added the "NO_TEST" parameter to the append tool (the schema of the featureset was not the same as the shapefile, since long field names are truncated in shapefile/DBF format) So the advice is, simply write to a fgdb featureclass... Kind regards, Xander
... View more
12-22-2014
03:35 PM
|
0
|
0
|
4472
|
|
POST
|
Cheers! I'll have on too.... Could you mark the post as answered (there should be a button "Correct Answer" at each post, just click on the one corresponding to the post that answered your question).
... View more
12-21-2014
12:49 PM
|
0
|
0
|
1495
|
|
POST
|
You are trying to create a text file in this location: "C:/GIS/Track1/1_Orig/Track1.gdb/Tracklines/" This is a dataset within your file geodatabase and that won't work. The other thing is you trying to create a shapefile inside you file geodatabase, which won't work either. It would be better to define the "outTrackFile" and "outTrackPolylineFeatures" as follows: outTrackFile = os.path.join(folder, "xy_{0}.txt".format(id))
outTrackPolylineFeatures = os.path.join(ws, ds_name, "xy_{0}".format(id)) This will require defining another variable called folder that points to an existing folder where the text file should be created. I haven't looked closer to your code and obviously haven't tested it, but the code below might work for you: import arcpy, os
from arcpy import env
from arcpy.sa import *
# Set local variables
folder = r"C:\GIS\Track1\1_Orig"
ws = r"C:\GIS\Track1\1_Orig\Track1.gdb"
ds_name = "Tracklines"
inDirectionRaster = "ragw_dir2"
inMagnitudeRaster = "ragw_mag2"
stepLength = 10
trackingTime = 10000000
csv_file = r"C:\2_UWaterloo\10_ArcGIS\GWtoolset\LandBlocks\RA\input\SourcePts10.csv"
env.workspace = ws
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
i = 0
try:
with open(csv_file ,'r') as infile:
for line in infile:
i += 1
if i != 1:
x = line.split(',')[0]
y = line.split(',')[1]
id = line.split(',')[2]
sourcePoint = arcpy.Point(float(x),float(y))
outTrackFile = os.path.join(folder, "xy_{0}.txt".format(id))
outTrackPolylineFeatures = os.path.join(ws, ds_name, "xy_{0}".format(id))
# Execute ParticleTrack
ParticleTrack(inDirectionRaster, inMagnitudeRaster, sourcePoint,
outTrackFile, stepLength, trackingTime, outTrackPolylineFeatures)
arcpy.CheckInExtension("Spatial")
except:
print arcpy.GetMessages(2)
... View more
12-20-2014
04:01 PM
|
2
|
2
|
1495
|
|
BLOG
|
The next step would be to make it work with any size of numbers...
... View more
12-19-2014
04:42 PM
|
0
|
0
|
2656
|
|
POST
|
Below an example of a list of field from a featureclass extracted from the Help (ArcGIS Help (10.2, 10.2.1, and 10.2.2) ) def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Input Features",
name="in_features",
datatype="GPFeatureLayer",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Field",
name="field",
datatype="Field",
parameterType="Required",
direction="Input")
# Set the filter to accept only fields that are Short or Long type
param1.filter.list = ['Short', 'Long']
param1.parameterDependencies = [param0.name]
... View more
12-18-2014
05:43 PM
|
0
|
0
|
929
|
|
POST
|
I can't seem to get the list values to appear after selecting a field (which are numbers stored as text). It tells me I have illegal list values. try to change the code from lines 4 - 6 into a single line, it might solve the problem with the list. lst_vals = arcpy.GetParameter(2) Otherwise add a arcpy.AddMessage(lst_vals) to the code to see what the list is like. Also the only way I can get a field list to appear in the UI is to use a feature class data type (feature layer = nothing). I would like to use feature layer so only layers in the data frame can be used. In the parameter definition of the tool you have to define that the field is obtained from the featurelayer: A feature layer type still let's you browse for a featureclass that is not in your TOC, so this is a possible source for errors
... View more
12-18-2014
05:24 PM
|
0
|
2
|
3078
|
|
POST
|
The export is using is using the projected coordinate system. The latitude longitude are probably configured for display of the coordinates in the data frame.
... View more
12-18-2014
05:10 PM
|
0
|
0
|
906
|
|
POST
|
The description of the tool could describe in batch mode the separate parameters, but it would be nicer if this would be handled by the tool itself so you would not have to duplicate descriptions.
... View more
12-18-2014
05:08 PM
|
0
|
0
|
2657
|
|
POST
|
That is a good suggestion (+1 for that). The alternative would be to use: How do i decrypt using hashlib in python? - Stack Overflow or simple-crypt 3.0.2 : Python Package Index But then you would still store the encrypted password in a config file (which you can read with ConfigParser) and anyone with access to the code could still decrypt it...
... View more
12-18-2014
04:11 PM
|
1
|
0
|
1741
|
|
POST
|
Combing your code with my example would yield something like: import arcpy
fc = arcpy.GetParameterAsText(0)
fld = arcpy.GetParameterAsText(1)
lst_vals = arcpy.GetParameter(2)
where = "{0} in ('{1}')".format(arcpy.AddFieldDelimiters(fc, fld), "','".join(lst_vals))
arcpy.AddMessage(where)
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
layer = arcpy.mapping.ListLayers(mxd, fc)[0] # assuming that the layer is selected from the TOC
layer.definitionQuery = where
ext = layer.getExtent()
df.extent = ext
del mxd, df, layer If the idea is to zoom in to the selected items...
... View more
12-18-2014
04:08 PM
|
0
|
4
|
3078
|
|
POST
|
Maybe this post can help you in some way: Some Python Snippets If you have more specific problems you run into, just post them, and there will be loads of people eager to help you (for free),.. that's what the community is all about. Kind regards, Xander
... View more
12-18-2014
03:48 PM
|
1
|
0
|
570
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|