geocoder icon indicating copy to clipboard operation
geocoder copied to clipboard

Documentation and/or consistency issue

Open tonekk opened this issue 1 year ago • 1 comments

Hi @alexreisner,

first off: thank you, amazing work 💯

I'm a little confused by the following:

  1. Using Geocoder.search leads to @data containing "lat" and "lon".
  2. The documentation suggests stubbing "coordinates".
  3. When using Model.geocode, it is expected that the coordinates are present within @data in "latitude" and "longitude"

My questions:

  • Is there a reason for this deviation?
  • Is stubbing coordinates maybe deprecated?
  • What are the arguments against either using the short form (lat) or the long form (latitude) consistently?

Cheers,

Finn

tonekk avatar Apr 19 '25 15:04 tonekk

Thanks for the good question! To look at each of the cases you mention:

  1. @data reflects what's returned by the geocoding API, and each API returns data with potentially a different format. Some use lat, some use latitude, and I believe at least one returns a 2-element array. Part of the point of Geocoder is to hide these differences, so I think we should ignore the formatting in your Nominatim result when talking about this issue.
  2. Stubbing coordinates is recommended. We could have chosen lat/lon instead, but there was a reason for not doing it. Unfortunately I no longer recall what it was, and now we have this convention.
  3. Yes, because that's where they often are. But again, this has more to do with the API responses than with where the data should be stored.

Does that all make sense? Does it clarify anything?

alexreisner avatar Apr 24 '25 23:04 alexreisner