Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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.

Hank Joreid
Posts: 0
Joined: Mon Apr 20, 2015 1:00 pm

Select location with map

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?
Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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 ;
}

Hank Joreid
Posts: 0
Joined: Mon Apr 20, 2015 1:00 pm

Select location with map

Thank's a lot!
Works perfect!

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

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

Hank Joreid
Posts: 0
Joined: Mon Apr 20, 2015 1:00 pm

Select location with map

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?

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Select location with map

Hank,

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

Best,

Bruce

Return to “Issues”