I am having a bit of difficulty using the ReverseGeoCode. I am looking for the nearest address to a location. Specifically:
-117.995855
33.802873
In my application and the GeoCode USA 2.0 sample file, a ReverseGeoCode returns an error of:
"Index was outside the bounds of the array."
The more detailed info from my application yields
"System.IndexOutOfRangeException: Index was outside the bounds of the array.
at MapSuite.GeoCodeUSA.x02b56011810c316c.xcd2962740f926d7d(xfbfae26f54c8fc2d x06d16492686dcc07, Double x58316dde3396e982)
at MapSuite.GeoCodeUSA.x02b56011810c316c.x659643111e13b43b(Double xad26a7203634de8e, Double x3f230538ea01aa0e, Double xd2f68ee6f47e9dfb, xfbfae26f54c8fc2d x06d16492686dcc07)
at MapSuite.GeoCodeUSA.x02b56011810c316c.x52a275594b9885ea(Double xad26a7203634de8e, Double x3f230538ea01aa0e, Double xd2f68ee6f47e9dfb, Double xad987153278da131, Double x123c3e3ed6e25861, xfbfae26f54c8fc2d& x06d16492686dcc07)
at MapSuite.GeoCodeUSA.x02b56011810c316c.xd9ae9411a7f4d913(Double xad26a7203634de8e, Double x3f230538ea01aa0e, Double x95fcc33c84c043c8, Double xad7c72f15925da2a, xfbfae26f54c8fc2d& x06d16492686dcc07)
at MapSuite.GeoCodeUSA.x02b56011810c316c.ReverseGeoCode(Double TargetLat, Double TargetLong)
at MapSuite.GeoCodeUSA.GeoCodeEngine.ReverseGeoCode(Double Longitude, Double Latitude, MapUnits DistanceUnit)
at Raptor.GPSInfo.get_NearestAddress() in C:\Projects\Raptor\RaptorClasses\GPSReader.cs:line 117"
Obviously "C:\Projects\Raptor\RaptorClasses\GPSReader.cs" is my file, the rest is clearly an obfuscated GeoCode stack trace.
Basically, GeoCode found no result to return, probably tried to return [0] or something and errored out. Changing the coordinates to something like the following works:
-117.995
33.80
That is clearly not the nearest address to my original coordinates. I have also found that I can brute force a nearest address by incrementing/decrementing the coordinates until I achieve a result. Since this relies on continual exceptions, it is dog-slow.
All of my GPS coordinates will be in the street and never in the exact location of a street address. How can I find the nearest address(es)? |