# Attribute Rules

## Unique ID Sequence

* Every Parking GIS layer / table has a unique ID field that will be automatically populated by a Database Sequence&#x20;
* Block Segments - BLOCK\_SEGMENT\_ID
* Parking Paystations - PARKING\_PAY\_ID
* Parking Spaces - PARKING\_SPACE\_ID
* Parking Restrictions - PARKING\_RESTRICTION\_ID
* Parking Zones - PARKING\_ZONE\_ID

```
Text(NextSequenceValue("ATD_ADMIN.atd_parking_data_sequence")
```

## Parking District

* Only the Parking Spaces layer has the PARKING\_DISTRICT field, which is automatically calculated based on an intersect with the Parking Districts polygon layer.
* The PARKING\_DISTRICT field is not manually editable by the user.

```
var ParkDistInt = Intersects(FeatureSetByName($datastore, "ATD_ADMIN.parking_districts", ["OBJECTID"]), $feature);
var ParkDist = First(ParkDistInt);

if (ParkDist == null) {
return "N"
}
else
return "Y";
```

## Parking District Name

* Only the Parking Spaces layer has the PARKING\_DISTRICT\_NAME field, which is automatically calculated based on an intersect with the Parking Districts polygon layer.
* The PARKING\_DISTRICT\_NAME field is not manually editable by the user.

```
var ParkDistInt = Intersects(FeatureSetByName($datastore, "ATD_ADMIN.parking_districts", ["PARKING_DISTRICT_NAME"]), $feature);
for (var fc in ParkDistInt) {
  return fc.PARKING_DISTRICT_NAME
}
if (Count(ParkDistInt) == 0) {
return $feature.PARKING_DISTRICT_NAME
}
```

## Parking District ID

* Only the Parking Spaces layer has the PARKING\_DISTRICT\_ID field, which is automatically calculated based on an intersect with the Parking Districts polygon layer.
* The PARKING\_DISTRICT\_ID field is not manually editable by the user.

```
var ParkDistInt = Intersects(FeatureSetByName($datastore, "ATD_ADMIN.parking_districts", ["PARKING_DISTRICT_ID"]), $feature);
for (var fc in ParkDistInt) {
  return fc.PARKING_DISTRICT_ID
}
if (Count(ParkDistInt) == 0) {
return $feature.PARKING_DISTRICT_ID
}
```

## RPP District

* Only the Parking Zones layer has the RPP\_DISTRICT field, which is automatically calculated based on an intersect with the RPP Districts polygon layer.
* The RPP\_DISTRICT field is not manually editable by the user.

```
var RppDistInt = Intersects(FeatureSetByName($datastore, "ATD_ADMIN.rpp_districts", ["RPP_DISTRICT"]), $feature);
for (var fc in RppDistInt) {
  return fc.RPP_DISTRICT
}
if (Count(RppDistInt) == 0) {
return $feature.RPP_DISTRICT
}
```

## RPP District ID

* Only the Parking Zones layer has the RPP\_DISTRICT\_ID field, which is automatically calculated based on an intersect with the RPP Districts polygon layer.
* The RPP\_DISTRICT\_ID field is not manually editable by the user.

```
var RppDistInt = Intersects(FeatureSetByName($datastore, "ATD_ADMIN.rpp_districts", ["RPP_DISTRICT_ID"]), $feature);
for (var fc in RppDistInt) {
  return fc.RPP_DISTRICT_ID
}
if (Count(RppDistInt) == 0) {
return $feature.RPP_DISTRICT_ID
}
```

## Time Limit

* Only the Parking Restrictions table has the TIME\_LIMIT field, which is automatically calculated based on the PARKING\_TYPE field in the same table.
* The TIME\_LIMIT field is not manually editable for the following Parking Types. If the user changes the Time Limit for any of the below Parking Types, it will default back based on the Attribute Rule
* Bicycle Parking Zone
* Bus Stop
* Car2Go Parking
* Commercial Service Zone
* Customer Service Zone
* Marked ADA Zone
* Passenger Loading Zone

```
if ($feature.PARKING_TYPE == 'Commercial Service Zone') {
return '30 min'
}
else if ($feature.PARKING_TYPE == 'Customer Service Zone') {
return '15 min'
}
else if ($feature.PARKING_TYPE == 'Passenger Loading Zone') {
return '5 min'
}
else if ($feature.PARKING_TYPE == 'Bicycle Parking Zone') {
return 'All Day'
}
else if ($feature.PARKING_TYPE == 'Bus Stop') {
return 'All Day'
}
else if ($feature.PARKING_TYPE == 'Marked ADA Zone') {
return 'All Day'
}
else if ($feature.PARKING_TYPE == 'Car2Go Parking') {
return 'All Day'
}
else {
return $feature.TIME_LIMIT
}
```

## Day of the Week Hours

* Only the Parking Restrictions table has the days of the week fields, which are automatically calculated based on the HOURS\_OF\_OPERATION field in the same table.
* These fields are not manually editable for the following Hours of Operations. If the user changes the Hours for any of the below Hours of Operation, it will default back based on the Attribute Rule
  * Mon-Fri: 3PM-9AM
  * Mon-Fri: 8AM-5PM
  * Mon-Fri: 8AM-6PM
  * Mon-Fri: 9AM-4PM
  * Mon-Sat: 7AM-7PM
  * Mon-Sat: 8AM-6PM
  * Mon-Sat: 8AM-Midnight
  * Mon-Sun: 12PM-8PM
  * Mon-Sun: 6PM-6AM
  * Mon-Sun: 7AM-7PM
  * Mon-Sun: 8AM-10PM
  * Mon-Sun: All Day
  * Mon-Tue: 8AM-6PM, Wed-Fri: 8AM-Midnight, Sat: 11AM-Midnight
  * Mon-Wed: 10AM-8PM, Thur-Sat: 10AM-Mignight
  * Sat-Sun: 5AM-10PM
  * Wed-Sat: 7PM-Midnight

```
// For return #
// enter the number of hours depending on the day of the week being calculated

//For last return, DAY will be the day that is being calculated

if ($feature.HOURS_OF_OPERATION == 'Mon-Fri: 3PM-9AM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Fri: 8AM-5PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Fri: 8AM-6PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Fri: 9AM-4PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sat: 7AM-7PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sat: 8AM-6PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sat: 8AM-Midnight') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sun: 12PM-8PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sun: 6PM-6AM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sun: 7AM-7PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sun: 8AM-10PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Sun: All Day') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Tue: 8AM-6PM, Wed-Fri: 8AM-Midnight, Sat: 11AM-Midnight') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Mon-Wed: 10AM-8PM, Thur-Sat: 10AM-Midnight') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Sat-Sun: 5AM-10PM') {
return # }
else if ($feature.HOURS_OF_OPERATION == 'Wed-Sat: 7PM-Midnight') {
return # }
else {
return $feature.DAY_HOURS }
```
