|
POST
|
then all you need to do is make the selection FC the input, not the fc.
... View more
05-08-2015
12:13 PM
|
1
|
2
|
2658
|
|
POST
|
This might be a good opportunity for you to use model builder to set-up your workflow. Set it up for one fc in model builder, then you can export the model to a python script, then use your list feature classes to loop through and use each fc as input. This way you know your parameters are working for the buffer to start with(or at least can compare to what is going on now). If not, you are very close, you just need to make sure for each buffer you are using the fc you made as the input for the buffer. Since the new feature classes are already in your workspace, you would just need to use their name as a string as input for the buffer tool. I would put the buffer in the loop and have it put different names depending on the input fc name.
... View more
05-08-2015
10:46 AM
|
1
|
19
|
4675
|
|
POST
|
So are trying to buffer selected features of each features class that you copied to your GDB? Original Script(for anyone else who wants to chime in) import arcpy, os
arcpy.env.workspace = "F:/GEO443/FinalPrj"
arcpy.env.overwriteOutput = True
#Variables holding location of each counties LBRS points
brown = "F:/GEO443/FinalPrj/LBRS_data/Brown_cty/BRO_ADDS.shp"
clermont = "F:/GEO443/FinalPrj/LBRS_data/Clermont_cty/CLE_ADDS.shp"
hancock = "F:/GEO443/FinalPrj/LBRS_data/Hancock_cty/HAN_ADDS.shp"
muskingum = "F:/GEO443/FinalPrj/LBRS_data/Muskingum_cty/MUS_ADDS.shp"
richland = "F:/GEO443/FinalPrj/LBRS_data/Richland_cty/RIC_ADDS.shp"
try:
print "Creating new file geodatabase..."
#Creating a new GeoDatabase where shapefiles will be moved
##CreateFileGDB_management (out_folder_path, out_name, {out_version})
arcpy.CreateFileGDB_management ("F:/GEO443/FinalPrj","Final.gdb")
print "New geodatabase has been created in your FinalPrj folder"
#Move shapefiles to geodatabase using variables created above
##FeatureClassToGeodatabase_conversion (Input_Features, Output_Geodatabase)
arcpy.FeatureClassToGeodatabase_conversion([brown,clermont,hancock,muskingum,richland],"F:/GEO443/FinalPrj/Final.gdb")
print "Shapefiles have been moved to the geodatabase"
arcpy.env.workspace = "F:/GEO443/FinalPrj/Final.gdb"
print "New workspace: " + arcpy.env.workspace
##MakeFeatureLayer_management(in_features,out_layer,{where_clause},{workspace},{field_info})
##SelectLayerByAttribute_management (in_layer_or_view,{selection_type},{where_clause})
##CopyFeatures_management (in_features,out_feature_class,{config_keyword},{spatial_grid_1},{spatial_grid_2},{spatial_grid_3})
kroger_selection = ('"COMMENT" = \'KROGER\'')
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
print fc
print ""
fc_kroger = fc + "kroger"
fc_lyr = arcpy.MakeFeatureLayer_management (fc,fc_kroger)
arcpy.SelectLayerByAttribute_management(fc_lyr,"NEW_SELECTION",kroger_selection)
arcpy.CopyFeatures_management(fc_lyr,fc + "krogerselection")
print "Features Copied"
input_features = arcpy.CopyFeatures_management(fc_lyr,fc + "krogerselection")
##Buffer_analysis (in_features, out_feature_class, buffer_distance_or_field, {line_side}, {line_end_type}, {dissolve_option}, {dissolve_field})
#set input_features variable for buffer anlaysis
arcpy.Buffer_analysis(input_features, "KrogerBuffer","1 Mile","","","ALL")
print "buffer created"
except:
print arcpy.GetMessages() You have a few problems, first the input for the buffer tool is invalid, it needs to have a layer or fc as an input, you are setting it equal to a geoprocessing operation. If you are trying to buffer each fc selection individually, you need to put the buffer inside you for-loop and make sure its input is either a feature class or feature layer( fc + "krogerselection" perhaps?). Also, unless you get each output buffer a unique name, they will be overwritten each time through the loop since they will all have the same name. If you want to do a single buffer of all fc selected krogers, you will need to have them all in one feature layer or feature class and you could do the buffer outside the loop. You have made some good headway on this, keep up the good work.
... View more
05-08-2015
10:31 AM
|
1
|
22
|
4675
|
|
POST
|
The first one is the extent and units of the Las Dataset (.lasd) you imported the las files into. The second is the extent and units of the particular las file. Is the lasd in the same spatial reference as the las file?
... View more
05-08-2015
09:04 AM
|
1
|
1
|
3559
|
|
POST
|
I'm not sure you downloaded elevation data. From your screenshot you grabbed 2014 NAIP 1M NC, which is USDA RGB NAIP Imagery, not elevation data. The boundaries you downloaded are county boundaries it looks like. I could only find downloads for elevation data "ASCII DEM" (Digital Elevation Models) on a quadrangle basis. Once you get all your rasters together, you can Mosaic them all together ArcGIS Help 10.1 or create a Mosaic Dataset ArcGIS Help 10.1 to combine all your rasters and generate contours from them.
... View more
05-08-2015
07:03 AM
|
1
|
0
|
2307
|
|
POST
|
when you are doing the query, you need to have x,y and time variables checked and included in the resulting url for the tool to work. http://opendap.renci.org:1935/thredds/dodsC/tc/isaac/39/ocpr_v19a_DesAllemands4CERA/garnet.erdc.hpc.mil/nodcorps/besttra… Thats the query I put in and it got past the key error, but since I hadn't made an output location it crashed on the time. I had to check the windx, x,y, time variables on the OPeNDAP Query Form. Unfortunately, I'm on my home computer now, so I can't try running again, but I did get past the error you hit.
... View more
05-07-2015
07:01 PM
|
0
|
0
|
2345
|
|
POST
|
Thats it!! OPeNDAP Dataset Query Form Make sure you time, x, and y parameters for your data as well when you do the query. They are required for the script tool. I got the code past your crash point.
... View more
05-07-2015
05:03 PM
|
0
|
2
|
2345
|
|
POST
|
run it again, and scroll up and get the complete error message. Usually it will say what line of the code it is failing on.
... View more
05-07-2015
04:50 PM
|
0
|
0
|
4927
|
|
POST
|
It doesn't have anything to do with the spatial reference. A key error occurs when a dictionary key is used to pull a value from a dictionary, and no value returns. Digging a bit more into the code lines 243-263 def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
url = parameters[0]
variable = parameters[1]
if url.value is not None and self.url != url.value:
self.url = url.value
try:
self.dataset = netCDF4.Dataset(self.url, filter_out_nd_coordinates=True)
except:
arcpy.AddError("Unable to open NetCDF source: {}".format(self.url))
return
var_names = list(self.dataset.variables.keys())
parameters[1].filter.list = var_names
# add back the new url to to filter list
parameters[0].filter.list = [self.url] + self.default_urls
if variable.value not in var_names:
parameters[1].value = var_names[0]
return
Apparently, I was putting in an invalid URL, so it wasn't updating parameters. Yours was so it didn't x out and added the windx variable to the dropdown. Lines 295-297 nc = netCDF4.Dataset(url)
x = nc.variables['lon'][:]
y = nc.variables['lat'][:] This I believe is where we are crashing. I think in the url it is looking for some sort of lat/long parameters. Does your error happen to give a line number or any other information so we can make sure what the issue is? My lack of familiarity with this data is killing me.....
... View more
05-07-2015
04:49 PM
|
0
|
3
|
3858
|
|
POST
|
can you put in a screenshot of your input parameters you are using for the tool?
... View more
05-07-2015
04:22 PM
|
0
|
3
|
4927
|
|
POST
|
To be honest, I barely tested the tool myself, was in a bit of a hurry after an exam and didn't want to get yelled out for getting home late. I found something that about matched your description and went with it. I'm assuming that you have it working now and can get what you need for your thesis?
... View more
05-07-2015
04:14 PM
|
0
|
5
|
3858
|
|
POST
|
I had a script like that once, it would process a random number features, then python would just quit, no error codes or anything, the script would just die. I ended up doing the processing on a stronger computer and it managed to process the whole dataset. Doesn't sound like that should be an issue for you though from the specs of the computer you are using so not sure, but I've had something similar happen. Also, do you really need to export at 300 DPI(default DPI value)? It would process significantly faster and be more likely not to hang if you were exporting at a lower DPI.
... View more
05-07-2015
03:49 PM
|
1
|
0
|
4190
|
|
BLOG
|
Can we perhaps a student division? I've found GeoNet a pretty rewarding community to participate in, but since I am *ahem* "less experienced" that your average person who participates on a regular basis. I try to participate in as many areas as I can, but as I've found out, experience does a whole lot more for your knowledge base then I feel education has so far. This makes it somewhat difficult to gain points at a rate where your 20+ year professionals do. Not that participation is about the prizes, but it could facilitate more students to be interested and engaged.
... View more
05-07-2015
02:38 PM
|
3
|
0
|
2444
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|