Nominatim Zoom Parameter / Geocoding Help

Adam6 years ago

Hello!

So, I got my own Nominatim server up, traccar is running beautifully, but I'm having some small issues with geocoding. The default zoom that's hardcoded into NominatimGeocoder.java (which is 18) is address level, which is great for 85% of the lookups, but there's about 15% of the time where lookups fail and traccar throws an error:
org.glassfish.json.JsonArrayBuilderImpl$JsonArrayImpl cannot be cast to javax.json.JsonObject - ClassCastException (... < NominatimGeocoder:42 < JsonGeocoder:57 < *:108 < ServerResource:54 < ...)

The reason for this error is because Nominatim is returning no address field in the json due to the zoom level being too high and the GPS coordinate being in a field, middle of the road, or a driveway.

However, decreasing the zoom down to 17 brings an address field back, which wouldn't throw the traccar error, and would populate the database correctly.

Future suggestion to auto-decrease the zoom down by 1-2 levels in NominatimGeocoder on failure?

Anton Tananaev6 years ago

What if we just decrease it to 17? Will it work for all cases?

Adam6 years ago

If we decrease it to 17, it will work in all cases, but we will lose resolution. Instead of being at an address, it will just be at a street.

Let me play around with some of my data tomorrow and I'll update.

Adam6 years ago

Well, that was embarassing.

Apparently the Nominatim setup documentation was incomplete, so I missed two steps in importing the USA TIGER (address) database. Now that I've found out and completed those last two steps, every single address that wasn't resolving is resolving now.

The sucky part is now I have a database full of "undefined" addresses when the geocoder failed on initial import.

Is there a way to only run the geocoder on only those 'undefined' addresses?

Anton Tananaev6 years ago

Unfortunately not. You would need to write some script to fill missing addresses.