Search code examples
ionic-frameworkleafletmaps

Leaflet map in ionic show always show itineray, show:false doesnt work


I'm working with a map, drawing a route between two points, using Ionic Cordova. Everything works fine except I can't hide itinerary (directions given by gps) and in small smartphones itinerary doesn't let user interacts with map. I googled examples but I see no diference with my code.

this.geolocation.getCurrentPosition().then(resp=>{
        this.localizacion = resp.coords;
        this.posicion = [this.localizacion.latitude, this.localizacion.longitude];

        this.map = leaflet.map('map', {
          center: this.posicion,
          zoom: 16
        });
        leaflet.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
          attribution: '© Código 200'
        }).addTo(this.map);
        let control = leaflet.Routing.control({
            waypoints: [
                leaflet.latLng(this.localizacion.latitude, this.localizacion.longitude),
                leaflet.latLng(result[0].latitude, result[0].longitude)
            ],
            routeWhileDragging: true, 
            show: false
        }).addTo(this.map

        let markerGroup = leaflet.featureGroup();
        let marker: any = leaflet.marker(this.center);
        markerGroup.addLayer(marker);
        let marker2: any = leaflet.marker(this.posicion);
        markerGroup.addLayer(marker2);

        this.map.addLayer(markerGroup);
});

Could anyone told me if I did something wrong?? or another way to hide itinerary


Solution

  • Well, I could fix it mixing online css feaflet use and a customized css into my project where I added the show:fakse and all what i needed.