So, first Google Maps Engine (GME) is the data / service layer. Conversely, the user's position will come from the client / presentation level, which in this case is your browser, mobile device, or more complex setting using an external GPS installation. Therefore, ultimately, moving the user’s location icon on your map is not what you intend to do with GME. Instead, you’ll need to associate the technologies that are available directly to your customer with the functionality displayed in the Google Maps API.
, API HTML- HTML5. . , Google. , /GPS -API, /SDK.
, .
HTML5 , Google
var _MobilePosition;
var _LAST_GPS_ERROR;
var _MobileIcon = {
path: 'M 0, 0 m -5, 0 a 5, 5 0 1, 0 10, 0 a 5, 5 0 1, 0 -10, 0',
fillColor: '#00FF00',
fillOpacity: 0.8,
scale: 1,
strokeColor: '#00FF00',
strokeWeight: 0
};
var _MobileMarker = new google.maps.Marker({
icon: _MobileIcon
});
var _WPID = navigator.geolocation.watchPosition(
geo_success,
geo_error,
{
enableHighAccuracy:true,
timeout:5000,
maximumAge:1000
}
);
function geo_success(pos)
{
if(typeof google.maps.LatLng !== 'undefined')
{
var lat = Number(pos.coords.latitude);
var lng = Number(pos.coords.longitude);
_MobilePosition = new google.maps.LatLng(lat,lng);
_MobileMarker.setVisible(true);
_MobileMarker.setPosition(_MobilePosition);
_MobileMarker.setMap(_map);
if( typeof _MobilePosition !== 'undefined' )
{
_map.panTo(_MobilePosition);
}
}
}
function geo_error(error)
{
_LAST_GPS_ERROR = error;
};