Application ID 0557210D-0CD5-4724-FFDB-DB6B680CA200
Expected Behavior
Object in table created and no errors
Actual Behavior
Object is being created in table and saved on the server properly, then server gives an error:
“invalid gis data provided. correct string as wkt or string with geoJSON object is required both type and coordinates should be present in GeoJSON”
class Marker{
private Integer numberOfPeople;
private String creator;
private String type;
private String title;
private Date created;
private String objectId;
private String ownerId;
private Date updated;
private List<BackendlessUser> confirmedBy;
private Point location;
// getters and setters
}
// USAGE
private void createMarker(final LatLng location, final String title, final int peopleNum, boolean isPredefined) {
Point point = new Point();
point.setLatitude(location.latitude);
point.setLongitude(location.longitude);
Marker marker = new Marker();
marker.setTitle(title);
marker.setCreator(ApplicationClass.user.getProperty("username").toString());
if (isPredefined)
marker.setType(Constants.MARKER_TYPE);
else
marker.setType(typeChosen);
marker.setNumberOfPeople(peopleNum);
marker.setLocation(point);
Backendless.Data.of(Marker.class).save(marker,
new AsyncCallback<Marker>() {
@Override
public void handleResponse(final Marker responseMarker) {
arrl_markers.add(responseMarker);
LatLng position = new LatLng(responseMarker.getLocation().getLatitude(),
responseMarker.getLocation().getLongitude());
ClusterItem item = new ClusterItem(responseMarker.getTitle(), position,
responseMarker.getType(), Constants.ClusterType.MARKER);
clusterManager.addItem(item);
clusterManager.cluster();
ToastClass toast = new ToastClass(getApplicationContext());
toast.Show(getResources().getString(R.string.addedMarker),
ToastClass.TypeOfMessage.CONFIRMATION, ToastClass.Length.SHORT);
}
@Override
public void handleFault(BackendlessFault fault) {
ToastClass toast = new ToastClass(getApplicationContext());
toast.Show(getString(R.string.markerError),
ToastClass.TypeOfMessage.ERROR, ToastClass.Length.SHORT);
}
});
}
So I’m doing like this page suggest and I’m not sure what am I doing wrong?
After going through all the code I think I have finally found the error, I was using Backendless.UserService.update() instead of Backendless.Data.of(BackendlessUser.class).save() to update values in user table after creating markers and this caused errors. Thank you for your feedback and I’m sorry for trouble.
To get location.latitude and location.longitude Im using GoogleMap.OnMapLongClickListener
Using LatLng gives huge accuracy, about 16 digits after decimal point, can it be a problem? Because when creating point with Backendless console it only creates 8 digits after decimal point
please provide the code that you are using to call backendless API. I suppose it should be the method createMarker. Please also show the error that you get
i had this error : “invalid gis data provided. correct string as wkt or string with geoJSON object is required both type and coordinates should be present in GeoJSON” but everything works now. Thank you
Yes I am using the spatial data type. Infact the column I have is spacial and here is the code that adds to the map
map.put(“locationGeo”, new Point().setLatitude(lat).setLongitude(lng));
I am getting the error on save
BackendlessException{ code: '1312', message: 'Invalid GIS data provided. Correct string with WKT or string with GeoJSON or just GeoJSON object is required.', extendedData: '{}', detail: 'Invalid GIS data provided. Correct string with WKT or string with GeoJSON or just GeoJSON object is required.' }
at com.backendless.Invoker$SyncResponder.errorHandler(Invoker.java:122)
at com.backendless.persistence.MapDrivenDataStore$MapDrivenResponder.responseHandler(MapDrivenDataStore.java:902)
at weborb.client.ioEngine.HttpIOEngine.processAMFResponse(HttpIOEngine.java:289)
at weborb.client.ioEngine.HttpIOEngine.send(HttpIOEngine.java:210)
at weborb.client.ioEngine.HttpIOEngine.invoke(HttpIOEngine.java:140)
at weborb.client.WeborbClient.invoke(WeborbClient.java:138)
at com.backendless.Invoker.invokeSync(Invoker.java:95)
at com.backendless.persistence.MapDrivenDataStore.save(MapDrivenDataStore.java:101)
at com.backendless.persistence.MapDrivenDataStore.save(MapDrivenDataStore.java:50)
at .....
I was able to reproduce your problem. I have created internal ticket BKNDLSS-24444 for it. We will fix it as soon as possible. We will notify you when fix will be available.
Sorry for inconvenience.
Thank you. Do you have an ETA for it or a work around? Essentially no user can save a location . I am okay with work around untill the fix is there unless the fix is coming soon. This is a broken existing functionality so you know
You can try to bypass this error by using spatial string representations instead of objects. Point can be defined in next way - “POINT({longitude} {latitude})”. In this way it should work.
About error. We have made fix for it yesterday. I think that it will be included to the release which we expecting to have till the end of next week