3

I have a shapefile which contains landuse types. The Landuse types are written in a field called "Type" and contain also the area in m² and a landuse code. Some polygons contain more than one landuse type separated with a tab

An example or such a field would be

(43001-1200) Brachland 1185 m² (43002-1300) Laub- und Nadelholz 14 m²

What I would like to do is make a list of the landuse types that interest me, and then search the field for these types. If the word is contained within the field, that polygon should be selected.

I then need to remove the code and the area leaving just the Landuse type. IE int he above example the resulting polygon would simply have Brachland, Laub- und Nadelholz in the field.

I have ArcGIS (Editor License) and FME Desktop. Does anyone have an idea which approach would work best?

Thanks for any replies,

Rob

1

Select by Attribute using the LIKE operator.

This is the little script I use for selecting multiple terms in the Python window:

import string

Search_Field = "Field Name Here"
Layer = "Layer Name Here"
Input_Terms = "Term1, Term2, Term3, etc"

split_terms = Input_Terms.split(',')
terms = [s.strip() for s in split_terms]

where = ""
for term in terms:
    where += "UPPER(\"" + Search_Field + "\") LIKE '%" + term.upper() + "%' OR "
where = where[:-4]

arcpy.SelectLayerByAttribute_management(Layer, "NEW_SELECTION", where)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.