"Establishing Relations with Geo Points via API" documentation example not working

Backendless Version (3.x / 5.x, Online / Managed / Pro )

5.7.0 Free tier

Client SDK (REST / Android / Objective-C / Swift / JS )

JS

Application ID

073669A8-CCB7-2AED-FFEC-841A4CE5F400

Expected Behavior

  1. When the sample code in the documentation is executed for a 1:1 relation,
    https://backendless.com/docs/js/data_relations_with_geo_points.html
var point = new Backendless.GeoPoint();

    point.latitude = 40.7148;
    point.longitude = -74.0059;
    point.categories = [ "taxi" ];
    point.metadata = { service_area : "NYC" };

    var taxi = { carmake:"Toyota", carmodel:"Prius" };

    // link one geopoint with the data object
    taxi.location = point;

    Backendless.Data.of( "Taxi" ).save( taxi )
    .then( function( savedObject ) {
    console.log( "taxi object has been saved" );
    })
    .catch( function( error ) {
    console.log( "error - " + error.message );
    });
  1. It creates a Geo Point under the location column as outlined in the example.

  2. It creates the Geo Point under taxi under the Geolocation section

Actual Behavior

  1. Displays that the taxi object has been saved successfully

image

  1. Does not actually save the Geo Point, however it saves rest of the object data.

  2. Does not save the Geo Point in the Category

Reproducible Test Case

Sample code is in the documentation itself
https://backendless.com/docs/js/data_relations_with_geo_points.html

For a 1:1 relation,

var point = new Backendless.GeoPoint();

    point.latitude = 40.7148;
    point.longitude = -74.0059;
    point.categories = [ "taxi" ];
    point.metadata = { service_area : "NYC" };

    var taxi = { carmake:"Toyota", carmodel:"Prius" };

    // link one geopoint with the data object
    taxi.location = point;

    Backendless.Data.of( "Taxi" ).save( taxi )
    .then( function( savedObject ) {
    console.log( "taxi object has been saved" );
    })
    .catch( function( error ) {
    console.log( "error - " + error.message );
    });

Thank you

Hi.
I wouldn’t recommend to use GEOPOINT. It is deprecated api, and it may be removed in a future releases.
The replace is a set of new data types: POINT, LINESTRING, POLYGON. In a future releases new additional spatial types could be added.

I found out that your table Establishments has broken column. The problem was already fixed.
So the column Coords now has type POINT and all related data could be saved in the same table. And you can use the same type of relations to other tables.

Here is the doc
https://backendless.com/docs/android/data_spatial_overview.html

1 Like