Find lat/longs that aren't long enough through queries

701
1
Jump to solution
05-21-2012 02:21 PM
AndrewWiseman
New Contributor III
I have a shapefile with latitude and longitudes in it, and I want to find ones that don't have enough decimal places -- they should have at least 6 after the decimal for my purposes but some only have two (i.e. should be -72.123456 but some are -72.12.) How do I query this? LEFT("FIELD_NAME",...) isn't working even when I make a new field that's string, and when I use % or _ as wildcards it finds everything. I tried "FIELD_NAME" like '-72.%%_' and various combinations of % and _ and it selected the entire table.

Or is there some other solution I haven't thought of?

Thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
TrishRice
Occasional Contributor III
Dunno what version you're using but here is a script to count the characters in a field.  If that doesn't work here is a workaround.

Make another field for latitude that only allows two decimals.  Populate it with field calculator Left([Fieldname],...).  Now make another field and subtract the two-digit values from the latitude field.  Any result that comes back 0 will mean the original latitude also only had two decimals (unless the last 4 digits were all zeroes in which case the latitude field won't show them, but the odds of that happening are very small).  Repeat for longitude.

View solution in original post

0 Kudos
1 Reply
TrishRice
Occasional Contributor III
Dunno what version you're using but here is a script to count the characters in a field.  If that doesn't work here is a workaround.

Make another field for latitude that only allows two decimals.  Populate it with field calculator Left([Fieldname],...).  Now make another field and subtract the two-digit values from the latitude field.  Any result that comes back 0 will mean the original latitude also only had two decimals (unless the last 4 digits were all zeroes in which case the latitude field won't show them, but the odds of that happening are very small).  Repeat for longitude.
0 Kudos