Page 2 of 3

Select location with map

Posted: Wed Apr 22, 2015 8:34 pm
by Bruce Stuart

Here's a sample of what I'm doing in the Geolocation service - success event - to SAVE the current location - and then later - set the map center to these values...

Image


Select location with map

Posted: Wed Apr 22, 2015 8:36 pm
by Bruce Stuart

and finally ps - This also relies on your having checked visible OFF on the default MARKER (not the map) - on your Google Map - in the Appery Designer.


Select location with map

Posted: Fri Apr 24, 2015 1:26 pm
by Hank Joreid

Hi, Thanks a lot your help!
I can now move the marker and the markes is set to the center of my geotrack.
But 2 things:

  1. how to get the Markers Location, after it have change place?
  2. If i load the page with the map more than one time it comes 1 marker extra for eatch time i refressh, how to fix that?

Select location with map

Posted: Fri Apr 24, 2015 11:55 pm
by Bruce Stuart

Hi Hank,

sorry for the delay. Reply in progress. Give me a few ....I'll get the details for you in a second.

Best,

Bruce


Select location with map

Posted: Sat Apr 25, 2015 12:16 am
by Bruce Stuart

Step 1:

  • add these lines of code to the Javascript file you imported above (go to Javascript in the navigator and click on the Javascript file you created above):

    function fRemoveMarker(){
    oGlobalMarker.setMap( null );
    oGlobalMarker = null ;
    return ;
    }

    In your page show event - change the code here to:

    if ( bMarkerDropped ){ fRemoveMarker();}
    bMarkerDropped = false;
    fInitMarker();

    that should take care of the challenge with the multiple markers....

    Next ---- recording the location...

    Best,
    Bruce


Select location with map

Posted: Sat Apr 25, 2015 6:57 am
by Bruce Stuart

Step 2. - AFTER you have step 1 above working (and you don't have duplicate markers any longer) - then ...

Open the Javascript file that you loaded originally - and remove all the contents in the file (Select ALL and then delete the text) - replace it with the contents from this file:

http://the-software-studio.com/javasc...

After you've loaded the file - during the test - you'll get an Alert from this function - when you move a marker to the new location - telling you where the new location is.

When this works - you're ready to implement a service in that function - that records the new location to a data store of your choice. (See the commented out code below)....

function fmovemarker( omarker )
{
var stitle = omarker.getTitle();
var oposition = omarker.getPosition();
var nLat = oposition.lat();
var nLng = oposition.lng();
alert('New Position is: ' + oposition.toString() );
// see if the position is within the course bounds....
console.log('moved marker ...:');
localStorage.setItem('n_long', oposition.lng() );
localStorage.setItem('n_lat', oposition.lat() );
// service_updatemarker.execute({});
return ;
}


Select location with map

Posted: Sat Apr 25, 2015 1:15 pm
by Hank Joreid

Thank's a lot!
Works perfect!


Select location with map

Posted: Sat Apr 25, 2015 1:35 pm
by Bruce Stuart

Hank, great ! Let me know if you need any help implementing the data service to record the new location.... But you have all the building blocks to do so here !

Best,
Bruce


Select location with map

Posted: Mon Apr 27, 2015 9:53 am
by Hank Joreid

Hi, Agan.
Some times the marker work great but sometimes it spam down with ulimmited of markers. so i need to restart the app to fix.

How to fix this?


Select location with map

Posted: Tue Apr 28, 2015 4:09 am
by Bruce Stuart

Hank,

Perhaps a view of the challenge you are describing? (Screen Print)...

Best,

Bruce