Monday, 5 December 2016

arcgis desktop - VBScript - If/Then Statement - Field Calculator


I am trying to do a simple (or so I thought) if/then statement in the ArcGIS field calculator.


I am trying to add the HydroCode field - hydologic soil codes - to an existing data set. I know what the code should be based on the "MUSYM" number. For example, "MUSYM" 1667 has the hydrologic soil code A. The "MUSYM" field is a number and the "HydroCode" field is text.


I vaguely remember doing if/then statements years ago when I more actively used GIS. I have tried simple If "MUSYM" = 1667 Then "HydroCode" = A Endif along with some other variations but none are working.


What am I missing?? All of the help I have found online deals with very complex coding, I can't find anything for such a simple statement. I also can't find anything with just basic operational instructions as far as where the operators should go/punctuation/etc.


enter image description here



Answer



Please let me know if I am misunderstanding your work. It looks like you want to add HydroCodes to NRCS SSURGO data. What is the source of the HydroCodes? Are HydroCodes something in the SSURGO database, like the Hydrologic Soil Group?


Most of us don't work with NRCS data in the US, so here is a description. NRCS SSURGO data consists of a shapefile of Map Unit polygons, and an MS Access database with about 60 soil-related attributes for each map unit. Many of the attributes exist in a one-to-many relationship with the Map Units, so the data is typically aggregated for mapping. For example, each map unit could have several soil types, but the map will only show the dominant soil type. The data is aggregated using built-in queries in the database.


If you are using attributes that are in the SSURGO database, then you will not need to use Field Calculator to add them. Instead, use this awesome tool for extracting soil data by automatically joining aggregated attributes in the database with the Map Unit polygon shapefile in ArcGIS. I have ArcGIS 10.2, and it work for me. NRCS Soil Data Viewer



http://www.nrcs.usda.gov/wps/portal/nrcs/detail/soils/survey/geo/?cid=nrcs142p2_053620


If you want to see how the NRCS SSURGO data works without ArcGIS, try the web viewer at


http://websoilsurvey.nrcs.usda.gov/app/


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...