Page 1 of 3
Problem posting GeoPoint to parse.com
Posted: Sun Mar 18, 2012 1:03 pm
by michartmann
Can't post a GeoPoint to Parse.com object - if I use the REST Test function I can't insert a "location" using the "second level" but if I post a single level location field with the value "{"__type":"GeoPoint", "latitude":40.0, "longitude":-30.0}" it works - Please help.
Problem posting GeoPoint to parse.com
Posted: Sun Mar 18, 2012 5:20 pm
by maxkatz
Can you explain what you mean by "second level"? Do you mean entering JSON-like string?
Problem posting GeoPoint to parse.com
Posted: Sun Mar 18, 2012 7:48 pm
by michartmann
Problem posting GeoPoint to parse.com
Posted: Sun Mar 18, 2012 7:50 pm
by michartmann
Working with "one" level works when testing the service but not when the second level is used - how is the second level converted into json? maybe it's not what parse.com is expecting?
Hope it makes it easier to understand what I'm having trouble with.
Problem posting GeoPoint to parse.com
Posted: Sun Mar 18, 2012 9:20 pm
by maxkatz
Try this:
code
var point = {};
point['location']= { "__type":"GeoPoint", "latitude":40.0, "longitude":-30.0 };
return point;
/code
Problem posting GeoPoint to parse.com
Posted: Mon Mar 19, 2012 9:16 pm
by michartmann
Hi Max,
Thanks for your reply.
However I am not sure where to place your javascript?
Problem posting GeoPoint to parse.com
Posted: Mon Mar 19, 2012 9:42 pm
by maxkatz
Sorry, when testing the service, you can use this (location is parameter name):
location {"__type":"GeoPoint", "latitude":40.0, "longitude":-30.0}
when using the service on a page, return for mapping:
code
return {"__type":"GeoPoint", "latitude":40.0, "longitude":-30.0};
/code
Problem posting GeoPoint to parse.com
Posted: Fri Dec 14, 2012 1:35 am
by David Fung
Instead of using the fix value, two variables are replaced in the above example. What is the format in javascript?
I tried the following codes without the success.
var map = Tiggr('googlemap1');
var theLat=map.gmap.getCenter().lat();
var theLng=map.gmap.getCenter().lng();
return {"__type":"GeoPoint", "latitude": theLat, "longitude": theLng};
Problem posting GeoPoint to parse.com
Posted: Fri Dec 14, 2012 4:42 am
by maxkatz
As this is JavaScript, the variables would need to be concatenated with +.
Problem posting GeoPoint to parse.com
Posted: Fri Dec 14, 2012 10:07 am
by David Fung
I tried this
return' {"__type":"GeoPoint", "latitude": "'+theLat+'", "longitude": "'+theLng+'"}';
But no success