2

I have a lot of feature classes (results of service area with different polygons (0 to 10/ 10 to 20/ 20 to 40 and 40 to 60) (figure 1)

Service_area_polygons

Also i have a shapefile with a lot of parcels (figure 2)

parcels_and_polygons

Now i want to select the parcels that are located in the polygons (figure 1) thereafter i want to add a field in the shapefile 'parcels' with a number 4 if the parcel lies in the polygon of 0 to 10, a number 3 if the parcel lies in the polygon 10 to 20, number 2 for polygon 20 to 40 and number 1 for polygon 40 to 60.

For my next result of service area (figure 1), so from another timestep or location, i also want to select the parcels that are located in this polygons, add a field with number 4 if.., number 3 if... So i received a table like figure 3 result table

3

This can be achieved with use of a Spatial Join (right click in table of contents -> join -> join data based on spatial location). The spatial join will allow you to transfer attributes from one feature class to another based on location. However, I have always run into issues with boundaries when I perform a spatial join between polygons. To make sure your results make the most sense in terms of where your features fall, I suggest first turning off all your fields in your parcel feature class (right click in table of conents -> Properties -> Fields), and then performing a Feature to Point Conversion on your parcel feature class. Make sure you select INSIDE as your point location.

Once your parcels are points, the spatial join will be more reliable. Turn off all fields in your service area feature class except the field you wish to base your classification on. Perform a Spatial Join on your parcel points, using your service area as its join feature.

The result of your spatial join should be a point feature class that contains the field from the service area feature class. You want to changes these designations based on its values, so open the attribute table to access the Field Calculator. Right click on the designation field header and select Field Calculator.

In your Field Calculator dialog box, choose Python as your parser, and click Show Codeblock. In your code block, try something like this:

def UpdateField (fldValue):
    if fldValue >= 0 and fldValue < 10:
        return 1
    elif fldValue >= 10 and fldValue < 20:
        return 2
    elif fldValue >= 20 and fldValue < 30:
        return 3

In the code above if/elif fldValue >= * and fldValue < * is setting your range of inputs, and return 1 indicates the value you wish to convert that range to (in this case, 1).

Then input UpdateField (!serviceAreaFld!) into your field calculator, where serviceAreaFld is the name of the field that contains the values you wish to base your designation off of.

Now your attribute values should be as you desire. Perform one more Spatial Join, this time on your parcels, using the points as your join feature. This will transfer the value from your points to your parcel feature class.

0

you can use the spatial join to get the attribute of your service area overlapping the parcels. Then you can change the values using the field calculator.

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.