Page 1 of 1

get current location with GPS

Posted: Tue Mar 18, 2014 8:21 pm
by Mike6730019

Hi. I reviewed the GPS Webinar that's posted and for the most part have everything working. I'm trying to add it as a field in the user registration page though and not as a stand alone application. Can I add the info to the signup_service database service? Didn't seem to work. The column I created in my user database was created as a geo point column...should it be set as string data? I guess the goal is just that the location data is attached to the user so we know where the range of signups occur. Thanks!

Mike


get current location with GPS

Posted: Tue Mar 18, 2014 9:01 pm
by Maryna Brodina

Hello!
Should be working, but please note if you add field with geopoint type, while creating/updating record you have to send object, not string. So in mapping you need to add JS to return array, not string.


get current location with GPS

Posted: Tue Mar 18, 2014 11:27 pm
by Mike6730019

You're the best...thanks!! Is there tutorials/docs that discuss converting latitude and longitude to city/state/region text (no map)? I believe it incorporates the Google API for maps but didn't know if that was the best way for what I need.

Great user support...I'll be upgrading my Appery plan.


get current location with GPS

Posted: Wed Mar 19, 2014 2:13 am
by Illya Stepanov

Hi Mike,

To get the address by coordinate you should use reverse geoCoding API.

Please take a look the doc: https://developers.google.com/maps/do...

After you read this documentation you have to add service.

with url: https://maps.googleapis.com/maps/api/...

and parameters: "latlng" and "sensor"

You should use this service in accordance to your needs.


get current location with GPS

Posted: Wed Mar 19, 2014 2:02 pm
by Mike6730019

Hi Maryna,

I tried to implement reverse geoCoding but it wasn't working. I put everything back the way it was set up last night (after you had the lat and lng pushing to the user db) but it's no longer sending that info. Everything else is working correctly. Could you take a look to see if I changed something you had in place? Looks ok to me but something must be off.

Thanks,
Mike


get current location with GPS

Posted: Wed Mar 19, 2014 10:33 pm
by Alena Prykhodko

Hi Mike,

Please post a screen shots of your reverse geoCoding service (Settings, Request, Test tabs).

Also please provide us with screen shots of Network tab in debuger (http://docs.appery.io/documentation/d...).
so we can see real request to reverceGeoCoding service with headers and parameters

Any other information also could help.


get current location with GPS

Posted: Thu Mar 20, 2014 2:09 pm
by Mike6730019

Thanks. I need to get things back working as I had it (sending lng and lat info to user database with other registration fields). I've upgraded my account so I'll duplicate the page and work on the reverse geoCoding once I get things fixed.


get current location with GPS

Posted: Tue Mar 25, 2014 6:41 pm
by Mike6730019

Hi Maryna,

Could you tell me what JS script you added in the mapping field that enabled the location info to push to the user database? Whatever you did had it working and I'm unable to recreate it. Thanks.

Mike

Should be working, but please note if you add field with geopoint type, while creating/updating record you have to send object, not string. So in mapping you need to add JS to return array, not string.


get current location with GPS

Posted: Tue Mar 25, 2014 11:03 pm
by Alena Prykhodko

Hi Mike.

You should return array in the "edit js".

Right example:

pre
var longitude = "-40.714224";
var latitude = "-73.961452";

return [longitude, latitude];/pre