TransWikia.com

Using Select Layer By Attribute in Python Script Tool

Geographic Information Systems Asked by Sminesihe on July 25, 2021

I just want to try to use a Python script to select specific roads in my Layer called “Route_01_Shatin” and so I coded as below:

arcpy.management.SelectLayerByAttribute('Route_01_Shatin', 'NEW_SELECTION', ""ALIAS_ENAM" = 'Roadabout'")

but then when I ran it, I did not receive any error messages but none of the roads are selected.

What is my problem?

One Answer

If your field named ALIAS_ENAM of your layer named Route_01_Shatin has any values of 'Roadabout', then I think this should work:

arcpy.management.SelectLayerByAttribute('Route_01_Shatin', 'NEW_SELECTION', "ALIAS_ENAM = 'Roadabout'")

Answered by PolyGeo on July 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP