Problem with value type of lng/lat coordinates

Options
Hello Community,

I need your help (again 🙃).

I use the geo location point in my database.
And in API I get the following output:
{
"map_point": {
"type": "point",
"data": {
"lng": 11.24084525997,
"lat": 49.484516944722
}
}
}
I want to use the values of lng and lat in my function. In my function I expect these values to be of type decimal.
But when I check them with is_decimal I get a false.
And when I try to convert the values with to_decimal I get a 1.

How can I convert lng and lat values to decimal type?

Thanks in advance! 🙏

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Is it possible you are testing "map_point" rather than "map_point.data.lng"?

    I was able to get decimal. I pulled a record from a table that has a geographic point on it (called "location"), and called it "restaurants_1". Then I created a variable, "longitude" and assigned it the value "restaurants_1.location.data.lng". Then I tested is_decimal on longitude - which returned true. 
  • Dmytro Pyatkovka
    Options
    Hi ,
    thank you for the answer.

    I have found the problem. The problem was with the array that I used in my function. 🤯