laura Gómez
Posts: 0
Joined: Mon Oct 14, 2013 9:51 am

Setting permanent Google Maps destination while geolocation sets start point.

Sorry, I don't understand you very well.

I invoke geolocation service in my screen3.

The first

event, succes:

var map = Appery('googlemap_12');
map.options['address']='';
map.refresh();

and then I load).gmap;
displayDirections(sourceAddress,destinationAddress,map);

laura Gómez
Posts: 0
Joined: Mon Oct 14, 2013 9:51 am

Setting permanent Google Maps destination while geolocation sets start point.

Sorry, I don't understand you very well.

I invoke geolocation service in my screen3.

The first

event, succes:

var map = Appery('googlemap_12');
map.options['address']='';
map.refresh();

and then

I load < invokeservice < geolocation.

Perfect.

And then I do:

edit mapping (screen3)

for latitude field:

localStorage.setItem('latitude',value);

for longitude field:

localStorage.setItem('longitude',value);

And then:

In the button,

event < click < run javascript

var sourceAddress = Appery("Screen3").val();
var long = localStorage.getItem('longitude');
var latit= localStorage.getItem('latitude');
var destinationAddress = new google.maps.LatLng(38.8667,-0.5167);
var map = Appery("googlemap_12").gmap;
displayDirections(sourceAddress,destinationAddress,map);

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Setting permanent Google Maps destination while geolocation sets start point.

You must use this code prevar sourceAddress = new google&#46;maps&#46;LatLng(localStorage&#46;getItem('latitude'),localStorage&#46;getItem('longitude'));
var destinationAddress = new google&#46;maps&#46;LatLng(38&#46;8667,-0&#46;5167);
var map = Appery("googlemap_12")&#46;gmap;
displayDirections(sourceAddress,destinationAddress,map);/pre instead prevar destinationAddress = new google&#46;maps&#46;LatLng(38&#46;8667,-0&#46;5167);
var sourceAddress = new google&#46;maps&#46;LatLng(38&#46;8167,-0&#46;6167);
var map = Appery("googlemap_12")&#46;gmap;
displayDirections(sourceAddress,destinationAddress,map); /pre

laura Gómez
Posts: 0
Joined: Mon Oct 14, 2013 9:51 am

Setting permanent Google Maps destination while geolocation sets start point.

ohh!!!!!!!!!!!!!!!! thanks!!!!!!!!!!!!!!!!!!!!!!!!!!

Vicent Cortés
Posts: 0
Joined: Sat Oct 12, 2013 5:09 pm

Setting permanent Google Maps destination while geolocation sets start point.

Hello,

I put the code in the tutorial so I locate, but it does not work. After I put the code from Google, and if that I find, but it does open the screen (load), but I would like me to locate when I click on the button. The code is as follows:

var map;

function initialize() {
var mapOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map($('div[dsid="googlemap"]').get(0), myOptions);

// Try HTML5 geolocation
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);

Code: Select all

   var infowindow = new google.maps.InfoWindow({ 
     map: map, 
     position: pos, 
     content: 'Location found using HTML5.' 
   }); 

map.setCenter(pos);
}, function() {
handleNoGeolocation(true);
});
} else {
// Browser doesn't support Geolocation
handleNoGeolocation(false);
}
}

function handleNoGeolocation(errorFlag) {
if (errorFlag) {
var content = 'Error: The Geolocation service failed.';
} else {
var content = 'Error: Your browser doesn\'t support geolocation.';
}

var options = {
map: map,
position: new google.maps.LatLng(60, 105),
content: content
};

var infowindow = new google.maps.InfoWindow(options);
map.setCenter(options.position);
}

google.maps.event.addDomListener(window, 'load', initialize);

Once I located by pressing the button, I put another button so that when they click it calculate me the route from my position to the beginning of the route (it is always the same point). What would be the code so that I could do this?

Thanks and regards

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting permanent Google Maps destination while geolocation sets start point.

Hi Vicent,

On button click, do you want to get a map for specified or current coordinates?

Grant Smith
Posts: 0
Joined: Fri Jan 03, 2014 11:13 am

Setting permanent Google Maps destination while geolocation sets start point.

I've gone through this and many other resources and still can't figure out why I'm getting the following error:

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting permanent Google Maps destination while geolocation sets start point.

Hi,

Where do you get this error? What are you trying to do? Are there any console errors (F12)?

Grant Smith
Posts: 0
Joined: Fri Jan 03, 2014 11:13 am

Setting permanent Google Maps destination while geolocation sets start point.

Thanks for the quick response,

I get this error on the Directions page when I click the "Use Current Location" button. This button is meant to use the GeoLocation and a specified Destination to give the user direction on a Google Map (like what this thread has been talking about). The console shows the following error:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.

Thanks!

Return to “Issues”