Hello guy…
I’ve got an issue about ‘reverseGeocode’
And I need your help. Thanks in advance
This is my Typescript file:
` ngAfterViewInit(){
this.mape = tt.map({
key: myKey,
container: 'mape',
style: 'tomtom://raster/1/basic-main',
draggable:true,
center:{lat:-8.7832,lng:34.5085},
});
this.onLastfunction()
}
onClickmap(makerCoord,pop){
const img=document.createElement(‘img’)
img.src=“https://icn.lycee-valin.fr/projets1/seconde14/groupe1/svg.svg”
img.style.width=“28px”
img.style.height=“28px”
this.marker=new tt.Marker(img,{draggable:true})
.setLngLat(makerCoord).setPopup(pop).addTo(this.mape)
}
ondrawPassengerMarkerOnMap(geoResponse){
if(
geoResponse && geoResponse.addresses
&& geoResponse.addresses[0].address.freeformAddress
){
this.passMaker=this.onClickmap(geoResponse.addresses[0].position,
new tt.Popup({ offset: 35 })
.setHTML(geoResponse.addresses[0].address.freeformAddress))
this.passMaker.togglePopup();
}
}
onLastfunction(){
this.mape.on(‘click’,(e)=>{
const position=e.lngLat;
console.log(position);
tt.services.reverseGeocode({
key: myKey,
position: position
}).go().then((resu)=>{
this.ondrawPassengerMarkerOnMap(resu);
})
})
}
`