Find points with the same attribute in multiple locations

1156
16
03-25-2022 09:26 AM
Labels (2)
MattCotterill
Occasional Contributor

Hi all,

Our City has a two hour time limit for parking in residential areas for non-permitted vehicles. We trying to quantify how often non-permitted vehicles move from one block to another to avoid being ticketed. We are using data from our Parking Enforcement's license plate readers to determine this. It contains the license plate, lat/long data, geocoded address info, time stamp, and whether or not the vehicle is permitted. I have selected the points that fall in the enforced areas and created a definition query to show only non-permitted vehicles. When a license plate is read at the same location, the lat/long information is slightly different, but the address attribute tends to be the same. What is the most efficient way to find occurrences of the same license plate appearing at multiple addresses?

Thanks!
Matt

0 Kudos
16 Replies
JayantaPoddar
MVP Esteemed Contributor

One way to look at it.

If the points have attributes of Vehicle No. (License Plate) and the address (say Block No.), you could dissolve the layer based on these two fields.

The resulting rows should be unique to the combination of License Plate and Block No.

*In case the address field isn't available, you could use spatial join to join the corresponding field from Block boundary to points layer.



Think Location
0 Kudos
KimGarbade
Occasional Contributor III

New approach... You can uses Arcade.

I added a text field (MultipleAddressMessage) to my table and populated it like this using Calculate field using an Arcade expression:

KimGarbade_0-1648245955470.png

Using this Arcade code: 

var License = $feature.LongPlate
//get all records having the plate in this record
var test = Filter(FeatureSetByName($datastore,"TestPoints",['LongPlate','Address'],true),"LongPlate = @License")
//Use GroupBy to get the stats you want - return type is another feature set.
//returns a feature set having an Address column and a NumberOfAddresses column
var result = GroupBy(test,'Address',{name: 'NumberOfAddresses',expression: '1', statistic: 'COUNT'})
//Check for null Feature Set
If(IsEmpty(first(result))){
  //if null return 'not parked'
  return 'not parked' //should never happen but have to test for null
} else { 
  for(var instance in result){
    //Step through GroupBy returned feature set and derive the values you want
    var TotalInstances = TotalInstances + instance.NumberOfAddresses
    var NumUniqueAddresses = NumUniqueAddresses + 1
  }
  return "Plate number: " + first(test).LongPlate + " appeared at " + text(NumUniqueAddresses) + " unique address a total of " + text(TotalInstances) + " times."
}
MattCotterill
Occasional Contributor

Thanks, that looks promising, but my arcade skills are below average. For my data, I'm substituting your "LongPlate" with my "Plate_value" and your "TestPoints" with my "LPR_Data519_520_NoPermit". I'm getting an error on line 6, my code is pasted below

MattCotterill_0-1648488862928.png

var License = $feature.Plate_value
//get all records having the plate in this record
var test = Filter(FeatureSetByName($datastore,"LPR_Data519_520_NoPermit",['Plate_value','Address'],true),"Plate_value = @License")
//Use GroupBy to get the stats you want - return type is another feature set.
//returns a feature set having an Address column and a NumberOfAddresses column
var result = GroupBy(test,'Address',{name: 'NumberOfAddresses',expression: '1', statistic: 'COUNT'})
//Check for null Feature Set
If(IsEmpty(first(result))){
  //if null return 'not parked'
  return 'not parked' //should never happen but have to test for null
} else { 
  for(var instance in result){
    //Step through GroupBy returned feature set and derive the values you want
    var TotalInstances = TotalInstances + instance.NumberOfAddresses
    var NumUniqueAddresses = NumUniqueAddresses + 1
  }
  return "Plate number: " + first(test).Plate_Value + " appeared at " + text(NumUniqueAddresses) + " unique address a total of " + text(TotalInstances) + " times."
}

 

0 Kudos
KimGarbade
Occasional Contributor III

I don't see an error in the code....I guess you could try substituting 'Address' for '1' after the expression: keyword in line 6... but that seems like a long shot.

Is your data coming from portal or AGOL, or straight from a geodatabase?  What version of ArcGIS Pro are you using?  Are you sure your license plate number is a text field?  

If the data is coming straight from a database and your pro version is 2.5 or newer and your GUID looking ID is indeed in text format, then I'm think there might be something "off" in you data. 

What that something is I don't know, but I don't believe in coincidences (much) and it seems like a coincidence that no matter the potential solution, it gets to a certain point and fails... each time with a new message.

You could try exporting out a very small subset of your data (like ten records) and testing the process against that.  If it works or it doesn't its a clue.  If it works, its a clue that one or more records in your input data have something in them that is disrupting ArcGIS.  If it doesn't try substituting some "simpler" plate numbers (something like "ABD123") in the your test data and trying again... or simpler address ("1234 ABC ST W")... if that fails I'm at a complete loss.

Sorry for sending you down rabbit holes, but that's all I can think of.

MattCotterill
Occasional Contributor

OK, I'm running 2.3.1 so it sounds like that's the most likely problem here. I'll start by badgering our IT department to install the latest update. Once I get updated, I'll take another crack at it.

Thanks for your help!

0 Kudos
KimGarbade
Occasional Contributor III

I think that clears up the Arcade error. I don't think GroupBy works in versions per 2.5. 

Before you upgrade though, if your using ArcGIS enterprise, make sure your upgraded version will work with you enterprise version and database versions. I.E. updating has to be planned.

MattCotterill
Occasional Contributor

OK, that makes sense. I don't know what version of enterprise we're running but it may help explain why IT hasn't been able to upgrade me to the latest version of Pro.

Thanks!

0 Kudos