Unable to save point in table

I have a table with a latitude and longitude. I added a column of type point
I am creating a point from those two properties and trying to save into the location column

this is what I did.

here is the error I am getting

k.js:14 Uncaught (in promise) Error: Invalid GIS data provided. Correct string with WKT or string with GeoJSON or just GeoJSON object is required. class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader ‘bootstrap’)

does “create geo point” not create a point that can be stored in a field of type point? how can I correct this?

Hi @hharrington,

Check that you are sending the correct data to the server. The data must be the same as shown in the documentation: Spatial Data Types - Backendless REST API Documentation

So, as example the POINT data type values should look like these:
{"columnName": "POINT (x y)"}

What does your data look like that you send to the server?

Regards,
Marina

Thanks for the response

the geo point looks like this : ‘POINT(-82.8519 37.9006)’

which I create from the create geo point block

variable j ( used in the for loop ) is created by using load table objects bock with just the table name
so it should be every row in the table
there is a column in the table called “location”
so I set the property of location of object j to create geo point block (see above image )

then I call the save object in backendless block using the table name and object j from the for loop.

Hello @hharrington,

The values for Latitude and Longitude must be passed to the server as numbers, not strings. Therefore, you need to make sure that you are passing these values correctly.
If your Latitude and Longitude values are passed as strings, you can use the following block to convert the string to a number:

Regards
Nazar

I had no idea the create geo point block did not do the conversion!
Just made that change and it works as expected!
Thanks !!

HH

1 Like