0

구글지도는 브라우저에 표시되지만 내가 명령을 ionic run android 를 실행할 때 성공적으로 구축하고 응용 프로그램을 실행하지만, 모든 것이 그냥 DEVICE READY FIRED AFTER 630 ms하지만 오류를 말한다 chrome://inspect에 오류가 없는지 구글지도를 제외하고 잘 작동 Google지도 용. 나는 console.developers.google.com에 앱을 등록하여 열쇠를 얻었으며 머리에 을 사용했지만 변경 사항은 없습니다. 고맙습니다. 지도가없는 이유 home.ts구글지도 문제 - 이온 2

// Get the current location 
    Geolocation.getCurrentPosition().then((position) => { 
    // Set latitude and longtitude variable 
    this.lat = position.coords.latitude; 
    this.long = position.coords.longitude; 

    // This function will get the name of the city where user is located 
    this.getCityName(this.lat, this.long); 

    // this function sets up the google map 
    let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 

    let mapOptions = { 
    center: latLng, 
    zoom: 11, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    } 
    var mapi = new google.maps.Map(this.mapDiv.nativeElement, mapOptions); 
    // Below code is provided by a ai pollution control website (http://aqicn.org/faq/2015-09-18/map-web-service-real-time-air-quality-tile-api/) 
    // haven't changed anything in below code copied as it is from web 
    var waqiMapOverlay = new google.maps.ImageMapType({ 
       getTileUrl: function(coord, zoom) { 
         return 'http://tiles.aqicn.org/tiles/usepa-aqi/' + zoom + "/" + coord.x + "/" + coord.y + ".png?token=_TOKEN_ID_"; 
       }, 
       name: "Air Quality", 
    }); 
    // Insert above received data into map 
    mapi.overlayMapTypes.insertAt(0,waqiMapOverlay); 

`

답변

0

아마지도가 점점되지 좌표 (position.coords.latitude, position.coords.longitude), 그건 (지도 기능은이 파일의 내부) 표현. Geooloaction.getCurrentPosition ... 또는 사용자 위치 정보를 얻기 위해 플러그인이 필요한지 확인하십시오. & 일부 대체 좌표를 선호합니다.

this.lat = position.coords.latitude || "21.1610858"; 
this.long = position.coords.longitude || "79.0725101"; 
+0

내 문제가 해결되었습니다. 답변 주셔서 감사합니다. –