Geocoding an address... how to save the latitude and longitude points?

Options

I'm using Geocode.io for an external API to take a user's input (address) and convert it into geocoded latitude and longitude points, but I am having trouble saving the coordinates in the database as a geo_point.

Can anyone help me understand how I can accomplish this?

I have successfully converted the address into latitude and longitude points, but when I go to edit the record, the database returns an error.

code: ERROR_CODE_INPUT_ERROR,

message: Missing param: field_value,

param: field_value

Tagged:

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Most likely the field value isn't getting filled into your edit record. You need to set the field name (probably "ID") and then the field value (the ID of the record you want to change, e.g users_1.id) and then you can choose which change you want to make to the table, such as your geopoint.

  • justin_88
    justin_88 Member
    Options

    After looking back at it and changing some of the parameters, it's passing the correct user through. The problem is that, when I go to save the latitude and longitude that I receive back from my API request, it's not saving it as a geo point. It just tells me an "unknown error has occured."

    I don't know what I'm doing wrong.

    When setting the geo point field with the new returned value, it's not saving the latitude and longitude correctly.

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    edited August 2023
    Options

    You might get more help by sharing screenshots of your setup and the error - the problem with paragraph text is that its imprecise, and fixing this is going to be a matter of precision.

    Xano has free office hours on Tuesdays for these "easier to show than tell" problems, and State Change (my group) has daily office hours for the hard end of no-code problems. Our next one is today at 1pm EDT / 1700 GMT.

  • Mike Akister
    Options

    Hey @justin_88 we use the geo fields extensively in our Xano backend. I have created a function that takes lat and long values and creates a geopoint so that I can then pass the result to any variables in endpoints or other functions. One thing that I have found that can sometime mess this up is if the precision of the lat/long is greater than say 10 decimal points. Really up to 6 decimal points is accuarate within cm's. Happy to help if you can't make it work based on the screenshots.