Code Monkey home page Code Monkey logo

Comments (10)

jbelien avatar jbelien commented on July 22, 2024

Hello @mrelliot69,

This library is only focusing on geocoding and reverse geocoding.
Any logic that happens after should be handled by your own application, not by this library.

If you want to store the result, I suggest you check our Address model, you can base your database table structure on it.

from geocoder.

mrelliot69 avatar mrelliot69 commented on July 22, 2024

Heyy thanks for the fast reply.
My problem right now is that I have the autocomplete on my website, but then when the form is submitted, I need to get the result from the form.
Right now I was encoding the latitude and the longitude on a string so the value summited by the form had the latitude and longitude on the value but when I do the reverse query I never get accurate results meaning that the address that I select on the autocomplete doesn't match with the one on the reverse query.

One thing that would solve this was if we get the place_id on the base array of the providers and the location object, but im open to other approaches .

Thanks for the help @jbelien

from geocoder.

jbelien avatar jbelien commented on July 22, 2024

Indeed, a same location (longitude, latitude) can have several address, so you can't not be assured you will get the same address as the address that gave you the location.
There is no workaround for this, this is how (reverse) geocoding works.

Why don't you store the address AND the location in your form (instead of only the location) ?

Some providers return an address/place identifier but not all of them.
Which provider(s) are you using ?

from geocoder.

mrelliot69 avatar mrelliot69 commented on July 22, 2024

I'm not sending on form submit the address right away because i need more details from that.
I understand that, but having that generally would mean that the ones that don't have the id simply could have that property set to null.
I'm using the Mapbox, Arcgis, Nomination.

from geocoder.

jbelien avatar jbelien commented on July 22, 2024

I get what you're asking for but this is out of the scope of the Geocoder library because we only provide a layer on top of external APIs ; we don't have any control on what the external APIs are returning as response.

from geocoder.

mrelliot69 avatar mrelliot69 commented on July 22, 2024

I dont understand why you say that its out of scope if its a property that the providers have, that is only missing on the location object.

Could you please elaborate on that @jbelien . Sorry for all the questions

from geocoder.

mtmail avatar mtmail commented on July 22, 2024

The geocoding library helps you retrieve data from an external API data provider. How you store it and what you do with the data after is up to you.

from geocoder.

mrelliot69 avatar mrelliot69 commented on July 22, 2024

@mtmail thats exacly my point, right now the library dosent provide the place_id on the location map, but that id comes on the query, thats why i'm asking why that can't be added since comes in the response from the provider

from geocoder.

mtmail avatar mtmail commented on July 22, 2024

At least for Nominatim the place_id is different between servers and not good as permanent id. Not sure about Mapbox. https://nominatim.org/release-docs/latest/api/Output/#place_id-is-not-a-persistent-id

from geocoder.

jbelien avatar jbelien commented on July 22, 2024

@mtmail thats exacly my point, right now the library dosent provide the place_id on the location map, but that id comes on the query, thats why i'm asking why that can't be added since comes in the response from the provider

Sorry, I didn't understand that was your request (the title of this ticket is about storing address in database).
As said before some providers return an identifier (and we catch it), some providers return an identifier (and we don't catch it ; but it should be easy to add), and some providers don't return any identifier.

In the providers you listed, we do catch the identifier for Mapbox and Nominatim (but as said by @mtmail, you must indeed check Nominatim documentation because OpenStreetMap identifiers are not persistent).
For ArcGISOnline, we don't catch the identifier but I don't know if there is one returned by the API.

from geocoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.