pboloz
Posts: 0
Joined: Wed Apr 02, 2014 11:38 pm

What is the easiest way of saving a geolocation service output (lat and long) into a DB as a geopoint?

I had a look at ALL the related posts, but could not understand it as I am a newbie to Javascript. I know how to capture and map this data to be displayed, but how to send it straight to my geopoint field in DB?

Image

Please don't send me to a tutorial. Thank you!

pboloz
Posts: 0
Joined: Wed Apr 02, 2014 11:38 pm

What is the easiest way of saving a geolocation service output (lat and long) into a DB as a geopoint?

Oh, and by the way. I already have a DB set up with geopoint column in geopint format.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

What is the easiest way of saving a geolocation service output (lat and long) into a DB as a geopoint?

Hi --

To save geo point in DB with geoPoint type you should do:
ol
liCreate update service./li

liNavigate to data tab./li

liClick "Edit mappings"./li

liNavigate to the "Request" tab./li

liFind your geoLocation field parameter. And click "Add JS"/"Edit JS"./li

liJS Editor appears. Insert the following code:
precode
//You should change these constants to your dynamic data. For example using localStorage variables.
var latitude = "44&quot
var longitude = "12&quot
return [latitude, longitude];/code/pre
/li
/ol
That's all. After the update service invokes you will update your geoPoint field type with values you have passed to.

Regards.

Return to “Issues”