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...
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.
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:
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
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
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 ;
}
Thank's a lot!
Works perfect!
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
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?
Hank,
Perhaps a view of the challenge you are describing? (Screen Print)...
Best,
Bruce