How to use the @ionic-native/google-maps.LatLng function in @ionic-native/google-maps

To help you get started, we’ve selected a few @ionic-native/google-maps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / Ionic-MFP-App / IonicMobileApp / src / pages / report-new / report-new.ts View on Github external
createMap() {
    // TODO need to store/retrieve prevLoc in app preferences/local storage
    let prevLoc = new LatLng(13.0768342, 77.7886087);
    let mapOptions: GoogleMapOptions = {
      camera: {
        target: prevLoc,
        zoom: 15,
        tilt: 10
      }
    };
    this.map = GoogleMaps.create('map', mapOptions);
    this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
      console.log('--> ReportNewPage: Map is Ready To Use');
      this.mapReady = true;
      // https://stackoverflow.com/questions/4537164/google-maps-v3-set-single-marker-point-on-map-click
      this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe( event => {
        this.location = event[0];
        console.log('--> ReportNewPage: User clicked location = ' + event[0]);
        this.map.clear();
github longzheng / mypal-ionic / src / pages / topup-map / topup-map.ts View on Github external
(locations: any) => {
            // process all markers
            for (var i = 0; i < locations.length; i++) {
              let location = locations[i];

              // create new marker
              let markerOptions: MarkerOptions = {
                position: new LatLng(location.outlet_latitude, location.outlet_longitude),
                title: location.outlet_business,
                snippet: `${location.outlet_name}, ${location.outlet_suburb}, ${location.outlet_postcode}`+
                `\r\nMonday: ${location.outlet_business_hour_mon !== null ? location.outlet_business_hour_mon : "N/A"}`+
                `\r\nTuesday: ${location.outlet_business_hour_tue !== null ? location.outlet_business_hour_tue : "N/A"}`+
                `\r\nWednesday: ${location.outlet_business_hour_wed !== null ? location.outlet_business_hour_wed : "N/A"}`+
                `\r\nThursday: ${location.outlet_business_hour_thur !== null ? location.outlet_business_hour_thur : "N/A"}`+
                `\r\nFriday: ${location.outlet_business_hour_fri !== null ? location.outlet_business_hour_fri : "N/A"}`+
                `\r\nSaturday: ${location.outlet_business_hour_sat !== null ? location.outlet_business_hour_sat : "N/A"}`+
                `\r\nSunday: ${location.outlet_business_hour_sun !== null ? location.outlet_business_hour_sun : "N/A"}`
              };
              // add marker to list to be added
              this.map.addMarker(markerOptions);
            }
            loader.dismiss();
          }
        , error => {
github IBM / Ionic-MFP-App / IonicMobileApp / src / pages / problem-detail / problem-detail.ts View on Github external
loadMap() {
    let loc = new LatLng(this.grievance.geoLocation.coordinates[1], this.grievance.geoLocation.coordinates[0]);
    let mapOptions: GoogleMapOptions= {
      camera: {
        target: loc,
        zoom: 15,
        tilt: 10
      }
    };
    this.map = GoogleMaps.create('map', mapOptions);
    this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
      this.map.addMarker({
        title: 'Problem Location',
        position: loc
      }).then((marker: Marker) => {
        marker.showInfoWindow();
      }).catch(err => {
        console.log(err);
github UCL-INGI / StudUCLouvain / src / providers / map-services / map-service.ts View on Github external
private addDeviceMarker(lat: number, lng: number, address: string, title: string) {
    let latLng = new LatLng(lat, lng);
    let markerOptions: MarkerOptions = {
      position: latLng,
      title: title,
      snippet: address
    };
    this.map.addMarker(markerOptions).then(
      (marker: Marker) => {
        marker.showInfoWindow();
        this.markers.push(marker);
        this.setCenteredMarkerOnDevice(title, lat, lng);
      });
  }
github yannbf / ion-maps / src / providers / maps / native-google-maps / native-google-maps.ts View on Github external
addMarker(marker: IonMarker) {
    const { lat, lng, iconUrl, title,
      animated, draggable, visible,
      zIndex } = marker;
    const markerOptions: MarkerOptions = {
      position: new LatLng(lat, lng),
      title,
      icon: iconUrl,
      animation: animated ? GoogleMapsAnimation.DROP : null,
      zIndex,
      draggable,
      visible
    };

    return this.map.addMarker(markerOptions);
  }
}
github yannbf / ion-maps / src / providers / maps / native-google-maps / native-google-maps.ts View on Github external
      .then((position) => new LatLng(position.coords.latitude, position.coords.longitude));
  }
github yannbf / ionic3-components / src / providers / native-google-maps / native-google-maps.ts View on Github external
this.geolocation.getCurrentPosition().then((position) => {
        const latLng: LatLng = new LatLng(position.coords.latitude, position.coords.longitude);
        resolve(latLng);
      }, error => {
        reject(error);
github UCL-INGI / StudUCLouvain / src / providers / map-services / map-service.ts View on Github external
this.markers.map((marker) => {
      if(marker.getTitle() == title) {
        let latLng = new LatLng(lat, lng);
        let camPos: CameraPosition = {
          target: latLng,
          zoom: 15
        };
        this.map.moveCamera(camPos);
      }
    });
  }