I am using google-maps-SDK and i want the user to be enabled to set the camera to his location. I set map.settings.myLocationButtonEnabled to true and i get the button, but i want customize it a bit. I want to change its location on the map and add some CSS features. How can i do it? In my HTML i have
<maps:mapView (mapReady)="onMapReady(map)" #map></maps:mapView>
And in my TS i have
onMapReady(map: MapView) {
this.mainMap = map;
map.settings.myLocationButtonEnabled = true;
}
You can't change the default button like that. However you can create your own location button, its easy and simple. In the html add a button over your map:
<button (tap)="setMyLocation()"></button>
And in your ts add this:
import * as geolocation from "nativescript-geolocation";
setMyLocation(){
geolocation.getCurrentLocation({ desiredAccuracy: Accuracy.high, maximumAge: 1000, timeout: 20000 }).then(loc => {
this.mainMap.latitude = loc.latitude;
this.mainMap.longitude = loc.longitude;
})
}