0

I'm using ArcGIS 10.7 trying to calculate a speed field (for my data of roads in California) really simply such that roads = 45 and highways = 65. I know I need to use an if then statement but I'm not too familiar with Python or ArcGIS so I need a function that will allow me to say if the text string includes "FWY" OR "HWY" OR "RTE" return 65 and else = 45. Does anyone know how I could get this done? I'm fine computing with some error as its for an intro class.

image of data I'm working with of streets in California

4
  • What have you tried so far? I would expect that a question like this has been asked and answered on this site previously.
    – PolyGeo
    Dec 6, 2019 at 2:53
  • You'll learn a lot more if you break open the documentation and review the examples in Calculate Field which cover cases very similar to this. It's quite likely GIS SE won't want to get a reputation for doing homework for those unwilling to at least try to do it themselves.
    – Vince
    Dec 6, 2019 at 3:38
  • Similar questions have been asked multiple times here before. Please try a field calculator config based on any of them, then if you can't get it working, update your question (or ask a new one) showing what you've tried. Eg: Basic If/Then in Python Parser of ArcGIS Field Calculator?, conditional statements in ArcGIS Field Calculator using Python? Dec 6, 2019 at 3:43
  • For your specific case, you may want to try a code block that defines a function that includes an if statement like, if "FWY" in upperName or "HWY" in upperName or "RTE" in upperName: (and before that you'd need to define upperName as the uppercase equivalent of fullname, something like, upperName = fullname.upper(). Dec 6, 2019 at 3:55

0