Page 1 of 2

Geopoint on Rest to Map Maker

Posted: Mon Jun 01, 2015 5:43 am
by NigelG

Hi there,

New appery.io user here.

I am creating a small test app that saves locations to a database via REST, and then I would like to pull this back onto a map when this item is selected from a detail list.

The geolocate and save seems to be working ok, and I can do a list of the items in the collection, but I am really struggling with getting the geopoint column back and into a form that the google maps marker will understand.

Do I need to split it into a lat long from the geopoint data ?

Any help much appreciated. Nigel.


Geopoint on Rest to Map Maker

Posted: Tue Jun 02, 2015 6:25 am
by NigelG

So, have tried to make sure the Geopoint is stored propery. I have, [51.2658, -1.1015] in the database. Which is correct, and have rounded it.

So what I am trying to do is pull that back when I show that record, and display the position on a map. Along with the other fields, which display ok.


Geopoint on Rest to Map Maker

Posted: Tue Jun 02, 2015 1:27 pm
by Illya Stepanov

Hi Nigel -

Could you please show how you're passing GeoPoint into Google map markers?

This tutorial should be helpful here: https://devcenter.appery.io/tutorials...


Geopoint on Rest to Map Maker

Posted: Tue Jun 02, 2015 7:20 pm
by NigelG

Hi Illya,

Thanks, yes I have based my app on that tutorial. I am get the marker to drop on the map as it does on the start page. Then I save that location.

On a details page, I am mapping back the database values into a storage array, then splitting them into two separate storage variables, markerLat and Marker Lng. From the console this does get the right values back.

I then edited the code from the tutorial ....

var mapLatLng = new google.maps.LatLng(localStorage.getItem('markerLat'), localStorage.getItem('markerLng'));

var marker = new google.maps.Marker({
position: mapLatLng,
map: map,
title: "test",
animation: google.maps.Animation.DROP
});

bounds.extend(mapLatLng);
map.fitBounds(bounds);

But nothing happens. No errors.


Geopoint on Rest to Map Maker

Posted: Wed Jun 03, 2015 5:30 am
by NigelG

Although I do have two maps. So maybe I need a separate bit of JS for the 2nd map, and refer to that in the map : xxxxxmap ?


Geopoint on Rest to Map Maker

Posted: Thu Jun 04, 2015 6:36 pm
by Serhii Kulibaba

Hello,

Sure, you should use different map variables for different map components.


Geopoint on Rest to Map Maker

Posted: Thu Jun 04, 2015 6:42 pm
by NigelG

Tried that. Duplicated the map js, and rename it detmap, so changed the above to map : detmap

Still not working.


Geopoint on Rest to Map Maker

Posted: Mon Jun 08, 2015 11:56 am
by Serhii Kulibaba

Please provide us with a public app link: (http://devcenter.appery.io/documentat...) and steps to reproduce.


Geopoint on Rest to Map Maker

Posted: Mon Jun 08, 2015 7:30 pm
by NigelG

http://appery.io/app/mobile-frame?src...

Use "Interact" button on nav bar. The select a list item. The map should show the location.

I am using the same code as with the tutorial, and looking at the local variables the marker variable is ok.

Also having issues refreshing the map when you return, using "Collect" nav bar button.

Thanks.


Geopoint on Rest to Map Maker

Posted: Wed Jun 10, 2015 11:31 am
by Serhii Kulibaba

Please use initialize on "page show" event instead of "load"